I've some web page deployed at some server say:
http://myhost/some_secured_file.html
when I access this file within a browser it returns 401 asking me to authorize myself.
The problem is that I am trying to include this page inside some JSP page using the c:import tag.
The app server returns :
javax.servlet.jsp.JspException: Problem accessing the absolute URL "http://myhost/some_secured_file.html". java
.io.IOException: Server returned HTTP response code: 401 for URL: http://myhost/some_secured_file.html
How I can accomplish the include!?
Consider proxying the request through another jsp page or servlet. Then you let the proxy perform an authenticating request, e.g., using Apache HTTPClient, and have the contents of that response written to the page. Then you can simply import the url of your proxy on your jsp page.
Alright, consider the following pseudo code as clarification:
What this servlet does is fetch the secured page for you. You need to hook this servlet up in your web descriptor. This is necessary to map e.g.,
/proxy.jsp
request to it. What you then can do in your jsp page is something like<c:import value="proxy.jsp"/>
.