Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7016595

HttpURLConnection must not restrict method name

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 6u23
    • core-libs
    • x86
    • solaris_8, windows_7

      FULL PRODUCT VERSION :
      java version "1.6.0_23"
      Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7600]

      A DESCRIPTION OF THE PROBLEM :
      HttpURLConnection is unable to process non-standard HTTP methods like "PROPFIND" (WebDAV) or "PATCH".

      This is a major issue as PROPFIND and PATCH are not uncommon and gain more attenation with RESTful services and the rise of supporting APIs like JAX-RS.

      It makes no sense to restrict the set of possible methods, and it was never HTTP's intention to be restricted in that way (it is specifying just a base set of methods), so the restriction has to be removed ASAP.

      This is a showstopper for anybody in the need of connecting to WebDAV or PATCHable resources!

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      HttpURLConnection c = url.openConnection();
      c.setRequestMethod("PROPFIND");
      c.getInputStream();

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Will execute PROPFIND.
      ACTUAL -
       java.net.ProtocolException: Invalid HTTP method: PROPFIND
      at java.net.HttpURLConnection.setRequestMethod(Unknown Source)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
       java.net.ProtocolException: Invalid HTTP method: PROPFIND
      at java.net.HttpURLConnection.setRequestMethod(Unknown Source)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      see above
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Using URLConnection and implement HTTP manually or use a third party HTTP library. Both breaks the WORA principle as whether PROPFIND works or not is dependent on something not told in the JavaDocs of HttpURLConnection!

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: