com.interface21.web.servlet
Class ResourceServlet
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--com.interface21.web.servlet.HttpServletBean
|
+--com.interface21.web.servlet.ResourceServlet
- All Implemented Interfaces:
- java.io.Serializable, 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.
- Author:
- Rod Johnson
- See Also:
- Serialized Form
|
Field Summary |
static java.lang.String |
PATH_PARAM
Name of the parameter that must contain the actual path. |
|
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 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 |
PATH_PARAM
public static final java.lang.String PATH_PARAM
- Name of the parameter that must contain the actual path.
ResourceServlet
public ResourceServlet()
getDefaultUrl
public java.lang.String getDefaultUrl()
- Gets the defaultUrl.
- Returns:
- Returns a String
setDefaultUrl
public void setDefaultUrl(java.lang.String defaultUrl)
- Sets the defaultUrl.
- Parameters:
defaultUrl - The defaultUrl to set
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Overrides:
doGet in class javax.servlet.http.HttpServlet
- See Also:
HttpServlet.doGet(HttpServletRequest, HttpServletResponse)
Rod Johnson and Spring contributors 2001-2003.