net.sf.jzeno.aop
Class ServletSupport

java.lang.Object
  extended by net.sf.jzeno.aop.ServletSupport

public class ServletSupport
extends java.lang.Object

This class allows you access to low level objects from the Servlet API. The methods in this class can be called from any part of your application code.


Field Summary
static java.lang.String APPLICATION_SESSION_ATTRIBUTES
           
static java.lang.String NAVIGATE
           
static java.lang.String PREFIX_NAVIGATION
           
 
Constructor Summary
ServletSupport()
           
 
Method Summary
static void addError(Component c, java.lang.String key)
           Adds an error to the top of the page.
static void addError(Component c, java.lang.String key, java.lang.Object[] args)
           Adds an error to the top of the page.
static void addError(java.lang.String key)
           Adds an error to the top of the page.
static void addError(java.lang.String key, java.lang.Object[] args)
           Adds an error to the top of the page.
static void addMessage(Component c, java.lang.String key)
           Adds a message to the top of the page.
static void addMessage(Component c, java.lang.String key, java.lang.Object[] args)
           Adds a message to the top of the page.
static void addMessage(java.lang.String key)
           Adds a message to the top of the page.
static void addMessage(java.lang.String key, java.lang.Object[] args)
           Adds a message to the top of the page.
static void addWarning(Component c, java.lang.String key)
           Adds a warning to the top of the page.
static void addWarning(Component c, java.lang.String key, java.lang.Object[] args)
           Adds a warning to the top of the page.
static void addWarning(java.lang.String key)
           Adds a warning to the top of the page.
static void addWarning(java.lang.String key, java.lang.Object[] args)
           Adds a warning to the top of the page.
static void clearErrorsAndMessages()
           Clear all pending errors and messages.
static Connection getConnection()
           
static java.lang.String getDirectRemoteHost()
           Retrieve the remote IP address.
static java.util.List getErrors()
           
static java.util.List getErrors(Component c)
           
static java.util.List getErrorsList()
           
static java.util.Map getErrorsMap()
           
static java.util.List getGlobalMessagesList()
           Gets a list of currently pending application messages.
static java.util.List getMessages()
           
static java.util.List getMessages(Component c)
           
static java.util.List getPreviousMessages()
          Retrieve the last displayed errors,messages and/or warnings.
static java.lang.String getRemoteHost()
           Retrieve the remote IP address.
static javax.servlet.http.HttpServletRequest getRequest()
           
static java.lang.Object getRequestAttribute(java.lang.String attribute)
           Gets a request attribute.
static java.lang.String getRequestHeader(java.lang.String name)
           Gets a request header, such as User-Agent to determine the browser type...
static java.lang.String getRequestParameter(java.lang.String parameter)
           Get a request parameters.
static java.lang.String[] getRequestParameterNames()
           Gets the list of request parameters.
static java.lang.String getRequestURI()
           Retrieves the request URI.
static javax.servlet.http.HttpServletResponse getResponse()
           
static javax.servlet.ServletConfig getServletConfig()
           
static javax.servlet.ServletContext getServletContext()
           
static javax.servlet.http.HttpSession getSession()
           
static java.lang.Object getSessionAttribute(java.lang.String attribute)
           Gets a session attribute.
static java.lang.String getSessionId()
           Gets the session id.
static java.util.List getWarnings()
           
static java.util.List getWarnings(Component c)
           
static java.util.Map getWarningsMap()
           
static void removeSessionAttribute(java.lang.String attribute)
           Removes a session attribute.
static void setContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
static void setContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, Connection conn)
           
static void setRequestAttribute(java.lang.String attribute, java.lang.Object value)
           Sets a request attribute.
static void setServletConfig(javax.servlet.ServletConfig config)
           
static void setServletContext(javax.servlet.ServletContext context)
           
static void setSessionAttribute(java.lang.String attribute, java.lang.Object value)
           Sets a session attribute.
static java.lang.String translate(java.lang.String key)
           
