|
PAJES 2.3.9 | |||||||||
| 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
org.pajes.servlet.PajeServlet
Base class for all servlets that utilise the PAJES servlet framework, to provide automatic decoding of encrypted query string parameters, and transparent handling of multi-part requests (file uploads).
This class does NOT authenticate access to resources. If
authentication is required, sub-class AuthenticatedPajeServlet
instead, or use the authentication services of the servlet container.
As with "standard" servlets, sub-classes should implement the doGet or doPost method.
| Constructor Summary | |
PajeServlet()
|
|
| Method Summary | |
Paje |
createPaje(javax.servlet.http.HttpServletRequest request)
Creates a Paje from the PajeFactory
associated with this servlet. |
Paje |
createPaje(java.lang.String[] keys,
java.lang.String[] arguments,
javax.servlet.http.HttpServletRequest request)
Creates a Paje from the PajeFactory
associated with this servlet. |
Paje |
createPaje(java.lang.String key,
java.lang.String[] arguments,
javax.servlet.http.HttpServletRequest request)
Creates a Paje from the PajeFactory
associated with this servlet. |
protected void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Provides an automatic redirect to the doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) method. |
protected void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Provides an automatic redirect to the doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) method. |
static java.lang.String |
getAbsoluteHREF(javax.servlet.http.HttpServletRequest request,
java.lang.String relativeHREF)
Returns a concatenated string of the following values: getBaseHREF(javax.servlet.http.HttpServletRequest)
the relativeHREF parameter
If the relativeHREF parameter startes with a '/', it will
be removed before being concatenated to the base URL. |
static java.lang.String |
getBaseHREF(javax.servlet.http.HttpServletRequest request)
Returns a concatenated string of the following request values: getScheme() "://" getServerName() ":" getServerPort() getContextPath() '/' |
int |
getMaxFileUploadSize()
Returns the maximum number of bytes that can be uploaded to this servlet. |
PajeFactory |
getPajeFactory()
Returns the PajeFactory that will be used by this servlet to generate Paje instances. |
java.net.URL |
getResource(java.lang.String resource,
javax.servlet.http.HttpServletRequest request)
Convenience method to return a URL to a localized resource. |
UploadedFile |
getUploadedFile(javax.servlet.http.HttpServletRequest request,
java.lang.String sourceFileName)
Convenience method to return the specified uploaded file instance. |
java.util.Enumeration |
getUploadedFileNames(javax.servlet.http.HttpServletRequest request)
Convenience method to return an Enumeration of
String objects containing the names of the files uploaded
in this request. |
protected void |
handleException(java.lang.Throwable throwable,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Deprecated. Removed in Release 2.1.0 - no longer called and no replacement. |
void |
init(javax.servlet.ServletConfig config)
Called by the servlet container to indicate to a servlet that the servlet is being placed into service. |
void |
log(java.lang.String msg)
Writes the specified message to a servlet log file, prepended by the servlet's name. |
void |
log(java.lang.String message,
java.lang.Throwable t)
Writes an explanatory message and a stack trace for a given Throwable exception to the servlet log file, prepended by
the servlet's name. |
protected void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Over-rides the HttpServlet service method to provide access
to PAJES facilities. |
static void |
setInputFieldsFromRequestAttributes(javax.servlet.http.HttpServletRequest request,
Container container,
java.lang.String prefix)
Convenience method to assign request attribute values to Input fields where the name attribute of the Input field matches the name of the request attribute. |
static void |
setInputFieldsFromRequestParameters(javax.servlet.http.HttpServletRequest request,
Container container)
Convenience method to assign request parameter values to Input fields where the name attribute of the Input field matches the name of the request parameter. |
void |
setMaxFileUploadSize(int bytes)
Sets the maximum number of bytes that can be uploaded to this servlet. |
protected void |
setPajeFactory(PajeFactory factory)
Sets the PajeFactory that will be used by this servlet to generate Paje instances. |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service |
| Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PajeServlet()
| Method Detail |
public static java.lang.String getAbsoluteHREF(javax.servlet.http.HttpServletRequest request,
java.lang.String relativeHREF)
getBaseHREF(javax.servlet.http.HttpServletRequest)
relativeHREF parameter
relativeHREF parameter startes with a '/', it will
be removed before being concatenated to the base URL.
request - the object that contains the request the client made of
the servlet.relativeHREF - the realtive address of the URL,
String specifying the absolute URL of a resource
in the context.public static java.lang.String getBaseHREF(javax.servlet.http.HttpServletRequest request)
request - the object that contains the request the client made of
the servlet.
String specifying the base portion of the request
URL that indicates the scheme, server, port and context of the
request.
public static void setInputFieldsFromRequestAttributes(javax.servlet.http.HttpServletRequest request,
Container container,
java.lang.String prefix)
request - the object that contains the request the client made of
the servlet.container - the Container sub-class which contains the Input
fields. It is most efficient to pass in the lowest level
container possible (i.e. the Form instance) rather than the Paje
instance.prefix - the String prefix assigned to attribute
names.
public static void setInputFieldsFromRequestParameters(javax.servlet.http.HttpServletRequest request,
Container container)
request - the object that contains the request the client made of
the servlet.container - the Container sub-class which contains the Input
fields. It is most effecient to pass in the lowest level
container possible (i.e. the Form instance) rather than the Paje
instance.public void setMaxFileUploadSize(int bytes)
The default value is determined from the web application deployment
descriptor. To set the default value, create a
<context-param> with a
<param-name> of
org.pajes.servlet.Browser.maxFileUploadSize , and a
<param-value> containing the maximum number of
bytes. For example:
<context-param>
<param-name>org.pajes.servlet.Browser.maxFileUploadSize</param-name>
<param-value>1048510</param-value>
</context-param>
If the <context-param> does not exist, or the
<param-value> does not contain a valid number, the
default value of 1048510 will be used.
bytes - the maximum number of bytes that can be uploaded.public int getMaxFileUploadSize()
setMaxFileUploadSize(int)public PajeFactory getPajeFactory()
Paje instances.
Pajes.setPajeFactory(org.pajes.html.PajeFactory)
public java.net.URL getResource(java.lang.String resource,
javax.servlet.http.HttpServletRequest request)
throws java.net.MalformedURLException
Processing takes the following steps:
[file name]_language_country_variant.[file type]
If such a resource exists, return the URL and stop further processing.
[file name]_language_country.[file type]
If such a resource exists, return the URL and stop further processing.
[file name]_language.[file type]
If such a resource exists, return the URL and stop further processing.
[file name].[file type]
If such a resource exists, return the URL and stop further processing.
null.
Note that if internationalisation is turned off, this method will not
attempt to locate a localised resource.
resource - a String identifying the resource.request - the request object from which the list of preferred
locales is determined.
null if there is no resource at that path
java.net.MalformedURLException - if a malformed URL is encountered
public UploadedFile getUploadedFile(javax.servlet.http.HttpServletRequest request,
java.lang.String sourceFileName)
request - the object that contains the request the client made of
the servlet.sourceFileName - the file name of the uploaded file to be
retrieved.
getUploadedFileNames(javax.servlet.http.HttpServletRequest)public java.util.Enumeration getUploadedFileNames(javax.servlet.http.HttpServletRequest request)
Enumeration of
String objects containing the names of the files uploaded
in this request. If the request has no uploaded files, returns an empty
Enumeration .
request - the object that contains the request the client made of
the servlet.
Enumeration of String objects, each
String containing the source file name of an
uploaded file; or an empty Enumeration if the
request has no uploaded files.getUploadedFile(javax.servlet.http.HttpServletRequest, java.lang.String)
public Paje createPaje(javax.servlet.http.HttpServletRequest request)
throws java.lang.IllegalStateException,
java.io.IOException
Paje from the PajeFactory
associated with this servlet.
request - the request object from which the preferred locales will
be obtained.
java.lang.IllegalStateException - if the PajeFactory
has not been defined.
java.io.IOException - if an IO exception occurs.setPajeFactory(org.pajes.html.PajeFactory),
PajeFactory.create(javax.servlet.http.HttpServletRequest)
public Paje createPaje(java.lang.String key,
java.lang.String[] arguments,
javax.servlet.http.HttpServletRequest request)
throws java.lang.IllegalStateException,
java.io.IOException
Paje from the PajeFactory
associated with this servlet.
key - the key which will uniquely identify this source file.arguments - the array of arguments that will be substituted into
the resource path pattern to give a path to an alternate source
file.request - the request object from which the preferred locales will
be obtained.
java.lang.IllegalStateException - if the PajeFactory
has not been defined.
java.io.IOException - if an IO exception occurs.setPajeFactory(org.pajes.html.PajeFactory),
PajeFactory.create(java.lang.String, java.lang.String[],
javax.servlet.http.HttpServletRequest)
public Paje createPaje(java.lang.String[] keys,
java.lang.String[] arguments,
javax.servlet.http.HttpServletRequest request)
throws java.lang.IllegalStateException,
java.io.IOException
Paje from the PajeFactory
associated with this servlet.
keys - the array of keys which will identify the sequence in which
the source file resources will be searched in order to locate
the most appropriate match.arguments - the array of arguments that will be substituted into
the resource path pattern to give a path to an alternate source
file.request - the request object from which the preferred locales will
be obtained.
java.lang.IllegalStateException - if the PajeFactory
has not been defined.
java.io.IOException - if an IO exception occurs.setPajeFactory(org.pajes.html.PajeFactory),
PajeFactory.create(java.lang.String[], java.lang.String[],
javax.servlet.http.HttpServletRequest)
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
This implementation stores the ServletConfig object it receives from the
servlet container for later use. When overriding this form of the
method, call super.init(config).
config - the ServletConfig object that contains
configutation information for this servlet
javax.servlet.ServletException - if an exception occurs that interrupts the
servlet's normal operationpublic void log(java.lang.String msg)
msg - a String specifying the message to be written to
the log file
public void log(java.lang.String message,
java.lang.Throwable t)
Throwable exception to the servlet log file, prepended by
the servlet's name.
message - a String that describes the error or
exceptiont - the java.lang.Throwable error or exceptionprotected void setPajeFactory(PajeFactory factory)
Paje instances.
factory - the factory that will be used by this servlet to generate
Pajes.createPaje(javax.servlet.http.HttpServletRequest),
createPaje(java.lang.String, java.lang.String[],
javax.servlet.http.HttpServletRequest),
createPaje(java.lang.String[], java.lang.String[],
javax.servlet.http.HttpServletRequest)
protected void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) method.
request - the request object.response - the response object.
javax.servlet.ServletException - if the request could not be handled.
java.io.IOException - if an input or output error is detected when the
servlet handles the request.
protected void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) method.
request - the request object.response - the response object.
javax.servlet.ServletException - if the request could not be handled.
java.io.IOException - if an input or output error is detected when the
servlet handles the request.
protected void handleException(java.lang.Throwable throwable,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
throwable - the throwable instance caught by the service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
method.request - the object that contains the request the client made of
the servlet.response - the object that contains the response the servlet
returns to the client.
java.io.IOException - if an input or output error is detected when the
servlet handles the request.
javax.servlet.ServletException - if the request could not be handled.
protected void service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
HttpServlet service method to provide access
to PAJES facilities.
request - the object that contains the request the client made of
the servlet.response - the object that contains the response the servlet
returns to the client.
java.io.IOException - if an input or output error is detected when the
servlet handles the request.
javax.servlet.ServletException - if the request could not be handled.
|
PAJES 2.3.9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||