cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r903720 - in /cxf/branches/2.2.x-fixes: ./ api/src/main/java/org/apache/cxf/message/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ systests/jaxrs/ systests/jaxr...
Date Wed, 27 Jan 2010 16:39:27 GMT
Author: sergeyb
Date: Wed Jan 27 16:39:26 2010
New Revision: 903720

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

........
  r903712 | sergeyb | 2010-01-27 16:28:46 +0000 (Wed, 27 Jan 2010) | 1 line
  
  Connecting JMS Transport with JAXRS endpoints
........

Added:
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSJmsTest.java
      - copied unchanged from r903712, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSJmsTest.java
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JMSServer.java
      - copied unchanged from r903712, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JMSServer.java
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml
      - copied unchanged from r903712, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java
    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/utils/HttpUtils.java
    cxf/branches/2.2.x-fixes/systests/jaxrs/pom.xml

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:903712

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java?rev=903720&r1=903719&r2=903720&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java Wed Jan
27 16:39:26 2010
@@ -67,6 +67,7 @@
      */
     String DECOUPLED_CHANNEL_MESSAGE = "decoupled.channel.message";
     String PARTIAL_RESPONSE_MESSAGE = "org.apache.cxf.partial.response";
+    String ONE_WAY_MESSAGE = "OnewayMessage";
     
     String PROTOCOL_HEADERS = Message.class.getName() + ".PROTOCOL_HEADERS";
     String RESPONSE_CODE = Message.class.getName() + ".RESPONSE_CODE";

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=903720&r1=903719&r2=903720&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 Jan 27 16:39:26 2010
@@ -46,6 +46,7 @@
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.Service;
@@ -125,7 +126,7 @@
         Service service = message.getExchange().get(Service.class);
         List<ClassResourceInfo> resources = ((JAXRSServiceImpl)service).getClassResourceInfos();
 
-        String acceptTypes = (String)message.get(Message.ACCEPT_CONTENT_TYPE);
+        String acceptTypes = HttpUtils.getProtocolHeader(message, Message.ACCEPT_CONTENT_TYPE,
null);
         if (acceptTypes == null) {
             acceptTypes = "*/*";
             message.put(Message.ACCEPT_CONTENT_TYPE, acceptTypes);
@@ -150,13 +151,13 @@
 
         message.getExchange().put(JAXRSUtils.ROOT_RESOURCE_CLASS, resource);
 
-        String httpMethod = (String)message.get(Message.HTTP_REQUEST_METHOD);
+        String httpMethod = HttpUtils.getProtocolHeader(message, Message.HTTP_REQUEST_METHOD,
"POST");
         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);
+            String newAcceptTypes = HttpUtils.getProtocolHeader(message, Message.ACCEPT_CONTENT_TYPE,
"*/*");
             if (!acceptTypes.equals(newAcceptTypes) || (ori == null && !operChecked))
{
                 acceptTypes = newAcceptTypes;
                 acceptContentTypes = JAXRSUtils.sortMediaTypes(newAcceptTypes);
@@ -241,6 +242,9 @@
             plainOperationName = ori.getClassResourceInfo().getServiceClass().getSimpleName()
                 + "#" + plainOperationName;
         }
-        message.getExchange().put("org.apache.cxf.resource.operation.name", plainOperationName);
   
+        message.getExchange().put("org.apache.cxf.resource.operation.name", plainOperationName);
+        
+        message.getExchange().setOneWay(
+            MessageUtils.isTrue(HttpUtils.getProtocolHeader(message, Message.ONE_WAY_MESSAGE,
null)));
     }
 }

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java?rev=903720&r1=903719&r2=903720&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
Wed Jan 27 16:39:26 2010
@@ -38,6 +38,7 @@
 import javax.ws.rs.core.Response;
 
 import org.apache.cxf.common.util.UrlUtils;
+import org.apache.cxf.jaxrs.impl.HttpHeadersImpl;
 import org.apache.cxf.jaxrs.impl.PathSegmentImpl;
 import org.apache.cxf.jaxrs.model.ParameterType;
 import org.apache.cxf.message.Message;
@@ -146,18 +147,25 @@
     }
     
     public static String getPathToMatch(Message m, boolean addSlash) {
-        String requestAddress = (String)m.get(Message.REQUEST_URI);
+        String requestAddress = getProtocolHeader(m, Message.REQUEST_URI, "/");
         String baseAddress = getBaseAddress(m);
         return getPathToMatch(requestAddress, baseAddress, addSlash);
     }
     
+    public static String getProtocolHeader(Message m, String name, String defaultValue) {
+        String value = (String)m.get(name);
+        if (value == null) {
+            value = new HttpHeadersImpl(m).getRequestHeaders().getFirst(name);
+        }
+        return value == null ? defaultValue : value;
+    }
     
     public static String getBaseAddress(Message m) {
+        String endpointAddress = getEndpointAddress(m);
         try {
-            String endpointAddress = getEndpointAddress(m);
             return new URL(endpointAddress).getPath();
         } catch (MalformedURLException ex) {
-            return (String)m.get(Message.BASE_PATH);
+            return endpointAddress == null ? "/" : endpointAddress;
         }
     }
     

Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/pom.xml?rev=903720&r1=903719&r2=903720&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/pom.xml (original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/pom.xml Wed Jan 27 16:39:26 2010
@@ -138,6 +138,16 @@
             <artifactId>cxf-rt-transports-http</artifactId>
             <version>${project.version}</version>
         </dependency>
+         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-jms</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-core</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-http-jetty</artifactId>



Mime
View raw message