static java.lang.String translate(java.lang.String key, java.lang.Object[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAVIGATE

public static final java.lang.String NAVIGATE
See Also:
Constant Field Values

PREFIX_NAVIGATION

public static final java.lang.String PREFIX_NAVIGATION
See Also:
Constant Field Values

APPLICATION_SESSION_ATTRIBUTES

public static final java.lang.String APPLICATION_SESSION_ATTRIBUTES
See Also:
Constant Field Values
Constructor Detail

ServletSupport

public ServletSupport()
Method Detail

setContext

public static void setContext(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)

setContext

public static void setContext(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp,
                              Connection conn)

getRequest

public static javax.servlet.http.HttpServletRequest getRequest()

getResponse

public static javax.servlet.http.HttpServletResponse getResponse()

getSession

public static javax.servlet.http.HttpSession getSession()

getServletContext

public static javax.servlet.ServletContext getServletContext()

setServletContext

public static void setServletContext(javax.servlet.ServletContext context)

getServletConfig

public static javax.servlet.ServletConfig getServletConfig()

setServletConfig

public static void setServletConfig(javax.servlet.ServletConfig config)

getSessionAttribute

public static java.lang.Object getSessionAttribute(java.lang.String attribute)

Gets a session attribute.


setSessionAttribute

public static void setSessionAttribute(java.lang.String attribute,
                                       java.lang.Object value)

Sets a session attribute.


removeSessionAttribute

public static void removeSessionAttribute(java.lang.String attribute)

Removes a session attribute.


getRequestParameter

public static java.lang.String getRequestParameter(java.lang.String parameter)

Get a request parameters.


setRequestAttribute

public static void setRequestAttribute(java.lang.String attribute,
                                       java.lang.Object value)

Sets a request attribute.


getRequestAttribute

public static java.lang.Object getRequestAttribute(java.lang.String attribute)

Gets a request attribute.


getRequestURI

public static java.lang.String getRequestURI()

Retrieves the request URI.


getRequestHeader

public static java.lang.String getRequestHeader(java.lang.String name)

Gets a request header, such as User-Agent to determine the browser type...


getRemoteHost

public static java.lang.String getRemoteHost()

Retrieve the remote IP address. If forwarded by proxy return X-Forwarded-For


getDirectRemoteHost

public static java.lang.String getDirectRemoteHost()

Retrieve the remote IP address. It allways return the IP address on the other side of the request's TCP/IP connection !


getSessionId

public static java.lang.String getSessionId()

Gets the session id.


getGlobalMessagesList

public static java.util.List getGlobalMessagesList()

Gets a list of currently pending application messages.


getErrorsMap

public static java.util.Map getErrorsMap()

getWarningsMap

public static java.util.Map getWarningsMap()

getMessages

public static java.util.List getMessages(Component c)

getWarnings

public static java.util.List getWarnings(Component c)

getErrors

public static java.util.List getErrors(Component c)

getErrors

public static java.util.List getErrors()

getErrorsList

public static java.util.List getErrorsList()

getWarnings

public static java.util.List getWarnings()

getMessages

public static java.util.List getMessages()

clearErrorsAndMessages

public static void clearErrorsAndMessages()

Clear all pending errors and messages.


translate

public static java.lang.String translate(java.lang.String key)

translate

public static java.lang.String translate(java.lang.String key,
                                         java.lang.Object[] args)

addMessage

public static void addMessage(java.lang.String key)

Adds a message to the top of the page. You supply a resource key that is used to identify the real message (in i18n.properties).


addMessage

public static void addMessage(java.lang.String key,
                              java.lang.Object[] args)

Adds a message to the top of the page. You supply a resource key that is used to identify the real message (in i18n.properties).


addWarning

public static void addWarning(java.lang.String key)

Adds a warning to the top of the page. You supply a resource key that is used to identify the real warning (in i18n.properties).


addWarning

public static void addWarning(java.lang.String key,
                              java.lang.Object[] args)

Adds a warning to the top of the page. You supply a resource key that is used to identify the real warning (in i18n.properties).


addError

public static void addError(java.lang.String key)

Adds an error to the top of the page. You supply a resource key that is used to identify the real message (in i18n.properties).


addError

public static void addError(java.lang.String key,
                            java.lang.Object[] args)

Adds an error to the top of the page. You supply a resource key that is used to identify the real message (in i18n.properties). Param0 is substituted for {0}.


addMessage

public static void addMessage(Component c,
                              java.lang.String key)

Adds a message to the top of the page. You supply a resource key that is used to identify the real message (in i18n.properties).


addMessage

public static void addMessage(Component c,
                              java.lang.String key,
                              java.lang.Object[] args)

Adds a message to the top of the page. You supply a resource key that is used to identify the real message (in i18n.properties).


addWarning

public static void addWarning(Component c,
                              java.lang.String key)

Adds a warning to the top of the page. You supply a resource key that is used to identify the real warning (in i18n.properties).


addWarning

public static void addWarning(Component c,
                              java.lang.String key,
                              java.lang.Object[] args)

Adds a warning to the top of the page. You supply a resource key that is used to identify the real warning (in i18n.properties).


addError

public static void addError(Component c,
                            java.lang.String key)

Adds an error to the top of the page. You supply a resource key that is used to identify the real message (in i18n.properties).


addError

public static void addError(Component c,
                            java.lang.String key,
                            java.lang.Object[] args)

Adds an error to the top of the page. You supply a resource key that is used to identify the real message (in i18n.properties). Param0 is substituted for {0}.


getRequestParameterNames

public static java.lang.String[] getRequestParameterNames()

Gets the list of request parameters.


getConnection

public static Connection getConnection()

getPreviousMessages

public static java.util.List getPreviousMessages()
Retrieve the last displayed errors,messages and/or warnings.

Returns: