cxf-issues mailing list archives

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

     [ https://issues.apache.org/jira/browse/CXF-5575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

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: https://issues.apache.org/jira/browse/CXF-5575
>             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, test-project.zip
>
>
> 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(AbstractHTTPServlet.java:364)
~[cxf-rt-transports-http-3.0.0-SNAPSHOT.jar:3.0.0.SNAPSHOT]
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:274)
~[cxf-rt-transports-http-3.0.0-SNAPSHOT.jar:3.0.0.SNAPSHOT]
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:211)
~[cxf-rt-transports-http-3.0.0-SNAPSHOT.jar:3.0.0.SNAPSHOT]
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) ~[javax.servlet-api-3.1.0.jar:3.1.0]
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
~[cxf-rt-transports-http-3.0.0-SNAPSHOT.jar:3.0.0.SNAPSHOT]
> 	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:717) ~[jetty-servlet-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1644)
~[jetty-servlet-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at ch.qos.logback.classic.selector.servlet.LoggerContextFilter.doFilter(LoggerContextFilter.java:70)
~[logback-classic-1.1.1.jar:na]
> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1615)
~[jetty-servlet-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550) [jetty-servlet-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:568) [jetty-security-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
[jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1112)
[jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:479) [jetty-servlet-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
[jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1046)
[jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.Server.handle(Server.java:459) [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:281) [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:232) [jetty-server-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.io.AbstractConnection$1.run(AbstractConnection.java:505) [jetty-io-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
[jetty-util-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536) [jetty-util-9.1.2.v20140210.jar:9.1.2.v20140210]
> 	at java.lang.Thread.run(Thread.java:744) [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>javax.ws.rs.Application</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
(v6.1.5#6160)

Mime
View raw message