You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2012/11/29 17:04:58 UTC

[jira] [Resolved] (CXF-4643) Initial non-GET request returns 404 if it has query parameters

     [ https://issues.apache.org/jira/browse/CXF-4643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-4643.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.7.1
                   2.6.4
                   2.5.7
         Assignee: Sergey Beryozkin
    
> Initial non-GET request returns 404 if it has query parameters
> --------------------------------------------------------------
>
>                 Key: CXF-4643
>                 URL: https://issues.apache.org/jira/browse/CXF-4643
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.7.0
>         Environment: Jetty Maven Plugin (default version) 
>            Reporter: Jason Gustafson
>            Assignee: Sergey Beryozkin
>             Fix For: 2.5.7, 2.6.4, 2.7.1
>
>         Attachments: cxf-test.tar.gz
>
>
> Hello, I ran into a weird case where an initial HTTP non-GET request returns 404 if there happens to be query parameters in it. Basically, you can take the code below, start up a servlet container, and do the following curl commands:
> > curl -v -X PUT http://localhost:8080/cxf-test/woot?foo=bar -d "Name"
> 404
> > curl -v http://localhost:8080/cxf-test/woot
> 200
> > curl -v -X PUT http://localhost:8080/cxf-test/woot?foo=bar -d "Name"
> 204
> I tracked the problem down to ServletController:184 (in the 2.7.0 sources). I don't know why "updateDestination" is invoked only for GET, but this case works fine if it is invoked regardless of the method. Is there perhaps a problem in my configuration?
> RestService
> -----------
> @Service("theRestService")
> @Path("/")
> public class TheRestService {
>     
>     @PUT
>     public void putHello(@QueryParam("foo") String foo, String name) {
>         System.out.println("Hello " + name);
>     }
>     
>     @GET 
>     public String getHello() {
>         return "foo";
>     }
> }
> web.xml
> -------
> <web-app>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>
> 			classpath:/META-INF/spring/spring.xml
> 		</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>
> 			org.springframework.web.context.ContextLoaderListener
> 		</listener-class>
> 	</listener>
>     <servlet>
>         <servlet-name>TheServlet</servlet-name>
>         <display-name>The Servlet</display-name>
>         <servlet-class>
>             org.apache.cxf.transport.servlet.CXFServlet
>         </servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>	
>     <servlet-mapping>
>         <servlet-name>TheServlet</servlet-name>
>         <url-pattern>/woot/*</url-pattern>
>     </servlet-mapping>	
> </web-app>
> spring.xml
> ----------
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
> 	xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang"
> 	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
> 	xmlns:p="http://www.springframework.org/schema/p" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> 	xmlns:context="http://www.springframework.org/schema/context"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd          
>        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
>        http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd       
>        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
>        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
>        http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
>        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd                 
>        http://www.springframework.org/schema/context
>        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
>     <import resource="classpath:META-INF/cxf/cxf.xml" />
>     <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> 
> 	<!-- Spring Bean Setup -->
> 	<context:annotation-config />
> 	<context:component-scan base-package="test.cxf" />
>     
>     <jaxrs:server id="theServer" address="/">
>         <jaxrs:serviceBeans>
>             <ref bean="theRestService" />              
>         </jaxrs:serviceBeans>
>     </jaxrs:server>
>        	
> </beans>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira