JWSAdHocServletpublic class JWSAdHocServlet extends HttpServlet Ad hoc servlet registered to receive requests for the user-specified (or
defaulted) context-root.
The user can (but is not required to) specify a context root in the runtime
deployment descriptor for the app client. That context root - of, if omitted,
a default value computed by the app server - is registered dynamically so
requests to that context root are routed to an instance of this servlet. In
turn, this servlet forwards such requests to the system web application that
actually processes all Java Web Start requests for app clients. |
Fields Summary |
---|
public static final String | CONTEXT_ROOT_PARAMETER_NAMEservlet init parameter name for specifying the context root value | public static final String | CATEGORY_PARAMETER_NAMEservlet init parameter name for specifying the category value (appclient or application) | private ServletContext | jwsAppContextthe context for the system web app that handles all Java Web Start requests | private RequestDispatcher | systemWebAppDispatchera dispatcher used in forwarding requests to the system web app | private String | targetContextRootthe actual context root, obtained from the init parameter, to which reqs should be dispatched | private String | categorythe category from the init parameter |
Constructors Summary |
---|
public JWSAdHocServlet()Creates a new instance of JWSAdHocServlet
|
Methods Summary |
---|
private javax.servlet.ServletContext | getJWSAppContext()Returns the context for the Java Web Start app client system web app.
if (jwsAppContext == null) {
String uri = NamingConventions.webAppURI();
jwsAppContext = getServletContext().getContext(uri);
}
return jwsAppContext;
| private javax.servlet.RequestDispatcher | getJWSRequestDispatcher()Returns the dispatcher to the system web app.
if (systemWebAppDispatcher == null) {
String uri = NamingConventions.webAppURI();
WebPath webPath = new WebPath(uri);
ServletContext sc = getServletContext().getContext(webPath.contextRoot());
String servletContextName = sc.getServletContextName();
systemWebAppDispatcher = sc.getRequestDispatcher(webPath.path() + "/" + category + targetContextRoot);
}
return systemWebAppDispatcher;
| public void | init()Init method responsible for retrieiving init params.
ServletConfig config = getServletConfig();
targetContextRoot = config.getInitParameter(CONTEXT_ROOT_PARAMETER_NAME);
category = config.getInitParameter(CATEGORY_PARAMETER_NAME);
| protected void | service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Responds to any method.
/*
*Use the context for the Java Web Start system web app and forward this request
*to that app.
*/
JWSAdHocServletRequestWrapper wrappedRequest = new JWSAdHocServletRequestWrapper(request, targetContextRoot, category);
try {
getJWSRequestDispatcher().forward(wrappedRequest, response);
} catch (Throwable thr) {
throw new ServletException("Error dispatching request to Java Web Start app client application", thr);
}
|
|