com.arsdigita.web
Class ApplicationFileServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.arsdigita.web.BaseServlet
              extended bycom.arsdigita.web.BaseApplicationServlet
                  extended bycom.arsdigita.web.ApplicationFileServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ApplicationFileServlet
extends BaseApplicationServlet

A simple servlet for dispatching abstract URLs to concrete JSP files.

This is intended to be used in all places where BebopMapServlet would have traditionally been used, since it allows projects to override the JSP at a particular location & add additional JSPs at new URLs without Java code changes.

The application should set its web.xml to contain

 <web-app>
   <servlet>
     <servlet-name>files</servlet-name>
     <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>
     <init-param>
       <param-name>template-path</param-name>
       <param-value>/templates/ccm-mywebapp</param-value>
     </init-param>
   </servlet>
 
   <servlet-mapping>
     <servlet-name>files</servlet-name>
     <url-pattern>/files/*</url-pattern>
   </servlet-mapping>
 </web-app>
 

In the Application class it should define:

  public String getContextPath() {
     return "ccm-mywebapp";
  }
 
  public String getServletPath() {
    return "/files";
  }
 

It can then put JSP files in a 'templates/ccm-mywebapp' directory at the root of its private webapp. Files in this directory can be scoped by application URL stub, so a link to

 /ccm/myparentapp/myappinstance/foo.jsp
 

gets resolved to

 /templaates/myparentapp/myappinstance/foo.jsp
 /templates/myparentapp/foo.jsp
 /templates/foo.jsp
 

until one matches.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.arsdigita.web.BaseApplicationServlet
APPLICATION_ID_ATTRIBUTE, APPLICATION_ID_PARAMETER, versionId
 
Fields inherited from class com.arsdigita.web.BaseServlet
REQUEST_URL_ATTRIBUTE
 
Constructor Summary
ApplicationFileServlet()
           
 
Method Summary
protected  void doService(javax.servlet.http.HttpServletRequest sreq, javax.servlet.http.HttpServletResponse sresp, Application app)
          The method that BaseApplicationServlet.doService(HttpServletRequest,HttpServletResponse) calls.
 void init(javax.servlet.ServletConfig config)
           
 
Methods inherited from class com.arsdigita.web.BaseApplicationServlet
doService
 
Methods inherited from class com.arsdigita.web.BaseServlet
destroy, doDestroy, doGet, doInit, doPost, getUserContext
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
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
 

Constructor Detail

ApplicationFileServlet

public ApplicationFileServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class BaseServlet
Throws:
javax.servlet.ServletException

doService

protected void doService(javax.servlet.http.HttpServletRequest sreq,
                         javax.servlet.http.HttpServletResponse sresp,
                         Application app)
                  throws javax.servlet.ServletException,
                         IOException
Description copied from class: BaseApplicationServlet

The method that BaseApplicationServlet.doService(HttpServletRequest,HttpServletResponse) calls. Servlet authors should implement this method to perform application-specific request handling.

Specified by:
doService in class BaseApplicationServlet
Throws:
javax.servlet.ServletException
IOException
See Also:
HttpServlet.service(HttpServletRequest,HttpServletResponse)


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC