Jetty failure accessing JSP [message #135101] |
Thu, 09 July 2009 06:34  |
Eclipse User |
|
|
|
Dear Sir,
I've succesfully run a bundle implementing a servlet that response to an
HttpServletRequest, using Equinox with Jetty in an Eclipse project.
My problem is that simply changing the response from my servelet, from:
"
resp.getWriter().println("<html><body>Hello from old-Servlet1 </body></html>");
"
to
"
resp.sendRedirect("index.jsp");
"
I get an error in the browser, like:
"
HTTP ERROR 404
Problem accessing /index.jsp. Reason:
ProxyServlet: /index.jsp
"
Where "index.jsp" is a very simple JSP that works OK on a different
configuration (i.e. Eclipse on Tomcat).
The problem seems related to the fact that the "index.jsp" is not
available in "some classpath" for the Jetty engine, but I have no idea
where this "classpath" information should be placed.
I've not found any structure like the "webapp" that I use for Tomcat, so I
have really no clue.
Can you give me some hint?
Thanks in advance.
Kind regards.
Maurizio
|
|
|
|
|
|
Re: Jetty failure accessing JSP [message #135237 is a reply to message #135197] |
Fri, 10 July 2009 03:55   |
Eclipse User |
|
|
|
Hi Simon,
Thanks for your reply.
I'm registering the JSPs in my plugin.xml using:
"
<extension
point="org.eclipse.equinox.http.registry.servlets">
<servlet
alias="/index.jsp"
class="org.eclipse.equinox.jsp.jasper.registry.JSPFactory" />
</extension>
"
For this I've also installed two bundles:
org.eclipse.equinox.jsp.jasper_1.0.100.v20080427-0830, and
org.eclipse.equinox.jsp.jasper.registry_1.0.0.v20080427-0830
I think that the above means that "I'm using the extension registry and
NOT the OSGi HttpService". I presume that this is OK, is it?
I'm NOT using org.eclipse.equinox.jsp.jasper.JspServlet.
My servlet is defined like:
"
...
public class Servlet1 extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
....
resp.sendRedirect("/index.jsp");
}
"
That's all I need to do.
What should I do for getting my "index.jsp" visible from that context?
Note also that I've checked via
"getServletContext().getResource("/index.jsp")" and
"getServletContext().getResourcePaths("/")", and both of them return valid
info. The seconds indicate:
"
[/bin/, /index.jsp, /.classpath, /WEB-INF/, /build.properties,
/.settings/, /plugin.xml, /.project, /src/, /hello.jsp, /META-INF/]
"
This looks like that my "index.jsp" is a valid resource for the context.
Is it?
Thanks in advance for your help.
Kind regards.
Maurizio
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08031 seconds