You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2015/12/18 15:15:07 UTC

svn commit: r1720791 - /httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java

Author: olegk
Date: Fri Dec 18 14:15:07 2015
New Revision: 1720791

URL: http://svn.apache.org/viewvc?rev=1720791&view=rev
Log:
PATCH method support
Contributed by Ömer Özkan <omer at ozkan.info>

Modified:
    httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java?rev=1720791&r1=1720790&r2=1720791&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java (original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java Fri Dec 18 14:15:07 2015
@@ -63,6 +63,9 @@ public class DefaultHttpRequestFactory i
         "CONNECT"
     };
 
+    private static final String[] RFC5789_ENTITY_ENC_METHODS = {
+        "PATCH"
+    };
 
     public DefaultHttpRequestFactory() {
         super();
@@ -88,8 +91,10 @@ public class DefaultHttpRequestFactory i
             return new BasicHttpEntityEnclosingRequest(requestline);
         } else if (isOneOf(RFC2616_SPECIAL_METHODS, method)) {
             return new BasicHttpRequest(requestline);
+        } else if (isOneOf(RFC5789_ENTITY_ENC_METHODS, method)) {
+            return new BasicHttpEntityEnclosingRequest(requestline);
         } else {
-            throw new MethodNotSupportedException(method +  " method not supported");
+            throw new MethodNotSupportedException(method + " method not supported");
         }
     }
 
@@ -102,6 +107,8 @@ public class DefaultHttpRequestFactory i
             return new BasicHttpEntityEnclosingRequest(method, uri);
         } else if (isOneOf(RFC2616_SPECIAL_METHODS, method)) {
             return new BasicHttpRequest(method, uri);
+        } else if (isOneOf(RFC5789_ENTITY_ENC_METHODS, method)) {
+            return new BasicHttpEntityEnclosingRequest(method, uri);
         } else {
             throw new MethodNotSupportedException(method
                     + " method not supported");