I propose the following changes to ServletInvokerPortlet to allow
servlet navigation.
* Servlet's portlet registry will point the top level servlet defined by
<parameter name="url" value="/toplevel-servlet" />
This servlet will construct the first page. This is what Jetspeed has
now. So I see no changes here.
* New servlets will be linked and run without registry entries with an
addition to the portal URI such as
"/jetspeed/portal/servlets/servletname"
* Any path right after the servlets command, "/servlets", will be given
to ServletInvokerPortlet as the new URI which must be mapped to a
servlet in web.xml. The servlets command is NOT a part of this mapping
or path. Any preceding "/servlet" or "/servlets" paths included in the
servlet mapping must be repeated here i.e.
/jetspeed/portal/servlets/servlet/myservlet
This assumes that the servlets command will not precede any other
portal parameter, i.e. /actions, /pane, /user, /group. This should work
for the servlet 'bar' as:
/jetspeed/portal/page/intro/pane0/Foo/servlets/bar
* If there is no servlets command in the URI, the servlet invoker will
attempt to dispatch the top-level servlet from the registry as
previously explained.
The new ServletInvokerPortlet changes are the following to provide all
of these proposals.
cvs diff ServletInvokerPortlet.java (in directory
C:\ozgur\jakarta-jetspeed\src\java\org\apache\jetspeed\portal\portlets\)
Index: ServletInvokerPortlet.java
===================================================================
RCS file:
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/por
tlets/ServletInvokerPortlet.java,v
retrieving revision 1.1
diff -r1.1 ServletInvokerPortlet.java
90c90,97
< servletURL = (String)
this.getPortletConfig().getInitParameter("url");
---
> String pathInfo = rundata.getRequest().getPathInfo();
> int pos;
> if(pathInfo != null &&
> (pos = pathInfo.indexOf("/servlets")) >=0 ) {
> servletURL = pathInfo.substring(pos +
"/servlets".length());
> }
> if(servletURL == null)
> servletURL = (String)
this.getPortletConfig().getInitParameter("url");
Finally, this is how a servlet would link to another:
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String path = request.getContextPath() +
request.getServletPath();
String nextServlet = "/snoop";
String newPath = path + "/servlets" + nextServlet;
out.println("<html><head><title>FormTest</title></head><body>");
if( request.getParameter("x_login") == null ) {
out.println("<form method=\"get\" action=\"" + newPath +
"\">");
out.println("<p>Username:<input type=\"text\"
name=\"x_username\" size=\"20\"><br>");
out.println("Password:<input type=\"password\"
name=\"x_password\" size=\"20\"><br>");
out.println("<input type=\"submit\" name=\"x_login\"
value=\"Login\"></p></form>");
}
out.println("</body></html>");
}
I hope this message hasn't become too long and messy. Any comments and
ideas? This also might be handled the way actions are handled, I guess.
Ozgur
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>