Esri Geoportal Server
1.0

com.esri.gpt.framework.context
Class RequestContext

java.lang.Object
  extended by com.esri.gpt.framework.context.RequestContext

public class RequestContext
extends Object

Context for a request.

This class is intended for use by a single execution thread.


Field Summary
static String REFERENCEKEY
          The key used to store the instance within the ServletRequest.
 
Constructor Summary
protected RequestContext()
          Default constructor.
protected RequestContext(ServletRequest request)
          Constructs with an associated servlet request.
 
Method Summary
 void addToSession(String key, Object obj)
          Adds the to session.
static RequestContext extract(ServletRequest request)
          Extracts the request context from the current servlet request.
 Object extractFromSession(String key)
          Extract an object from session.
 ApplicationConfiguration getApplicationConfiguration()
          Gets the application configuration.
 ApplicationContext getApplicationContext()
          Gets the context for this application.
 CatalogConfiguration getCatalogConfiguration()
          Gets the metadata catalog configuration associated with this application.
 ConnectionBroker getConnectionBroker()
          Gets the broker for database access.
 IdentityConfiguration getIdentityConfiguration()
          Gets the identity configuration associated with this application.
 Logger getLogger()
          Gets the logger.
 MailConfiguration getMailConfiguration()
          Gets the mail configuration associated with this application.
 Map<String,Object> getObjectMap()
          Gets the free form object map associated with this request.
 ServletRequest getServletRequest()
          Gets underlying servlet request.
 User getUser()
          Gets the user associated with this request.
 boolean getViewerExecutesJavascript()
          Gets the viewer executes javascript.
 IdentityAdapter newIdentityAdapter()
          Instantiates a new Identity adapter.
 void onExecutionPhaseCompleted()
          Flags the end of the execution phase of a request.
 void onPrepareViewCompleted()
          Flags the end of the execution phase of a request.
static String resolveBaseContextPath(HttpServletRequest request)
          Resolves the base context path associated with an HTTP request.
protected  void setUser(User user)
          Sets the user associated with this request.
 void setViewerExecutesJavascript(boolean viewerExecutedJavascript)
          Sets the viewer executes javascript.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFERENCEKEY

public static final String REFERENCEKEY
The key used to store the instance within the ServletRequest.

See Also:
Constant Field Values
Constructor Detail

RequestContext

protected RequestContext()
Default constructor.


RequestContext

protected RequestContext(ServletRequest request)
Constructs with an associated servlet request.

Parameters:
request - the current servlet request
Method Detail

getApplicationConfiguration

public ApplicationConfiguration getApplicationConfiguration()
Gets the application configuration.

Returns:
the application configuration

getApplicationContext

public ApplicationContext getApplicationContext()
Gets the context for this application.

Returns:
the ApplicationContext

getCatalogConfiguration

public CatalogConfiguration getCatalogConfiguration()
Gets the metadata catalog configuration associated with this application.

Returns:
the catalog configuration

getConnectionBroker

public ConnectionBroker getConnectionBroker()
Gets the broker for database access.

Returns:
the database connection broker

getIdentityConfiguration

public IdentityConfiguration getIdentityConfiguration()
Gets the identity configuration associated with this application.

Returns:
the identity configuration

getLogger

public Logger getLogger()
Gets the logger.

Returns:
the logger

getMailConfiguration

public MailConfiguration getMailConfiguration()
Gets the mail configuration associated with this application.

Returns:
the mail configuration

getServletRequest

public ServletRequest getServletRequest()
Gets underlying servlet request.
This is only available if it was passed on the coonstructor.

Returns:
the underlying servlet request (can be null)

getObjectMap

public Map<String,Object> getObjectMap()
Gets the free form object map associated with this request.
This map can be used in a manner similar to the attributes of a ServletRequest.

Returns:
the free form object map

getUser

public User getUser()
Gets the user associated with this request.

Returns:
the user

setUser

protected void setUser(User user)
Sets the user associated with this request.

Parameters:
user - the user

getViewerExecutesJavascript

public boolean getViewerExecutesJavascript()
Gets the viewer executes javascript.

Returns:
the viewer executed javascript

setViewerExecutesJavascript

public void setViewerExecutesJavascript(boolean viewerExecutedJavascript)
Sets the viewer executes javascript.

Parameters:
viewerExecutedJavascript - the new viewer executed javascript

extract

public static RequestContext extract(ServletRequest request)
Extracts the request context from the current servlet request.

Parameters:
request - the current servlet request
Returns:
the request context

resolveBaseContextPath

public static String resolveBaseContextPath(HttpServletRequest request)
Resolves the base context path associated with an HTTP request.
(http://<host:port>/<Context>)

If a reverse proxy base URL hase been configured, it will be returned:
/gptConfig/catalog/parameter@key="reverseProxy.baseContextPath"

Returns:
the base context path

newIdentityAdapter

public IdentityAdapter newIdentityAdapter()
Instantiates a new Identity adapter.

Returns:
the new identity adapter

onExecutionPhaseCompleted

public void onExecutionPhaseCompleted()
Flags the end of the execution phase of a request.
Database connections accessed during the request are freed by this method.
This method must be triggered by the controller managing this request context.


onPrepareViewCompleted

public void onPrepareViewCompleted()
Flags the end of the execution phase of a request.
Database connections accessed during the request are freed by this method.
This method must be triggered by the controller if the previewView event has been invoked.


addToSession

public void addToSession(String key,
                         Object obj)
Adds the to session. Placed in central class so that inner classes do not have to work with the http session object.

Parameters:
key - the key
obj - the obj

extractFromSession

public Object extractFromSession(String key)
Extract an object from session.

Parameters:
key - the key
Returns:
the object (possibly null)

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.