nextapp.echoservlet
Interface ServerContext


public interface ServerContext

An interface provided to an EchoInstance such that it may access certain facilities available in the application container. An instance of an implementation of this interface is set as an attribute with ATTRIBUTE_NAME


Field Summary
static java.lang.String ATTRIBUTE_NAME
           
 
Method Summary
 void exit()
          Exits the application.
 void exit(java.lang.String uri)
          Exits the application.
 java.lang.String getAbnormalExitUri()
          Returns the abnormal exit URI.
 java.lang.String getCharacterEncoding()
          Returns the character encoding that will be used when communicating with the client.
 ClientProperties getClientProperties()
          Returns the client properties data that contains data about the client browser.
 CookieManager getCookieManager()
          Returns the CookieManager instance for the application.
 java.lang.String getDefaultExitUri()
          Returns the default exit URI.
 javax.servlet.ServletConfig getServletConfig()
          Returns the ServletConfig object provided to the EchoServer when it was initialized.
 javax.servlet.http.HttpSession getSession()
          Returns the HTTP session that in which the Echo application is held.
 java.security.Principal getUserPrincipal()
          Returns the principal (user) of the application.
 boolean isUserInRole(java.lang.String role)
          Returns true if the application's user is in the specified role.
 void setAbnormalExitUri(java.lang.String abnormalExitUri)
          Sets the abnormal exit URI.
 void setCharacterEncoding(java.lang.String characterEncoding)
          Sets the character encoding that will be used when communicating with the client.
 void setDefaultExitUri(java.lang.String uri)
          Sets the default exit URI The browser is redirected to the default exit URI automatically if the exit() or suspend() are called without a specific URI.
 void suspend()
          Suspends the application.
 void suspend(java.lang.String uri)
          Suspends the application.
 

Field Detail

ATTRIBUTE_NAME

static final java.lang.String ATTRIBUTE_NAME
See Also:
Constant Field Values
Method Detail

exit

void exit()
Exits the application. The application will be removed from the HTTP session, and if its URI is requested again, a new instance of the application will be provided. When an application exits, all browser windows used by the application will be closed except one. The remaining window will be redirected to the default exit URI.


exit

void exit(java.lang.String uri)
Exits the application. The application will be removed from the HTTP session, and if its URI is requested again, a new instance of the application will be provided. When an application exits, all browser windows used by the application will be closed except one. The remaining window will be redirected to the specified URI.

Parameters:
uri - The URI to redirect the browser to.

getAbnormalExitUri

java.lang.String getAbnormalExitUri()
Returns the abnormal exit URI. The browser is redirected to the abnormal exit URI automatically if the application encounters an unrecoverable error.

Returns:
The abnormal exit URI.

getCharacterEncoding

java.lang.String getCharacterEncoding()
Returns the character encoding that will be used when communicating with the client.

Returns:
The character encoding that will be used when communicating with the client.

getClientProperties

ClientProperties getClientProperties()
Returns the client properties data that contains data about the client browser.

Returns:
The instance's client properties data.

getCookieManager

CookieManager getCookieManager()
Returns the CookieManager instance for the application.

Returns:
The CookieManager instance for the application.

getDefaultExitUri

java.lang.String getDefaultExitUri()
Returns the default exit URI. The browser is redirected to the default exit URI automatically if the exit() or suspend() are called without a specific URI.

Returns:
The default exit URI.

getServletConfig

javax.servlet.ServletConfig getServletConfig()
Returns the ServletConfig object provided to the EchoServer when it was initialized. The ServletConfig object provides access to servlet initialization parameters. Use ServletConfig.getServletContext() to obtain access to the ServletContext.

Returns:
The ServletConfig object provided to the EchoServer when it was initialized.

getSession

javax.servlet.http.HttpSession getSession()
Returns the HTTP session that in which the Echo application is held.

Returns:
the HTTP session that in which the Echo application is held.

getUserPrincipal

java.security.Principal getUserPrincipal()
Returns the principal (user) of the application.

Returns:
The principal (user) of the application.

isUserInRole

boolean isUserInRole(java.lang.String role)
Returns true if the application's user is in the specified role.

Returns:
True if the application's user is in the specified role.

setAbnormalExitUri

void setAbnormalExitUri(java.lang.String abnormalExitUri)
Sets the abnormal exit URI. The browser is redirected to the abnormal exit URI automatically if the application encounters an unrecoverable error.

Parameters:
abnormalExitUri - The abnormal exit URI.

setCharacterEncoding

void setCharacterEncoding(java.lang.String characterEncoding)
Sets the character encoding that will be used when communicating with the client.

Parameters:
characterEncoding - The character encoding that will be used when communicating with the client.

setDefaultExitUri

void setDefaultExitUri(java.lang.String uri)
Sets the default exit URI The browser is redirected to the default exit URI automatically if the exit() or suspend() are called without a specific URI.

Parameters:
uri - The default exit URI.

suspend

void suspend()
Suspends the application. The application will still be held in the HTTP session, and if its URI is requested again, the application will reinitialize to its pre-suspended state. When an application is suspended, all browser windows used by the application will be closed except one. The remaining window will be redirected to the default exit URI.


suspend

void suspend(java.lang.String uri)
Suspends the application. The application will still be held in the HTTP session, and if its URI is requested again, the application will reinitialize to its pre-suspended state. When an application is suspended, all browser windows used by the application will be closed except one. The remaining window will be redirected to the specified URI.

Parameters:
uri - The URI to redirect the browser to.