Class ResourceServlet

All Implemented Interfaces:, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ResourceServlet
extends HttpServletBean

Simple servlet that can expose an internal resource, including a default URL if the specified resource is not found. An alternative, for example, to trying and catching exceptions when using JSP include. A typical usage would map all URLs with a .res extension onto an instance of this servlet, and use the JSP include action to include with the resource parameter (specificed in a jsp:param sub-action) indicating the actual path in the WAR.
The defaultUrl bean property must be set to the internal path of the default (placeholder) URL.

Rod Johnson
See Also:
Serialized Form

Field Summary
static java.lang.String PATH_PARAM
          Name of the parameter that must contain the actual path.
Fields inherited from class com.interface21.web.servlet.HttpServletBean
Constructor Summary
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
 java.lang.String getDefaultUrl()
          Gets the defaultUrl.
 void setDefaultUrl(java.lang.String defaultUrl)
          Sets the defaultUrl.
Methods inherited from class com.interface21.web.servlet.HttpServletBean
addRequiredProperty, getIdentifier, init, initServletBean
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final java.lang.String PATH_PARAM
Name of the parameter that must contain the actual path.
Constructor Detail


public ResourceServlet()
Method Detail


public java.lang.String getDefaultUrl()
Gets the defaultUrl.
Returns a String


public void setDefaultUrl(java.lang.String defaultUrl)
Sets the defaultUrl.
defaultUrl - The defaultUrl to set


protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
doGet in class javax.servlet.http.HttpServlet
See Also:
HttpServlet.doGet(HttpServletRequest, HttpServletResponse)

Rod Johnson and Spring contributors 2001-2003.