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

Tadayoshi Sato edited comment on CXF-7043 at 9/7/16 9:54 AM:
-------------------------------------------------------------

Thanks for your attention. The most important part of the fix is 
{{Servlet3ContinuationProvider.java}}:
https://github.com/apache/cxf/pull/164/files#diff-22d4bcdff04c6a1309f35f0bddf45cd8

The reason behind this is some frameworks like Apache Camel still depend on the 
CXF Continuations API and I'd like to see them work as expected as-is unless 
the Continuations API is deprecated and we need to migrate to Servlet3 or Jetty 
continuations ASAP. AFAIU the CXF Continuations API is just a convenient 
wrapper for the Servlet 3 Async API, so I'd like to see it continues to work as 
expected.

Thank you!


was (Author: tadayosi):
Thanks for your attention. The most important part of the fix is 
{{Servlet3ContinuationProvider.java}}:
https://github.com/apache/cxf/pull/164/files#diff-22d4bcdff04c6a1309f35f0bddf45cd8

The reason behind this is some frameworks like Apache Camel still depends on 
the CXF Continuations API and I'd like to see them work as expected as-is 
unless the Continuations API is deprecated and we need to migrate to Servlet3 
or Jetty continuations ASAP. AFAIU the CXF Continuations API is just a 
convenient wrapper for the Servlet 3 Async API, so I'd like to see it continues 
to work as expected.

Thank you!

> JAX-RS endpoints cannot handle encoded URL when used with continuation and 
> servlet transport
> --------------------------------------------------------------------------------------------
>
>                 Key: CXF-7043
>                 URL: https://issues.apache.org/jira/browse/CXF-7043
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS, Transports
>    Affects Versions: 3.1.7
>            Reporter: Tadayoshi Sato
>         Attachments: cxf-rest-async.zip
>
>
> Suppose a JAX-RS endpoint like below uses CXF Continuations API to handle 
> requests asynchronously:
> {code:java}
> @Path("/greeting")
> public class GreetingService {
>     @GET @Path("/hello/{name}")
>     public String hello(@PathParam("name") String name) {
> {code}
> When this endpoint is invoked with an URL containing encoded characters (e.g. 
> {{"%20"}}):
> {code}
> http://localhost:9000/greeting/hello/A%20B%20C
> {code}
> it fails to handle it and throws the following exception:
> {code}
> java.lang.IllegalArgumentException: Illegal character in path at index 38: 
> http://localhost:9000/greeting/hello/A B C
>       at java.net.URI.create(URI.java:852)
>       at 
> org.apache.cxf.transport.servlet.BaseUrlHelper.getBaseURL(BaseUrlHelper.java:48)
>       at 
> org.apache.cxf.transport.servlet.ServletController.getBaseURL(ServletController.java:74)
>       at 
> org.apache.cxf.transport.servlet.ServletController.updateDestination(ServletController.java:83)
>       at 
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:207)
>       at 
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
>       at 
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)
>       at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:299)
>       at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:223)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
>       at 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:274)
>       at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:517)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
>       at org.eclipse.jetty.server.Server.handleAsync(Server.java:549)
>       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:318)
>       at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:262)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
>       at java.lang.Thread.run(Thread.java:745)
> Caused by: java.net.URISyntaxException: Illegal character in path at index 
> 38: http://localhost:9000/greeting/hello/A B C
>       at java.net.URI$Parser.fail(URI.java:2848)
>       at java.net.URI$Parser.checkChars(URI.java:3021)
>       at java.net.URI$Parser.parseHierarchical(URI.java:3105)
>       at java.net.URI$Parser.parse(URI.java:3053)
>       at java.net.URI.<init>(URI.java:588)
>       at java.net.URI.create(URI.java:850)
>       ... 21 more
> {code}
> Note this issue happens only when the endpoint is used with Servlet 
> Transport. It doesn't happen when it's used with Jetty HTTP Transport.



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

Reply via email to