|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nu.staldal.lsp.servlet.LSPManager
public class LSPManager
Handle execution of LSP pages in a Servlet environment.
This class is thread-safe.
There is one instance of LSPManager per ServletContext
,
use getInstance(ServletContext)
or getInstance(ServletContext, ClassLoader)
to obtain it.
Field Summary | |
---|---|
static java.lang.String |
LOCALE_KEY
Use this key to store a user's locale in HttpSession.setAttribute(java.lang.String, java.lang.Object)
to override the default use of ServletRequest.getLocales() . |
Method Summary | |
---|---|
void |
executePage(LSPPage thePage,
java.util.Map<java.lang.String,java.lang.Object> lspParams,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Executes an LSP page and write the result to a HttpServletResponse . |
void |
executePage(LSPPage thePage,
java.util.Map<java.lang.String,java.lang.Object> lspParams,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
Deprecated. use executePage(LSPPage,Map,HttpServletRequest,HttpServletResponse) instead |
void |
executePage(LSPPage thePage,
java.util.Map<java.lang.String,java.lang.Object> lspParams,
java.lang.String stylesheetName,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Executes an LSP page and transform the the result with an XSLT stylesheet. |
void |
executePage(LSPPage thePage,
java.util.Map<java.lang.String,java.lang.Object> lspParams,
java.lang.String stylesheetName,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
Deprecated. use executePage(LSPPage,Map,String,HttpServletRequest,HttpServletResponse) instead |
java.lang.ClassLoader |
getClassLoader()
Get the ClassLoader used to load LSP pages and
associated resources. |
static LSPManager |
getInstance(javax.servlet.ServletContext context)
Obtain the the LSPManager instance for the given ServletContext . |
static LSPManager |
getInstance(javax.servlet.ServletContext context,
java.lang.ClassLoader servletClassLoader)
Obtain the the LSPManager instance for the given ServletContext . |
java.lang.String |
getLocalizedString(javax.servlet.http.HttpServletRequest request,
java.lang.String key)
Get a localized resource for the user's locale. |
java.lang.String |
getLocalizedString(javax.servlet.http.HttpServletRequest request,
java.lang.String pageName,
java.lang.String key)
Get a localized resource for the user's locale. |
LSPHelper |
getLSPHelper()
Obtain the underlaying LSPHelper . |
LSPPage |
getPage(java.lang.String pageName)
Get the LSPPage instance for a given page name. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String pageName)
Get a RequestDispatcher for a given page name. |
java.util.Locale |
getUserLocale(javax.servlet.http.HttpServletRequest request)
Get the user's locale. |
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 LOCALE_KEY
HttpSession.setAttribute(java.lang.String, java.lang.Object)
to override the default use of ServletRequest.getLocales()
.
The value stored for this key must be of type Locale
.
Method Detail |
---|
public static LSPManager getInstance(javax.servlet.ServletContext context)
ServletContext
. Creates a new instance
if nessecary.
context
- the ServletContext
ServletContext
public static LSPManager getInstance(javax.servlet.ServletContext context, java.lang.ClassLoader servletClassLoader)
ServletContext
. Creates a new instance
if nessecary.
context
- the ServletContext
servletClassLoader
- the ClassLoader
used to load LSP pages, use
getClass().getClassLoader()
on the Servlet.
ServletContext
public LSPHelper getLSPHelper()
LSPHelper
.
LSPHelper
public LSPPage getPage(java.lang.String pageName)
LSPPage
instance for a given page name.
pageName
- the name of the LSP page
null
if the given page name is not found@Deprecated public void executePage(LSPPage thePage, java.util.Map<java.lang.String,java.lang.Object> lspParams, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws org.xml.sax.SAXException, java.io.IOException
executePage(LSPPage,Map,HttpServletRequest,HttpServletResponse)
instead
HttpServletResponse
. Uses any stylesheet
specified in the LSP page.
thePage
- the LSP pagelspParams
- parameters to the LSP pagerequest
- the HttpServletRequest
response
- the HttpServletResponse
org.xml.sax.SAXException
- if any error occurs while executing the page
java.io.IOException
- if any I/O error occurs while executing the pagepublic void executePage(LSPPage thePage, java.util.Map<java.lang.String,java.lang.Object> lspParams, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws org.xml.sax.SAXException, java.io.IOException
HttpServletResponse
. Uses any stylesheet
specified in the LSP page.
thePage
- the LSP pagelspParams
- parameters to the LSP pagerequest
- the HttpServletRequest
response
- the HttpServletResponse
org.xml.sax.SAXException
- if any error occurs while executing the page
java.io.IOException
- if any I/O error occurs while executing the page@Deprecated public void executePage(LSPPage thePage, java.util.Map<java.lang.String,java.lang.Object> lspParams, java.lang.String stylesheetName, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws org.xml.sax.SAXException, java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerConfigurationException
executePage(LSPPage,Map,String,HttpServletRequest,HttpServletResponse)
instead
The output properties specified in the stylesheet will be used, and those specified in the LSP page will be ignored. Make sure to specify the output method in the stylesheet using <xsl:output>.
thePage
- the LSP pagelspParams
- parameters to the LSP pagestylesheetName
- the XSLT stylesheetrequest
- the HttpServletRequest
response
- the HttpServletResponse
org.xml.sax.SAXException
- if any error occurs while executing the page
java.io.FileNotFoundException
- if the stylesheet cannot be found
java.io.IOException
- if any I/O error occurs while executing the page
javax.xml.transform.TransformerConfigurationException
- if the stylesheet cannot be compiledpublic void executePage(LSPPage thePage, java.util.Map<java.lang.String,java.lang.Object> lspParams, java.lang.String stylesheetName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws org.xml.sax.SAXException, java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerConfigurationException
The output properties specified in the stylesheet will be used, and those specified in the LSP page will be ignored. Make sure to specify the output method in the stylesheet using <xsl:output>.
thePage
- the LSP pagelspParams
- parameters to the LSP pagestylesheetName
- the XSLT stylesheetrequest
- the HttpServletRequest
response
- the HttpServletResponse
org.xml.sax.SAXException
- if any error occurs while executing the page
java.io.FileNotFoundException
- if the stylesheet cannot be found
java.io.IOException
- if any I/O error occurs while executing the page
javax.xml.transform.TransformerConfigurationException
- if the stylesheet cannot be compiledpublic javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String pageName)
RequestDispatcher
for a given page name.
The attributes in the ServletRequest
object
will be used as parameters to the LSP page.
pageName
- the name of the LSP page
null
if the LSP page cannot be foundpublic java.lang.ClassLoader getClassLoader()
ClassLoader
used to load LSP pages and
associated resources.
ClassLoader
used to load LSP pages and
associated resources.public java.lang.String getLocalizedString(javax.servlet.http.HttpServletRequest request, java.lang.String key) throws java.lang.Exception
getLocalizedString(request, null, key)
request
- the HttpServletRequest
to determine the user's localekey
- the key
null
if not found.
java.lang.Exception
- if the LocaleBundleFactory
throws any exceptionpublic java.util.Locale getUserLocale(javax.servlet.http.HttpServletRequest request)
This method is used by the LSP ExtLib date and time formatting functions.
request
- the HttpServletRequest
to determine the user's locale
null
public java.lang.String getLocalizedString(javax.servlet.http.HttpServletRequest request, java.lang.String pageName, java.lang.String key) throws java.lang.Exception
This method is used by the LSP ExtLib lang
element and function.
request
- the HttpServletRequest
to determine the user's localepageName
- LSP page name,
or null
for global resources onlykey
- the key
null
if not found.
java.lang.Exception
- if the LocaleBundleFactory
throws any exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |