public interface TemplateSource
When a document or fragment is going to be loaded based on the template which this
template source was registered, the first time the method
getInputStream(ItsNatServletRequest, ItsNatServletResponse)
is called,
the request and response parameters are the original request and response objects
of the document or fragment loading request.
If a document or fragment was already loaded, then any new load request
asks first if the template must be reloaded calling isMustReload(ItsNatServletRequest,ItsNatServletResponse)
if this method returns true the method getInputStream(ItsNatServletRequest, ItsNatServletResponse)
is called after, if false the previous loaded template is also used for this load request.
In a very special and highly improbable case the method isMustReload(ItsNatServletRequest,ItsNatServletResponse)
is called twice with the same request and response object, because this may happen
this function must be idempotent (same params same result).
This interface could be used to ever load a new template per document load request, by this way ItsNat could be used as a front end (proxy or filter) of any web application.
ItsNatServlet.registerItsNatDocumentTemplate(String,String,Object)
,
ItsNatServlet.registerItsNatDocFragmentTemplate(String,String,Object)
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getInputStream(ItsNatServletRequest request,
ItsNatServletResponse response)
Returns the input stream to read the markup going to be used as template to create documents
or fragments.
|
boolean |
isMustReload(ItsNatServletRequest request,
ItsNatServletResponse response)
Informs whether the current template should be discarded and a new one loaded.
|
boolean isMustReload(ItsNatServletRequest request, ItsNatServletResponse response)
If this method returns true the method getInputStream(ItsNatServletRequest, ItsNatServletResponse)
is called with the same request and response objects.
request
- the request object of the document/fragment loading web request.response
- the response object of the document/fragment loading web request.java.io.InputStream getInputStream(ItsNatServletRequest request, ItsNatServletResponse response)
request
- the request object of the document/fragment loading web request.response
- the response object of the document/fragment loading web request.isMustReload(ItsNatServletRequest,ItsNatServletResponse)
Copyright © 2007 Innowhere Software Services S.L. All Rights Reserved.