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

Sergey Beryozkin commented on CXF-6853:
---------------------------------------

Hi Jim, 
Let me clarify. 
As far as matching a request URI against a JAX-RS resource endpoint is 
concerned, the request URI must be encoded, and I'm talking here about the 
request URI part that follows WAR context and servlet path. See Path.value docs.

ApplicationPath is not meant to be part of it. CXFNonSpringJaxrsServlet used to 
add it by default to the endpoint path but it was pointed out by 
integrators/users (TomEE user recently) it was not spec compliant. As I 
commented here, CXFNonSpringJaxrsServlet, does not do it any longer by default. 
It just happens that in the test I did yesterday it does add ApplicationPath to 
the endpoint path (when creating JAXRSServerFactoryBean). 

'!' can be encoded and can be not, and as far as the path matching is 
concerned, if the service wants to support both options, it should an option to 
accept both encoded and non-encoded '!'. 

But the bottom line, ApplicationPath is not part of request URI which follows 
web app context + servlet path because as we already know it must be kept 
encoded.

See here:
https://github.com/apache/cxf/blob/master/rt/rs/http-sci/src/main/java/org/apache/cxf/jaxrs/servlet/sci/JaxrsServletContainerInitializer.java#L74

This is what ApplicationPath is really for, it is part of the servlet URL 
pattern. CXF itself does not manage it.

That is why I'm not really sure how it can be fixed. I asked you - how do you 
have this Application loaded ?






> Support encoded value in @ApplicationPath
> -----------------------------------------
>
>                 Key: CXF-6853
>                 URL: https://issues.apache.org/jira/browse/CXF-6853
>             Project: CXF
>          Issue Type: Task
>          Components: JAX-RS
>    Affects Versions: 3.1.6, 3.0.9
>            Reporter: Jim Ma
>            Assignee: Sergey Beryozkin
>             Fix For: 3.0.10, 3.1.7, 3.2.0
>
>
> If @ApplicationPath value is  an encoded value, if client send request to 
> http://localhost:8080/Application!/myresource and get 404 .
> @ApplicationPath("ApplicationPath%21")
> public class MyApp extends Application {
>   public java.util.Set<java.lang.Class<?>> getClasses() {
>         Set<Class<?>> resources = new HashSet<Class<?>>();
>         resources.add(MyResource.class);
>         return resources;
>     }   
> }
>     



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to