[ 
https://issues.apache.org/jira/browse/CXF-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995906#comment-12995906
 ] 

Sergey Beryozkin commented on CXF-3226:
---------------------------------------

Ouch...

The simplest workaround is to register a custom CXF in interceptor and replace 
the Message.REQUEST_URI message property with the new value where ':' are 
replaced with %3A:

public class CustomInInterceptor extends AbstractPhaseInterceptor<Message> {

    public CustomInInterceptor() {
        super(Phase.UNMARSHAL);
    }

    @Override
    public void handleMessage(Message message) {

         String uri = message.get(Message.REQUEST_URI);
         
         uri.replace(":", "%3A");
         
         message.put(Message.REQUEST_URI, uri);
           
    } 
}

and then register it inside the jaxrs:inInterceptors

It should provide a workaround fix and I will apply a fix to the trunk too.
thanks

> Going to a JAX-RS resource that contains a space in the path returns a 404 
> response code
> ----------------------------------------------------------------------------------------
>
>                 Key: CXF-3226
>                 URL: https://issues.apache.org/jira/browse/CXF-3226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.3.1
>         Environment: Java 1.6_22
> Apache CXF 2.3.1
>            Reporter: Jason Downey
>            Assignee: Sergey Beryozkin
>             Fix For: 2.3.2, 2.4
>
>         Attachments: cxf_jax_rs_space_bug.zip, patch.diff
>
>
> If you go to a JAX-RS resource that contains a space in the path, the Apache 
> CXF JAX-RS runtime returns a 404 response code. In the STDERR log, you'll see 
> the following message:
> Jan 1, 2011 3:05:01 PM org.apache.cxf.jaxrs.utils.JAXRSUtils findTargetMethod
> WARNING: .No operation matching request path /has%20space is found, HTTP 
> Method : GET, ContentType : */*, Accept : 
> application/xml,application/xhtml+xml,image/png,text/html;q=0.9,text/plain;q=0.8,*/*;q=0.5,.
> The cause for this problem may be found in 
> AbstractServerController.getBaseURL. It assumes pathInfo is always decoded 
> but in the JAX-RS situation, it may actually still be encoded.
> Relevant sample code + patch attached.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to