com.sun.rave.web.ui.theme
Class ThemeServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.sun.rave.web.ui.theme.ThemeServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ThemeServlet
extends javax.servlet.http.HttpServlet

Use this servlet to retrieve resource file that control the client-side behaviour and appearance of a web application that uses the Sun Web.Components. The resource files must be in a Jar file that is in the application's classpath. Configure one instance of this servlet per web application using themed components:

     <servlet>
         <servlet-name>ThemeServlet</servlet-name>
         <servlet-class>com.sun.rave.web.ui.theme.ThemeServlet</servlet-class>
      </servlet>

     <servlet-mapping>
         <servlet-name>ThemeServlet</servlet-name>
         <url-pattern>/theme/*</url-pattern>
     </servlet-mapping>
   

For each theme used in an application, you must ensure that this servlet is mapped to the identifier specified in the "prefix" property of the META-INF/swc_theme.properties resource for that theme. For the standard themes, this is set to /theme so the mapping illustrated above is sufficient.

Note that, since the JAR files for all installed themes are loaded into the same class loader, the actual resource paths for the resources used by each theme MUST be unique. This is true regardless of whether the themes share a prefix or not.

See Also:
Serialized Form

Field Summary
static java.lang.String localeParameter
           
 
Constructor Summary
ThemeServlet()
           
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method handles the requests for the Theme files.
 long getLastModified(javax.servlet.http.HttpServletRequest request)
          Return the timestamp for when resources provided by this servlet were last modified.
 java.lang.String getServletInfo()
          Returns a short description of the servlet.
 void init(javax.servlet.ServletConfig config)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localeParameter

public static final java.lang.String localeParameter
See Also:
Constant Field Values
Constructor Detail

ThemeServlet

public ThemeServlet()
Method Detail

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException
This method handles the requests for the Theme files.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - The Servlet Request for the theme file
response - The Servlet Response
Throws:
javax.servlet.ServletException - If the Servlet fails to serve the resource file
java.io.IOException - If the Servlet cannot locate and read a requested ThemeFile

getServletInfo

public java.lang.String getServletInfo()
Returns a short description of the servlet.

Specified by:
getServletInfo in interface javax.servlet.Servlet
Overrides:
getServletInfo in class javax.servlet.GenericServlet
Returns:
A String that names the Servlet

init

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

getLastModified

public long getLastModified(javax.servlet.http.HttpServletRequest request)

Return the timestamp for when resources provided by this servlet were last modified. By default, this will be the timestamp when this servlet was first loaded at the deployment of the containing webapp, so that any changes in the resources will be automatically sent to the clients who might have cached earlier versions.

Overrides:
getLastModified in class javax.servlet.http.HttpServlet