Class ResourceServlet

  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.springframework.web.servlet.HttpServletBean
              extended byorg.springframework.web.servlet.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 instanceof 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 RESOURCE_PARAM
          Name of the parameter that must contain the actual resource path.
Fields inherited from class org.springframework.web.servlet.HttpServletBean
Constructor Summary
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
 java.lang.String getDefaultUrl()
 void setDefaultUrl(java.lang.String defaultUrl)
Methods inherited from class org.springframework.web.servlet.HttpServletBean
init, initServletBean, setRequiredProperty
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 RESOURCE_PARAM
Name of the parameter that must contain the actual resource path.

See Also:
Constant Field Values
Constructor Detail


public ResourceServlet()
Method Detail


public void setDefaultUrl(java.lang.String defaultUrl)


public java.lang.String getDefaultUrl()


protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,

Copyright (C) 2003-2004 The Spring Framework Project.