cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r798930 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
Date Wed, 29 Jul 2009 14:58:17 GMT
Author: sergeyb
Date: Wed Jul 29 14:58:17 2009
New Revision: 798930

URL: http://svn.apache.org/viewvc?rev=798930&view=rev
Log:
JAXRS : improving the way OPTIONS verb is handled

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=798930&r1=798929&r2=798930&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Wed
Jul 29 14:58:17 2009
@@ -333,9 +333,17 @@
     public static ResponseBuilder createResponseBuilder(ClassResourceInfo cri, int status,
boolean addAllow) {
         ResponseBuilder rb = Response.status(status);
         if (addAllow) {
-            for (String m : cri.getAllowedMethods()) {
+            Set<String> allowedMethods = cri.getAllowedMethods();
+            for (String m : allowedMethods) {
                 rb.header("Allow", m);
             }
+            // "OPTIONS" are supported all the time really
+            if (!allowedMethods.contains("OPTIONS")) {
+                rb.header("Allow", "OPTIONS");
+            }
+            if (!allowedMethods.contains("HEAD") && allowedMethods.contains("GET"))
{
+                rb.header("Allow", "HEAD");
+            }
         }
         return rb;
     }



Mime
View raw message