In the past we've used a SSO solution for authentication. A servlet filter is checking for login etc. For cost reduction we want to replace it with a simple authentication against our database.
The plan here is to use the old login/password change jsp's (which were located on the sso server) and call it directly in our application in that way (if the filter is detecting a not logged in user):
req.getRequestDispatcher("/auth/login.jsp").include(req, response);
The page gets displayed, but only the text. Images and Stylesheet are not beeing displayed. (Can not be found).
<img src="/auth/platform.jpg" alt="platform" class="left" />
I've tried several other ways like, but all of these versions, didn't work. I know, a relativ path isn't working!
<img src="auth/platform.jpg" />
<img src=".auth/platform.jpg" />
<img src="<%=request.getContextPath()%>/auth/platform.jpg" />
I've output the following, everything is empty.
ServletPath: <%request.getServletPath(); %> <br />
ServletContext: <%request.getServletContext();%> <br />
ContextPath: <%request.getContextPath(); %> <br />
LocalAddr: <%request.getLocalAddr(); %> <br />
PathInfo: <%request.getPathInfo(); %> <br />
RemoteAddr: <%request.getRemoteAddr(); %> <br />
RemoteHost: <%request.getRemoteHost(); %> <br />
In the original projects (projects where login page was located) the jsp only look like:
<img src="images/platform.jpg" />
And it works, also with relative referenced ...
The stylesheet could also not be found by referencing it in this way (or any other ways like above):
<link href="/auth/style.css" rel="stylesheet" type="text/css" />
But if I am using this way, it works!
<style>
<%@ include file="/auth/style.css"%>
</style>
This is my structure:
Do I need anything else in my web.xml e.g.?
I know, in nowadays JSF will be used, but this is an old project and should amended as few as possible.
This is the http error message:
ERROR] 500 - GET /auth/platform.jpg (127.0.0.1) 2720 bytes
Request headers
Host: localhost:8888
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost:8888/Application.html?gwt.codesvr=127.0.0.1:9997&groupId=xxx
Cookie: JSESSIONID=b56c92nn81g51d28ys2l65dg2
Connection: keep-alive
Response headers
Accept-Ranges: bytes
Content-Type: text/html
Content-Length: 2720
Last-Modified: Thu, 30 Apr 2015 11:43:38 GMT