public interface ItsNatServlet
javax.servlet.Servlet
object.
Bridges the normal servlet infrastructure with ItsNat.
To bridge a standard Servlet with ItsNat call ItsNat.get().createItsNatServlet(this)
into the overloaded Servlet.init(ServletConfig)
method.
This call creates a new ItsNatServlet bound to the standard Servlet.
Use this init
method to setup the ItsNatServlet
(using ItsNatServletConfig
), to register page and fragment templates
(calling registerItsNatDocumentTemplate(String,String,Object)
and
registerItsNatDocFragmentTemplate(String,String,Object)
) and
to register ItsNat request listeners (ItsNatServletRequestListener
).
To redirect normal requests to ItsNat call the method
processRequest(javax.servlet.ServletRequest,javax.servlet.ServletResponse)
.
HttpServletWrapper
Modifier and Type | Method and Description |
---|---|
void |
addCreateItsNatComponentListener(CreateItsNatComponentListener listener)
Adds a new user defined component factory.
|
void |
addEventListener(org.w3c.dom.events.EventListener listener)
Adds a global event listener to this servlet.
|
void |
addItsNatAttachedClientEventListener(ItsNatAttachedClientEventListener listener)
Adds a remote control listener to this servlet.
|
void |
addItsNatServletRequestListener(ItsNatServletRequestListener listener)
Registers a new ItsNat request listener.
|
javax.servlet.ServletRequest |
createServletRequest(javax.servlet.ServletRequest request,
java.util.Map<java.lang.String,java.lang.String[]> params)
Creates a new request object wrapping the provided request object replacing
parameters with the provided collection.
|
ItsNat |
getItsNat()
Returns the ItsNat "root" object used to create this servlet.
|
ItsNatDocFragmentTemplate |
getItsNatDocFragmentTemplate(java.lang.String name)
Returns the document fragment template registered with the specified name.
|
ItsNatDocumentTemplate |
getItsNatDocumentTemplate(java.lang.String name)
Returns the document template registered with the specified name.
|
ItsNatServletConfig |
getItsNatServletConfig()
Returns the utility object used to setup the ItsNat servlet.
|
ItsNatServletContext |
getItsNatServletContext()
Returns the ItsNat application context this ItsNat servlet belongs to.
|
javax.servlet.Servlet |
getServlet()
Returns the wrapped
javax.servlet.Servlet object. |
void |
processRequest(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
Called to redirect a normal servlet request to the ItsNat servlet.
|
ItsNatDocFragmentTemplate |
registerItsNatDocFragmentTemplate(java.lang.String name,
java.lang.String mime,
java.lang.Object source)
Registers a markup source to be used as a document fragment template with the specified name and MIME type.
|
ItsNatDocumentTemplate |
registerItsNatDocumentTemplate(java.lang.String name,
java.lang.String mime,
java.lang.Object source)
Registers a markup source to be used as a document template with the specified name and MIME type.
|
ItsNatDocumentTemplate |
registerItsNatDocumentTemplateAttachedServer(java.lang.String name,
java.lang.String mime)
Registers an attached server template with the specified name and MIME type.
|
void |
removeCreateItsNatComponentListener(CreateItsNatComponentListener listener)
Removes the specified user defined component factory.
|
void |
removeEventListener(org.w3c.dom.events.EventListener listener)
Removes the specified global event listener.
|
void |
removeItsNatAttachedClientEventListener(ItsNatAttachedClientEventListener listener)
Removes the specified remote control listener.
|
void |
removeItsNatServletRequestListener(ItsNatServletRequestListener listener)
Unregisters the specified request listener.
|
javax.servlet.Servlet getServlet()
javax.servlet.Servlet
object.ItsNat getItsNat()
ItsNat.createItsNatServlet(javax.servlet.Servlet)
ItsNatServletConfig getItsNatServletConfig()
ItsNatServletContext getItsNatServletContext()
ItsNatDocumentTemplate registerItsNatDocumentTemplate(java.lang.String name, java.lang.String mime, java.lang.Object source)
The specified MIME type may be different to the "intrinsic" MIME of the specified file. For instance the loaded file may be XHTML (MIME application/xhtml+xml) but it can be registered with HTML MIME (text/html) to achieve the maximum compatibility.
A markup template is a normal (X)HTML, SVG, XUL or XML local or remote file.
Markup source can be a file path, a remote URL (specified as a String) or a TemplateSource
object.
name
- the name used to identify the template.mime
- the MIME type.source
- the markup source.registerItsNatDocFragmentTemplate(String,String,Object)
,
getItsNatDocumentTemplate(String)
ItsNatDocumentTemplate registerItsNatDocumentTemplateAttachedServer(java.lang.String name, java.lang.String mime)
An attached server template does not need a template file because the client page is sent to the server as the initial template.
name
- the name used to identify the template.mime
- the MIME type.registerItsNatDocumentTemplate(String,String,Object)
ItsNatDocumentTemplate getItsNatDocumentTemplate(java.lang.String name)
name
- the name used to look for.ItsNatDocFragmentTemplate registerItsNatDocFragmentTemplate(java.lang.String name, java.lang.String mime, java.lang.Object source)
The specified MIME type may be different to the "intrinsic" MIME of the specified file. For instance the loaded file may be XHTML (application/xhtml+xml) but it can be registered as HTML (text/html) to achieve the maximum compatibility.
Because the main purpose of document fragments is to be included into documents, you should be use the same HTML (text/html) or XHTML (application/xhtml+xml) MIME as the document target.
A markup template fragment is a normal (X)HTML, SVG, XUL or XML local or remote file. The fragment part is:
ItsNatHTMLDocFragmentTemplate
method.
Markup source can be a file path, a remote URL (specified as a String) or a TemplateSource
object.
name
- the name used to identify the template.mime
- the MIME type.source
- the markup source.registerItsNatDocumentTemplate(String,String,Object)
,
getItsNatDocFragmentTemplate(String)
ItsNatDocFragmentTemplate getItsNatDocFragmentTemplate(java.lang.String name)
name
- the name used to look for.void addItsNatServletRequestListener(ItsNatServletRequestListener listener)
If an ItsNatDocument is involved, this listener is called before listeners registered in the template. Typical use is for logging, preprocessing, filtering etc.
listener
- the listener to register.removeItsNatServletRequestListener(ItsNatServletRequestListener)
,
ItsNatDocumentTemplate.addItsNatServletRequestListener(ItsNatServletRequestListener)
,
processRequest(javax.servlet.ServletRequest,javax.servlet.ServletResponse)
void removeItsNatServletRequestListener(ItsNatServletRequestListener listener)
listener
- the request listener to remove.addItsNatServletRequestListener(ItsNatServletRequestListener)
void addItsNatAttachedClientEventListener(ItsNatAttachedClientEventListener listener)
The listener is called before calling the template and document listener counterparts (if defined).
listener
- the listener to add.removeItsNatAttachedClientEventListener(ItsNatAttachedClientEventListener)
,
ItsNatDocumentTemplate.addItsNatAttachedClientEventListener(ItsNatAttachedClientEventListener)
,
ItsNatDocument.addItsNatAttachedClientEventListener(ItsNatAttachedClientEventListener)
void removeItsNatAttachedClientEventListener(ItsNatAttachedClientEventListener listener)
listener
- the listener to remove.addItsNatAttachedClientEventListener(ItsNatAttachedClientEventListener)
void addEventListener(org.w3c.dom.events.EventListener listener)
The listener is called before calling any DOM event listener registered in templates and documents. This listener registry is passive, in no way the client is modified (no listener is registered on the client) and usually used for monitoring.
listener
- the listener to add.removeEventListener(EventListener)
,
ItsNatDocumentTemplate.addEventListener(EventListener)
,
ItsNatDocument.addEventListener(EventListener)
void removeEventListener(org.w3c.dom.events.EventListener listener)
listener
- the listener to remove.addEventListener(EventListener)
void addCreateItsNatComponentListener(CreateItsNatComponentListener listener)
The listener is called before calling the template listener counterparts (if defined).
listener
- the listener factory to register.removeCreateItsNatComponentListener(CreateItsNatComponentListener)
,
ItsNatDocumentTemplate.addCreateItsNatComponentListener(CreateItsNatComponentListener)
void removeCreateItsNatComponentListener(CreateItsNatComponentListener listener)
listener
- the listener factory to remove.addCreateItsNatComponentListener(CreateItsNatComponentListener)
void processRequest(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
ItsNat requests are processed by the registered ItsNatServletRequestListener
objects.
request
- the standard servlet request.response
- the standard servlet response.javax.servlet.ServletRequest createServletRequest(javax.servlet.ServletRequest request, java.util.Map<java.lang.String,java.lang.String[]> params)
This method can be used to avoid the problem of read-only parameters
of the standard ServletRequest
object.
With exception of methods returning parameters, every method call is forwarded to
the wrapped ServletRequest
object.
In a HTTP environment (the request object to wrap implements HttpServletRequest
),
the resulting object implements HttpServletRequest
.
request
- the servlet request object to wrap.params
- a collection with the new parameters.Copyright © 2007 Innowhere Software Services S.L. All Rights Reserved.