You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Jason Downey (JIRA)" <ji...@apache.org> on 2011/01/02 00:23:45 UTC
[jira] Created: (CXF-3226) Going to a JAX-RS resource that contains
a space in the path returns a 404 response code
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
Fix For: 2.3.2
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 circumstances it it actually still decoded.
Relevant sample code + patch attached.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CXF-3226) Going to a JAX-RS resource that contains
a space in the path returns a 404 response code
Posted by "Jason Downey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jason Downey updated CXF-3226:
------------------------------
Description:
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.
was:
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 circumstances it it actually still decoded.
Relevant sample code + patch attached.
> 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
> Fix For: 2.3.2
>
> 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.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-3226) Going to a JAX-RS resource that
contains a space in the path returns a 404 response code
Posted by "Christophe ThiƩbaud (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995875#comment-12995875 ]
Christophe ThiƩbaud commented on CXF-3226:
------------------------------------------
This fix caused a regression on our system.
We have a jaxrs service annotated with the following path :
@Path("/{g}:{a}:LATEST")
It worked fine with cxf version 2.3.1. With cxf 2.3.2 the regexp generated is /([^/]+?)%3A([^/]+?)%3ALATEST(/.*)? and URITemplate fails to map to the correct service.
Clients have already been developed, are in production , and basically cannot be modified.
Is there anything I can do on the server to handle incoming requests such as /groupId:artifactId:LATEST as before ? Not sure how to do this.
> 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
[jira] Commented: (CXF-3226) Going to a JAX-RS resource that
contains a space in the path returns a 404 response code
Posted by "Jason Downey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977116#action_12977116 ]
Jason Downey commented on CXF-3226:
-----------------------------------
If you want to match @Path("the%20%space"), per RFC3986, the client should already have encoded this parameter as "the%2520%25space" and then the JAX-RS runtime should appropriately find the resource.
Looking @ the JAX-RS 1.1 specification, @Path can contain spaces! If you look at page 14 (in section 3.4), there is this sample:
1 @Path("widget list/{id}")
2 @Path("widget%20list/{id}")
The specification states that these two lines are equivalent.
In my humble opinion (and I'll defer to you since you know the code way better than me), the key problem that needs to be addressed is that the base URL value needs to be calculated correctly. The fix doesn't necessarily have to be in AbstractServerController. You could subclass AbstractServerController and then provide your own implementation of getBaseURL to do the appropriate work. This ServerController would then only be used within CXFNonSpringJaxrsServlet.
On the JIRA question, yes, I think it's a valid JIRA issue but I'm welcome to discussing that :-)
> 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
> Fix For: 2.3.2
>
> 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.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CXF-3226) Going to a JAX-RS resource that contains
a space in the path returns a 404 response code
Posted by "Jason Downey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jason Downey updated CXF-3226:
------------------------------
Attachment: patch.diff
Potential patch for issue. Only affects AbstractServerController.java.
> 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
> Fix For: 2.3.2
>
> 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 circumstances it it actually still decoded.
> Relevant sample code + patch attached.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-3226) Going to a JAX-RS resource that
contains a space in the path returns a 404 response code
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12978508#action_12978508 ]
Sergey Beryozkin commented on CXF-3226:
---------------------------------------
Jason, I agree that @Path("widget list/{id}") should be matched against request URIs containing
widget%20list segments.
The fix will have to be different though, literal values in "widget list/{id}" have to be encoded, with existing '%'s if any skipped, as per the @Path javadocs...I'll look into it
Thanks, Sergey
> 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
> Fix For: 2.3.2
>
> 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.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-3226) Going to a JAX-RS resource that
contains a space in the path returns a 404 response code
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ 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
[jira] Updated: (CXF-3226) Going to a JAX-RS resource that contains
a space in the path returns a 404 response code
Posted by "Jason Downey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jason Downey updated CXF-3226:
------------------------------
Attachment: cxf_jax_rs_space_bug.zip
File Description
================
Space - Contains valid JAX-RS resource
Application - JAX-RS application
JettyServer - Launches Jetty hosting a CXFNonSpringJaxrsServlet servlet to demo bug
Example URLs
============
http://localhost:1334/?_wadl - generates WADL for Space resource
http://localhost:1334/nospace - returns a text/plain document
http://localhost:1334/has%20space - returns a blank text/xml document with a 404 response code
> 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
> Fix For: 2.3.2
>
> Attachments: cxf_jax_rs_space_bug.zip
>
>
> 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 circumstances it it actually still decoded.
> Relevant sample code + patch attached.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-3226) Going to a JAX-RS resource that
contains a space in the path returns a 404 response code
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995972#comment-12995972 ]
Sergey Beryozkin commented on CXF-3226:
---------------------------------------
The fix has been applied, will be in 2.3.3 very soon.
Another approach, instead of adding an interceptor as a workaround, is to add another method to the server code, with explicit %3A in the path, as some legacy web clients will actually URLEncode the path fragment and the JAX-RS spec does not provide for something like @Path("/a:b") match both /a:b and /a%3Ab
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
[jira] Commented: (CXF-3226) Going to a JAX-RS resource that
contains a space in the path returns a 404 response code
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12976859#action_12976859 ]
Sergey Beryozkin commented on CXF-3226:
---------------------------------------
Hi
But what happens if you have "the%20%space" Path value or similar ? If we decode at the servlet level then we won't be able to match "the%20%space" ?
Can JAX-RS Path can not contain WSPaces in the actual literal name ? Do you think this is still a valid JIRA ?
thanks, Sergey
> 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
> Fix For: 2.3.2
>
> 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.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (CXF-3226) Going to a JAX-RS resource that
contains a space in the path returns a 404 response code
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Beryozkin resolved CXF-3226.
-----------------------------------
Resolution: Fixed
Fix Version/s: 2.4
Assignee: Sergey Beryozkin
> 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.
-
You can reply to this email to add a comment to the issue online.