Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Trailing slash added after entry point path leads to 404 not found
Trailing slash added after entry point path leads to 404 not found [message #1615057] Fri, 13 February 2015 17:28 Go to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
Hello,
I think there is a regression probably introduced since 2.3.
Adding a tranling slash to entrypoint path leads to 404 not found.

For example in demo http://rap.eclipsesource.com/demo/release/workbench/app works
but http://rap.eclipsesource.com/demo/release/workbench/app/ return 404

This issue has been introduced in RWTServlet in handleRequest :

Quote:
} else if( "/".equals( request.getPathInfo() ) && "".equals( request.getServletPath() ) ) {
// /context/: root servlet, in this case path info "/" is ok
handleValidRequest( request, response );
} else {
response.sendError( SC_NOT_FOUND );
}


with trailing slash, request.getPathInfo is "/" but request.getServletPath is not "" but "/app"

before 2.3 it used to work because RWTServlet code was different
we went through handleInvalidRequets

Quote:
if( "/".equals( request.getPathInfo() ) ) {
// In case of "http://example.com/webapp/servlet/" redirect to
// "http://example.com/webapp/servlet" (same URL without trailing slash)
String redirectUrl = createRedirectUrl( request );
response.sendRedirect( response.encodeRedirectURL( redirectUrl ) );
}


so as request.getPathInfo is "/" request were redirected to http://rap.eclipsesource.com/demo/release/workbench/app

What do you think ?

Best
Arnaud

[Updated on: Fri, 13 February 2015 17:31]

Report message to a moderator

Re: Trailing slash added after entry point path leads to 404 not found [message #1615100 is a reply to message #1615057] Fri, 13 February 2015 18:09 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
I don't think that this is a regression/problem. In RAP 2.3 we
introduced a possibility to register entry point at root path. If your
servlet is registered at "/app", http://host:port/app will be valid,
http://host:port/app/ will lead to 404 as it is consider as context path
"app" and servlet registered at root path "/".
Best,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Trailing slash added after entry point path leads to 404 not found [message #1615981 is a reply to message #1615100] Sat, 14 February 2015 08:15 Go to previous messageGo to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
Let me clarify why I think there is a regression

requesting http://rap.eclipsesource.com/demo/release/workbench/app/
We are in workbench, in osgi so we goes through org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(HttpServletRequest, HttpServletResponse)
Quote:
// perfect match
if (processAlias(req, resp, alias, null))
return;

String extensionAlias = findExtensionAlias(alias);
alias = alias.substring(0, alias.lastIndexOf('/'));

// longest path match
while (alias.length() != 0) {
if (processAlias(req, resp, alias, extensionAlias))
return;
alias = alias.substring(0, alias.lastIndexOf('/'));
}


In both case (RAP 2.2, and 2.3) if there is a servlet in / path of app context equinox ProxyServlet will find it and redirect to it directly (in code next to "perfect math" comment).
If there is no servlet registered here, ProxyServlet will not find anything so we go through code next to "longest path match" where ProxyServlet remove the trailing slash
In Both case (RAP 2.2 and 2.3) ProxyServlet goes through RWTServlet because it finds the entry point registered to /app path. My guess was, as the request goes througs entry point registered to /app, RWTServlet should process the request and service the entry point defined for /app.
In RAP 2.2 it is like it works because of a side effect (RWTServlet redirects /app/ to /app but it has already been reach by /app, so it should been able to serve it directly). In RAP 2.3 it does not work anymore because RWTServlet responds with a 404 but as RWTServlet has been reached for the /app entry point, it should also be able to serve it.

I have not investigated more but I guess the behavior is a bit different between regular RWT web application and while RWTServlet behavior works and has not changed, it is not the same for RAP osgi applications and this regression only concerned this case.
Of course I still can register a RedirectServlet in / of path context, but I would have to do it for RAP every entry point I declare in the application.

At least if breaking this behavior is something expected, the documentation should warn users about it, because it is not uncommon to think http://rap.eclipsesource.com/demo/release/workbench/app/ will serve http://rap.eclipsesource.com/demo/release/workbench/app if there is nothing registered in http://rap.eclipsesource.com/demo/release/workbench/app/ (confirmed by the fact that Equinox ProxyServlet has been coded with this kind of logic), and as it uses to work before.

Best
Arnaud

[Updated on: Sat, 14 February 2015 08:42]

Report message to a moderator

Re: Trailing slash added after entry point path leads to 404 not found [message #1616074 is a reply to message #1615981] Sat, 14 February 2015 09:45 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Arnaud,
we have a similar bug opened, but I think it describes a different
redirect scenario:
429443: Requests to Root Path Entry Point are not redirected correctly
in WAR deployment
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429443
Best,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Trailing slash added after entry point path leads to 404 not found [message #1619142 is a reply to message #1616074] Mon, 16 February 2015 11:12 Go to previous messageGo to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
It seems to be related but not really the same issue. The issue I describe here is not related to servletbridge and behavior is the same with or without it. It is more an issue related to using osgi vs using regular rwt webapp.

Here I think it is an issue that RWTServlet return 404 not found when request.getServletPath() return a valid path where an entrypoint has been registered.
Re: Trailing slash added after entry point path leads to 404 not found [message #1619191 is a reply to message #1619142] Mon, 16 February 2015 11:50 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Arnaud,
please open a bugzilla and we will consider if this is a bug or not.
Best,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Trailing slash added after entry point path leads to 404 not found [message #1619329 is a reply to message #1619191] Mon, 16 February 2015 13:58 Go to previous message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=460016

Thanks,
Arnaud
Previous Topic:EMF RAP editor fails to start; bundle resolution failure
Next Topic:Scrollbars issue
Goto Forum:
  


Current Time: Tue Mar 19 05:56:19 GMT 2024

Powered by FUDForum. Page generated in 0.02326 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top