cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aurius Bendikas (JIRA)" <>
Subject [jira] [Updated] (CXF-5575) Extra slash ('/') is prefixed to redirect URL in "redirects-list"
Date Wed, 26 Feb 2014 22:02:22 GMT


Aurius Bendikas updated CXF-5575:

    Attachment: pom.xml

We are getting a little bit sidetracked here. So I would like to bring us back to solving
the main issue:

The javadoc of on getServletPath() in javax.servlet.http.HttpServletRequestWrapper (actually
on javax.servlet.http.HttpServletRequest since "wraper" extends it) states: "a String containing
the name or path of the servlet being called, as specified in the request URL, decoded, or
an empty string if the servlet used to process the request is matched using the "/*" pattern."

In the example I have sent you the servlet is mapped to the "/*" patternd=, but the org.apache.cxf.transport.servlet.AbstractHTTPServlet.HttpServletRequestFilter
getServletPath() returns "/" instead of empty string.

So this problem is simply caused by not conforming to servelt API specification.

On the other hand I have attached the new pom.xml file witch maps the test-web-project to
context "/test-web-project". And after running "http://localhost:8080/test-web-project/services"
I have got this output:

Available RESTful services:
Endpoint address: http://localhost:8080/test-web-project/
WADL : http://localhost:8080/test-web-project/?_wadl

Therefore "http://localhost:8080/test-web-project/index.jsp" is still failing.

Also my original use-case is not about displaying welcome pages. I am developing a use case
where I have a rest service /host/{id) and if you query it with the browser it will return
html response, otherwise it will be JSON. I have encountered this problem while the CXF was
trying to redirect to .jsp file to render html output. Then I just tried to render jsp directly
and got the same problem. The simplification of this use-case is implemented in the test example.

There is also a chance that I am miss-configuring something since this is the first time I
use CXF :)

> Extra slash ('/') is prefixed to redirect URL in "redirects-list"
> -----------------------------------------------------------------
>                 Key: CXF-5575
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.0.0-milestone2
>         Environment: jetty 9.1.2
>            Reporter: Aurius Bendikas
>            Assignee: Sergey Beryozkin
>            Priority: Blocker
>             Fix For: 3.0.0, 2.7.11, 2.6.14
>         Attachments: InsertTitleHere.png, pom.xml,
> Using jetty 9.1.2 and latest CXF SNAPSHOT.
> Exception is thrown if trying to load i.e. "index.jsp":
> javax.servlet.ServletException: RequestDispatcher for path /index.jsp has failed
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.redirect(
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(
> 	at javax.servlet.http.HttpServlet.service( ~[javax.servlet-api-3.1.0.jar:3.1.0]
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(
> 	at org.eclipse.jetty.servlet.ServletHolder.handle( ~[jetty-servlet-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
> 	at ch.qos.logback.classic.selector.servlet.LoggerContextFilter.doFilter(
> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
> 	at org.eclipse.jetty.servlet.ServletHandler.doHandle( [jetty-servlet-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle( [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at [jetty-security-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.session.SessionHandler.doHandle(
> 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
> 	at org.eclipse.jetty.servlet.ServletHandler.doScope( [jetty-servlet-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.session.SessionHandler.doScope(
> 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle( [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle( [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.Server.handle( [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.HttpChannel.handle( [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.HttpConnection.onFillable( [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at$ [jetty-io-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool$ [jetty-util-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at [na:1.7.0_51]
> I have done some debugging and looks like CXF is adding extra '/' to the beginning of
redirect URL. That makes jetty jsp servlet return error that //index.jsp is not found.
> Servlet configuration:
> <servlet>
>     <servlet-name>CXFServlet</servlet-name>
>     <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
>     <init-param>
>         <param-name></param-name>
>         <param-value>net.aurius.guestlist.GuestListApplicationConfig</param-value>
>     </init-param>
>     <init-param>
>         <param-name>redirects-list</param-name>
>         <param-value>/(\w)+.jsp</param-value>
>     </init-param>
>     <init-param>
>         <param-name>redirect-servlet-name</param-name>
>         <param-value>jsp</param-value>
>     </init-param>
>     <init-param>
>         <param-name>redirect-attributes</param-name>
>         <param-value>javax.servlet.include.request_uri</param-value>
>     </init-param>
>     <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
>     <servlet-name>CXFServlet</servlet-name>
>     <url-pattern>/*</url-pattern>
> </servlet-mapping>

This message was sent by Atlassian JIRA

View raw message