| java.lang.Object jwebapp.controller.ServerInterface
ServerInterface | public class ServerInterface (Code) | | Provides access to the jWebApp/servlet environment.
|
Inner Class :class UrlDataWrapper implements Map | |
Inner Class :public static class MultipartFormData | |
Method Summary | |
public void | addToRequestHistory() Add URI to the request history (stored in the users session). | public void | addToRequestHistory(int limit) Add URI to the request history (stored in the users session). | public void | addToRequestHistory(int limit, String uri) Add URI to the request history (stored in the users session). | public T | fillObjectFromRequest(T obj) Loads your object with request parameter data. | public T | fillObjectFromRequest(T obj, Set<String> ignoreValueNames, boolean setNulls) Loads your object with request parameter data. | public T | fillObjectFromRequest(T obj, boolean fillPublicSetMethods, boolean fillPublicFields, Set<String> ignoreValueNames, boolean setNulls) Loads your object with request parameter data. | public void | forwardRequest(String forwardUrl) Forward request to another URL within the same web application context. | public String | getAbsoluteUri(String path, boolean includeServletPath) | public String | getAbsoluteUri(String path) | public String | getAbsoluteUrl(String contextRelativePath) | public String | getAbsoluteUrl(String contextRelativePath, boolean rewrite) | public String | getAbsoluteUrl(String contextRelativePath, boolean includeServletPath, boolean rewrite) | public String | getAbsoluteUrl(String contextRelativePath, String protocol, boolean includeServletPath, boolean rewrite) | public Integer | getApplicationCode() Returns the set application code. | public String | getApplicationMessage() Returns the set application message. | public T | getAttribute(String itemName) Returns the request attribute associated with the given name. | public T | getAttribute(String itemName, T defaultValue) Returns the request attribute associated with the given name.
Parameters: itemName - the hash table key associated with the attribute Parameters: defaultValue - if the attribute does not exist, return the default value. | public Hashtable | getAttributeHash() Returns a hash table of all the request attributes. | String | getBuiltUri(UrlData urlData, boolean includeServletPath) | String | getBuiltUrl(UrlData urlData, boolean fullUrl, boolean includeServletPath, boolean rewrite) | DataManager | getDataManager() | public Integer | getErrorCode() Returns the set error code. | public String | getErrorMessage() Returns the set error message. | public Exception | getException() Returns the last exception set with setException(). | public static Logger | getLogger() Returns the logger. | public String | getMessage(String key) | public MultipartFormData | getMultipartFormData(String parameter) Returns an instance of MultipartFormData, which contains all the information
and abilities needed for dealing with multipart form data. | public Hashtable | getMultipartFormDataHashtable() Returns a Hashtable of MultipartFormData objects representing the form data
that are keyed by parameter Id. | public Vector | getMultipartFormDataVector() Returns a vector of MultipartFormData objects representing the form data. | public String | getMultipartFormParameter(String parameter) Returns returns the string data associated with the form data defined by parameter. | public String | getParameter(String parameter) Returns the request parameter associated with the given name. | public String | getParameter(String parameter, String defaultValue) Returns the request parameter associated with the given name. | public String | getParameter(String parameter, boolean emptyToNull) Returns the request parameter associated with the given name. | public String | getParameter(String parameter, String defaultValue, boolean emptyToNull) Returns the request parameter associated with the given name. | public Hashtable | getParameterHash() Returns a hash table of all the request parameters. | public Enumeration | getParameterNames() Returns the request parameter names. | public String[] | getParameterValues(String parameter) Returns the request parameter values associated with the given name. | public String | getRemoteUser() Returns the remote user Id. | public RemoteUser | getRemoteUserInformation() Returns an instance of RemoteUser, which contains information (user id, first name, last name, roles) about the remote user. | public DataManager.RequestData | getRequestData() Get the information associated with the current request. | public Vector | getRequestHistory() Returns a vector of the current users request history. | public String | getReturnedUrlKey() Returns the last URL data key returned by a method from RequestHandler. | public ServletContext | getServletContext() Return the servlets context. | public HttpServletRequest | getServletRequest() Return the servlet request. | public HttpServletResponse | getServletResponse() Return the servlet response. | public T | getSessionAttribute(String itemName) Returns a session attribute. | public T | getSessionAttribute(String itemName, T defaultValue) Returns a session attribute. | public String | getUrl(String key) | public String | getUrl(String key, boolean fullUrl, boolean rewrite) | UrlDataWrapper | getUrlDataWrapper() | public Validator | getValidator() Returns the validation handler. | public Integer | getWarningCode() Returns the set warning code. | public String | getWarningMessage() Returns the set warning message. | public boolean | hasPermission(Set<String> roles) Checks if the current user has permission. | public void | invalidateRemoteUser() Remove remote users information from the environment (logout). | public boolean | isMultipartFormData() | public boolean | isUserInRole(String role) Checks if the current user is in the given role. | public void | loadMultipartFormData() Loads the multipart form data. | public void | loadMultipartFormData(int sizeThreshold, File tempRepository) Loads the multipart form data and allows definition of file size threshold
and temp file repository for uploads. | public void | log(String message) Log a message via ServletContext.log(). | public void | log(String message, Throwable t) Log a message via ServletContext.log(). | public void | printAttributes(PrintStream out) Prints the request attributes to the given PrintStream. | public void | printParameters(PrintStream out) Prints the request parameters to the given PrintStream. | public void | redirectRequest(String redirectUrl) Redirect the request to another URL. | public void | reloadXMLConfigurationData() Reload the XML configuration file. | public void | removeAttribute(String itemName) Removes an attribute from the request. | public void | removeSessionAttribute(String itemName) Removes a session attribute. | String | resolveForwardReferences(UrlData urlData) | public void | setApplicationMessage(String applicationMessage) Set the application message. | public void | setApplicationMessage(int applicationCode, String applicationMessage) Set the application code and the application message. | public void | setApplicationMessage(int applicationCode, String applicationMessage, boolean overwrite) Set the application code and the application message. | public void | setAttribute(String itemName, Object item) Anything set with setAttribute() is available to page authors and is the best way to pass objects on to the view. | public void | setErrorMessage(String errorMessage) Set the error message. | public void | setErrorMessage(int errorCode, String errorMessage) Set the error code and the error message. | public void | setErrorMessage(int errorCode, String errorMessage, boolean overwrite) Set the error code and the error message. | public void | setException(Exception exception) Sets an exception and makes it available to the view via "jwaException". | public void | setRemoteUserInformation(String userId, String salutation, String firstName, String lastName, Set<String> roles) Set the remote users information. | void | setRequestData(DataManager.RequestData requestData) | void | setReturnedUrlKey(String urlDataKey) | public void | setSessionAttribute(String itemName, Object item) Sets a session attribute. | public void | setWarningMessage(String warningMessage) Set the warning message. | public void | setWarningMessage(int warningCode, String warningMessage) Set the warning code and the warning message. | public void | setWarningMessage(int warningCode, String warningMessage, boolean overwrite) Set the warning code and the warning message. | public boolean | validateParameters() Validates the request data with XML defined validations. |
AUTHENTICATION_ERROR | final public static int AUTHENTICATION_ERROR(Code) | | |
NOT_SECURE_ERROR | final public static int NOT_SECURE_ERROR(Code) | | |
UNDEFINED_ERROR | final public static int UNDEFINED_ERROR(Code) | | |
VALIDATION_ERROR | final public static int VALIDATION_ERROR(Code) | | |
addToRequestHistory | public void addToRequestHistory()(Code) | | Add URI to the request history (stored in the users session).
|
addToRequestHistory | public void addToRequestHistory(int limit)(Code) | | Add URI to the request history (stored in the users session).
Parameters: limit - the maximum number of URIs in the history vector |
addToRequestHistory | public void addToRequestHistory(int limit, String uri)(Code) | | Add URI to the request history (stored in the users session).
Parameters: limit - the maximum number of URIs in the history vector Parameters: uri - the URI being stored |
fillObjectFromRequest | public T fillObjectFromRequest(T obj) throws JWebAppException(Code) | | Loads your object with request parameter data. "obj" is an object of any type
containing set methods. Any set method matching the name of a parameter will
be set with the request parameter value.
Parameters: obj - an object with set methods object with set methods |
fillObjectFromRequest | public T fillObjectFromRequest(T obj, Set<String> ignoreValueNames, boolean setNulls) throws JWebAppException(Code) | | Loads your object with request parameter data. "obj" is an object of any type
containing set methods. Any set method matching the name of a parameter will
be set with the request parameter value.
Parameters: obj - an object with set methods Parameters: ignoreValueNames - ignore the value names in the set Parameters: setNulls - set or ignore null values object with set methods |
fillObjectFromRequest | public T fillObjectFromRequest(T obj, boolean fillPublicSetMethods, boolean fillPublicFields, Set<String> ignoreValueNames, boolean setNulls) throws JWebAppException(Code) | | Loads your object with request parameter data. "obj" is an object of any type
containing set methods. Any set method matching the name of a parameter will
be set with the request parameter value.
Parameters: obj - an object with set methods Parameters: fillPublicSetMethods - fill the public set methods Parameters: fillPublicFields - fill the public fields Parameters: ignoreValueNames - ignore the value names in the set Parameters: setNulls - set or ignore null values object with set methods |
forwardRequest | public void forwardRequest(String forwardUrl) throws JWebAppException(Code) | | Forward request to another URL within the same web application context. The calling RequestHandler method
must return "noForwarding", as forwarding/redirects can not be called twice. This method calls
ServletRequest.getRequestDispatcher().
Parameters: forwardUrl - the URL to forward to |
getAbsoluteUrl | public String getAbsoluteUrl(String contextRelativePath, boolean rewrite)(Code) | | |
getAbsoluteUrl | public String getAbsoluteUrl(String contextRelativePath, boolean includeServletPath, boolean rewrite)(Code) | | |
getAbsoluteUrl | public String getAbsoluteUrl(String contextRelativePath, String protocol, boolean includeServletPath, boolean rewrite)(Code) | | |
getApplicationCode | public Integer getApplicationCode()(Code) | | Returns the set application code.
the application code |
getApplicationMessage | public String getApplicationMessage()(Code) | | Returns the set application message.
the application message |
getAttribute | public T getAttribute(String itemName)(Code) | | Returns the request attribute associated with the given name.
Parameters: itemName - the hash table key associated with the attribute the attribute |
getAttribute | public T getAttribute(String itemName, T defaultValue)(Code) | | Returns the request attribute associated with the given name.
Parameters: itemName - the hash table key associated with the attribute Parameters: defaultValue - if the attribute does not exist, return the default value. the attribute |
getAttributeHash | public Hashtable getAttributeHash()(Code) | | Returns a hash table of all the request attributes.
an instance of Hashtable |
getErrorCode | public Integer getErrorCode()(Code) | | Returns the set error code.
the error code |
getErrorMessage | public String getErrorMessage()(Code) | | Returns the set error message.
the error message |
getException | public Exception getException()(Code) | | Returns the last exception set with setException().
the last exception set with setException(). |
getLogger | public static Logger getLogger()(Code) | | Returns the logger.
|
getMultipartFormData | public MultipartFormData getMultipartFormData(String parameter)(Code) | | Returns an instance of MultipartFormData, which contains all the information
and abilities needed for dealing with multipart form data.
Parameters: parameter - the parameter of interest an instance of MultipartFormData |
getMultipartFormDataHashtable | public Hashtable getMultipartFormDataHashtable()(Code) | | Returns a Hashtable of MultipartFormData objects representing the form data
that are keyed by parameter Id.
a Hashtable of MultipartFormData objects |
getMultipartFormDataVector | public Vector getMultipartFormDataVector()(Code) | | Returns a vector of MultipartFormData objects representing the form data.
a vector of MultipartFormData objects |
getMultipartFormParameter | public String getMultipartFormParameter(String parameter)(Code) | | Returns returns the string data associated with the form data defined by parameter.
Parameters: parameter - the parameter of interest a string containing the form data |
getParameter | public String getParameter(String parameter)(Code) | | Returns the request parameter associated with the given name.
Parameters: parameter - the hash table key associated with parameter the parameter |
getParameter | public String getParameter(String parameter, String defaultValue)(Code) | | Returns the request parameter associated with the given name.
Parameters: parameter - the hash table key associated with parameter Parameters: defaultValue - return the default value if the param is empty or null the parameter |
getParameter | public String getParameter(String parameter, boolean emptyToNull)(Code) | | Returns the request parameter associated with the given name.
Parameters: parameter - the hash table key associated with parameter Parameters: emptyToNull - return null instead of an empty value the parameter |
getParameter | public String getParameter(String parameter, String defaultValue, boolean emptyToNull)(Code) | | Returns the request parameter associated with the given name.
Parameters: parameter - the hash table key associated with parameter Parameters: defaultValue - return the default value if the param is empty or null Parameters: emptyToNull - return null instead of an empty value the parameter |
getParameterHash | public Hashtable getParameterHash()(Code) | | Returns a hash table of all the request parameters. If the parameter
has multiple values, then the hash entry will contain an array of the values.
an instance of Hashtable |
getParameterNames | public Enumeration getParameterNames()(Code) | | Returns the request parameter names.
an enumerated list of the parameter names |
getParameterValues | public String[] getParameterValues(String parameter)(Code) | | Returns the request parameter values associated with the given name.
Parameters: parameter - the hash table key associated with parameter the parameter values |
getRemoteUser | public String getRemoteUser()(Code) | | Returns the remote user Id.
the remote user Id |
getRemoteUserInformation | public RemoteUser getRemoteUserInformation()(Code) | | Returns an instance of RemoteUser, which contains information (user id, first name, last name, roles) about the remote user.
an instance of RemoteUser |
getRequestData | public DataManager.RequestData getRequestData()(Code) | | Get the information associated with the current request.
a RequestData instance |
getRequestHistory | public Vector getRequestHistory()(Code) | | Returns a vector of the current users request history. The vector contains
string objects representing the request URIs (plus their query strings) that
the user has visited during this session. This information
can be used in conjunction with ServerInterface.forwardRequest() to forward the user to the last/previous
relevant request after signing on.
returns a vector of string objects |
getReturnedUrlKey | public String getReturnedUrlKey()(Code) | | Returns the last URL data key returned by a method from RequestHandler.
last URL data key string |
getServletContext | public ServletContext getServletContext()(Code) | | Return the servlets context.
an instance of ServletContext |
getServletRequest | public HttpServletRequest getServletRequest()(Code) | | Return the servlet request.
an instance of HttpServletRequest |
getServletResponse | public HttpServletResponse getServletResponse()(Code) | | Return the servlet response.
an instance of HttpServletResponse |
getSessionAttribute | public T getSessionAttribute(String itemName)(Code) | | Returns a session attribute. This is the way to keep user oriented information between requests.
Parameters: itemName - the hash key associated with the stored object. the stored object |
getSessionAttribute | public T getSessionAttribute(String itemName, T defaultValue)(Code) | | Returns a session attribute. This is the way to keep user oriented information between requests.
Parameters: itemName - the hash key associated with the stored object. Parameters: defaultValue - if the attribute does not exist, return the default value. the stored object |
getUrlDataWrapper | UrlDataWrapper getUrlDataWrapper()(Code) | | |
getValidator | public Validator getValidator()(Code) | | Returns the validation handler.
the validation handler |
getWarningCode | public Integer getWarningCode()(Code) | | Returns the set warning code.
the warning code |
getWarningMessage | public String getWarningMessage()(Code) | | Returns the set warning message.
the warning message |
hasPermission | public boolean hasPermission(Set<String> roles)(Code) | | Checks if the current user has permission.
Parameters: roles - the the current user belongs to true if the user has permission, false otherwise |
invalidateRemoteUser | public void invalidateRemoteUser()(Code) | | Remove remote users information from the environment (logout).
|
isMultipartFormData | public boolean isMultipartFormData()(Code) | | |
isUserInRole | public boolean isUserInRole(String role)(Code) | | Checks if the current user is in the given role.
Parameters: role - checks if the user is in the role true if the user is in the role, false otherwise |
loadMultipartFormData | public void loadMultipartFormData()(Code) | | Loads the multipart form data. Uses the defaults of 102400 for file
threshold and "/WEB-INF/secure_uploads" for the file directory.
|
loadMultipartFormData | public void loadMultipartFormData(int sizeThreshold, File tempRepository)(Code) | | Loads the multipart form data and allows definition of file size threshold
and temp file repository for uploads. The file size threshold defines whether uploaded files will
be stored in memory (equal or less than threshold) or on disk (greater than threshold).
Parameters: sizeThreshold - the size value at which files will be written to disk Parameters: tempRepository - the file directory to write the files to |
log | public void log(String message)(Code) | | Log a message via ServletContext.log().
Parameters: message - to log |
log | public void log(String message, Throwable t)(Code) | | Log a message via ServletContext.log().
Parameters: message - to log Parameters: t - instance to log |
printAttributes | public void printAttributes(PrintStream out)(Code) | | Prints the request attributes to the given PrintStream.
Parameters: out - the PrintStream object to print to |
printParameters | public void printParameters(PrintStream out)(Code) | | Prints the request parameters to the given PrintStream.
Parameters: out - the PrintStream object to print to |
redirectRequest | public void redirectRequest(String redirectUrl) throws JWebAppException(Code) | | Redirect the request to another URL. This URL can be anywhere inside or outside the web application context.
The calling RequestHandler method must return "noForwarding", as forwarding/redirects can not be called twice. This
method calls ServletResponse.sendRedirect().
Parameters: redirectUrl - the URL to forward to |
reloadXMLConfigurationData | public void reloadXMLConfigurationData() throws JWebAppException(Code) | | Reload the XML configuration file.
|
removeAttribute | public void removeAttribute(String itemName)(Code) | | Removes an attribute from the request.
Parameters: itemName - the attribute name/key |
removeSessionAttribute | public void removeSessionAttribute(String itemName)(Code) | | Removes a session attribute.
Parameters: itemName - the hash key associated with the stored object. |
setApplicationMessage | public void setApplicationMessage(String applicationMessage)(Code) | | Set the application message. This is the method for passing application related information back to the user.
Parameters: applicationMessage - the application message |
setApplicationMessage | public void setApplicationMessage(int applicationCode, String applicationMessage)(Code) | | Set the application code and the application message. This is the method for passing application related information back to the user.
Parameters: applicationCode - the application code Parameters: applicationMessage - the application message |
setApplicationMessage | public void setApplicationMessage(int applicationCode, String applicationMessage, boolean overwrite)(Code) | | Set the application code and the application message. This is the method for passing application related information back to the user.
Parameters: applicationCode - the application code Parameters: applicationMessage - the application message Parameters: overwrite - Overwrite the current message |
setAttribute | public void setAttribute(String itemName, Object item)(Code) | | Anything set with setAttribute() is available to page authors and is the best way to pass objects on to the view.
Parameters: itemName - the attribute name/key Parameters: item - is the Object to be stored in the request for later access during request processing |
setErrorMessage | public void setErrorMessage(String errorMessage)(Code) | | Set the error message. This is the method for passing error information back to the user.
Parameters: errorMessage - the error message |
setErrorMessage | public void setErrorMessage(int errorCode, String errorMessage)(Code) | | Set the error code and the error message. This is the method for passing error information back to the user.
Parameters: errorCode - the error code Parameters: errorMessage - the error message |
setErrorMessage | public void setErrorMessage(int errorCode, String errorMessage, boolean overwrite)(Code) | | Set the error code and the error message. This is the method for passing error information back to the user.
Parameters: errorCode - the error code Parameters: errorMessage - the error message Parameters: overwrite - Overwrite the current message |
setException | public void setException(Exception exception)(Code) | | Sets an exception and makes it available to the view via "jwaException".
Parameters: exception - any valid instance of Exception or a subclass. |
setRemoteUserInformation | public void setRemoteUserInformation(String userId, String salutation, String firstName, String lastName, Set<String> roles)(Code) | | Set the remote users information.
Parameters: userId - the remote users Id Parameters: salutation - the remote users salutation (Mr., Miss., Mrs., ...), may be null Parameters: firstName - the remote users first name, may be null Parameters: lastName - the remote users last name, may be null Parameters: roles - the remote user belongs to |
setReturnedUrlKey | void setReturnedUrlKey(String urlDataKey)(Code) | | |
setSessionAttribute | public void setSessionAttribute(String itemName, Object item)(Code) | | Sets a session attribute. This is the way to keep user oriented information between requests.
Parameters: itemName - the hash key associated with the stored object. Parameters: item - the object to store |
setWarningMessage | public void setWarningMessage(String warningMessage)(Code) | | Set the warning message. This is the method for passing warning information back to the user.
Parameters: warningMessage - the warning message |
setWarningMessage | public void setWarningMessage(int warningCode, String warningMessage)(Code) | | Set the warning code and the warning message. This is the method for passing warning information back to the user.
Parameters: warningCode - the warning code Parameters: warningMessage - the warning message |
setWarningMessage | public void setWarningMessage(int warningCode, String warningMessage, boolean overwrite)(Code) | | Set the warning code and the warning message. This is the method for passing warning information back to the user.
Parameters: warningCode - the warning code Parameters: warningMessage - the warning message Parameters: overwrite - Overwrite the current message |
validateParameters | public boolean validateParameters()(Code) | | Validates the request data with XML defined validations.
true if the validation passes, false if it does not pass. |
|
|