|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.sun.webui.theme.ThemeServlet
public class ThemeServlet
ThemeServlet
is required by the com.sun.webui
components to resolve references to resources that exist in a jar.
This servlet implementation is needed because a JSF FacesServlet
cannot be extended and because a
javax.servlet.ServletContext.getResourceAsStream,
does not search for a resource within jars that are on the application's
class path.
Not all theme resources that are referenced by a component are located in jars. An application may override theme resources by defining those resources in the application via a theme resourece bundle.
Themes consist of both resources that are used directly
by the Java classes at runtime (for example property files) and
resources that are requested by the application users' browser
(for example image files). The ThemeServlet
class makes the
resources in the Theme jar available over HTTP. This requires that the
the classpath of this servlet be the same as the class path of the
application. The situation should not exist where a different jar
is used during the server side page assembly to acquire a theme
resource reference and then a different jar is used by this servlet
to obtain the actual bits of that resource when the page is rendering
in a browser.
How to configure the ThemeServlet
Define an entry for the servlet in the web application's configuration file (web.xml). Configure one instance of this servlet as follows:
<servlet> <servlet-name>ThemeServlet</servlet-name> <servlet-class>com.sun.webui.jsf.theme.ThemeServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ThemeServlet</servlet-name> <url-pattern>/theme/*</url-pattern> </servlet-mapping>
Note that the url-pattern
must be specifed in a slightly
different manner for the ThemeContext
context-param
com.sun.webui.theme.THEME_SERVLET_CONTEXT
<context-param> <param-name>com.sun.webui.theme.THEME_SERVLET_CONTEXT<param-name> <param-value>theme<param-value> <context-param>The actual value of the url-pattern is does not have to be
/theme/*
it just must be the same for the servlet-mapping
and the THEME_SERVLET_CONTEXT
context-param
.
ThemeContext
,
Theme
,
ThemeFactory
,
Serialized FormConstructor Summary | |
---|---|
ThemeServlet()
|
Method Summary | |
---|---|
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)
Initializes the ThemeServlet |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThemeServlet()
Method Detail |
---|
public java.lang.String getServletInfo()
getServletInfo
in interface javax.servlet.Servlet
getServletInfo
in class javax.servlet.GenericServlet
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
config
- The ServletConfig object
javax.servlet.ServletException
public long getLastModified(javax.servlet.http.HttpServletRequest request)
getLastModified
in class javax.servlet.http.HttpServlet
request
- The HttpServletRequest being processed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |