cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r785736 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/
Date Wed, 17 Jun 2009 17:24:58 GMT
Author: sergeyb
Date: Wed Jun 17 17:24:57 2009
New Revision: 785736

URL: http://svn.apache.org/viewvc?rev=785736&view=rev
Log:
Merged revisions 785734 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r785734 | sergeyb | 2009-06-17 18:17:44 +0100 (Wed, 17 Jun 2009) | 1 line
  
  JAXRS: retrieval of wadl, just to facilitate DOSGI testing, wadl support is still primitive
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 17 17:24:57 2009
@@ -1 +1 @@
-/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784183,784893,784895,785279-785282,785468,785624,785651
+/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784183,784893,784895,785279-785282,785468,785624,785651,785734

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jun 17 17:24:57 2009
@@ -1 +1 @@
-/cxf/trunk:1-782619,782728-782730,783097,783294,783396,784059,784181-784183,784893-785620,785622-785624,785651
+/cxf/trunk:1-782619,782728-782730,783097,783294,783396,784059,784181-784183,784893-785620,785622-785624,785651,785734

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=785736&r1=785735&r2=785736&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
Wed Jun 17 17:24:57 2009
@@ -126,10 +126,11 @@
         String httpMethod = (String)message.get(Message.HTTP_REQUEST_METHOD);
         OperationResourceInfo ori = null;     
         
+        boolean operChecked = false;
         List<ProviderInfo<RequestHandler>> shs = ProviderFactory.getInstance(message).getRequestHandlers();
         for (ProviderInfo<RequestHandler> sh : shs) {
             String newAcceptTypes = (String)message.get(Message.ACCEPT_CONTENT_TYPE);
-            if (!acceptTypes.equals(newAcceptTypes) || ori == null) {
+            if (!acceptTypes.equals(newAcceptTypes) || (ori == null && !operChecked))
{
                 acceptTypes = newAcceptTypes;
                 acceptContentTypes = JAXRSUtils.sortMediaTypes(newAcceptTypes);
                 message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);
@@ -143,17 +144,11 @@
                     ori = JAXRSUtils.findTargetMethod(resource, 
                         values.getFirst(URITemplate.FINAL_MATCH_GROUP), httpMethod, values,

                         requestContentType, acceptContentTypes);
+                    message.getExchange().put(OperationResourceInfo.class, ori);
                 } catch (WebApplicationException ex) {
-                    if (ex.getResponse() != null && ex.getResponse().getStatus()
== 405 
-                        && "OPTIONS".equalsIgnoreCase(httpMethod)) {
-                        Response response = JAXRSUtils.createResponseBuilder(resource, 200,
true).build();
-                        message.getExchange().put(Response.class, response);
-                        return;
-                    } else {
-                        throw ex;
-                    }
+                    operChecked = true;
                 }
-                message.getExchange().put(OperationResourceInfo.class, ori);
+                
             }
             Response response = sh.getProvider().handleRequest(message, resource);
             if (response != null) {
@@ -173,9 +168,20 @@
                                                           rawPath, 
                                                           values);
             }
-            ori = JAXRSUtils.findTargetMethod(resource, values.getFirst(URITemplate.FINAL_MATCH_GROUP),

-                                              httpMethod, values, requestContentType, acceptContentTypes);
-            message.getExchange().put(OperationResourceInfo.class, ori);
+            try {                
+                ori = JAXRSUtils.findTargetMethod(resource, values.getFirst(URITemplate.FINAL_MATCH_GROUP),

+                                            httpMethod, values, requestContentType, acceptContentTypes);
+                message.getExchange().put(OperationResourceInfo.class, ori);
+            } catch (WebApplicationException ex) {
+                if (ex.getResponse() != null && ex.getResponse().getStatus() == 405

+                    && "OPTIONS".equalsIgnoreCase(httpMethod)) {
+                    Response response = JAXRSUtils.createResponseBuilder(resource, 200, true).build();
+                    message.getExchange().put(Response.class, response);
+                    return;
+                } else {
+                    throw ex;
+                }
+            }
         }
 
         

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java?rev=785736&r1=785735&r2=785736&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
Wed Jun 17 17:24:57 2009
@@ -134,7 +134,7 @@
         int status = response.getStatus();
         Object responseObj = response.getEntity();
         if (status == 200 && !isResponseNull(responseObj) && firstTry 
-            && JAXRSUtils.headMethodPossible(ori.getHttpMethod(), 
+            && ori != null && JAXRSUtils.headMethodPossible(ori.getHttpMethod(),

                 (String)message.getExchange().getInMessage().get(Message.HTTP_REQUEST_METHOD)))
{
             LOG.info(new org.apache.cxf.common.i18n.Message("HEAD_WITHOUT_ENTITY", BUNDLE).toString());
             responseObj = null;

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=785736&r1=785735&r2=785736&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
Wed Jun 17 17:24:57 2009
@@ -46,6 +46,7 @@
 import org.apache.cxf.jaxrs.impl.RequestPreprocessor;
 import org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper;
 import org.apache.cxf.jaxrs.model.ProviderInfo;
+import org.apache.cxf.jaxrs.model.wadl.WadlGenerator;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
@@ -77,7 +78,8 @@
                                     new PrimitiveTextProvider(),
                                     new MultipartProvider(),
                                     new WebApplicationExceptionMapper(),
-                                    new SystemQueryHandler());
+                                    new SystemQueryHandler(),
+                                    new WadlGenerator());
     }
     
     private List<ProviderInfo<MessageBodyReader>> messageReaders = 



Mime
View raw message