Novell exteNd
Director 5.2 API

com.sssw.fw.api
Interface EbiRequestContext

All Superinterfaces:
EbiContext
All Known Subinterfaces:
EbiContext, EbiPortalContext

public interface EbiRequestContext
extends EbiContext

Interface for examining request information passed by a component. Methods examine and set cookies, response status, response phrase, and servlet context.

In a component's getComponentData() method, your code builds the HTML or XML for the component's user interface. Then it calls the setContentType() and setComponentContent() methods to send the content back to the Presentation Manager.


Method Summary
 String getContentType()
          Gets the type of content being returned by a component.
 String getCookieValue(String cookieID)
          Gets the value associated with a particular cookie ID.
 String getResponsePhrase()
          Gets a piece of content or other text that was set in the context object by a component or a rule's action.
 int getResponseStatus()
          Gets the status code associated with the response.
 ServletContext getServletContext()
           Gets the servlet context.
 String getURI()
          Gets the URI of the current context.
 boolean hasQueryString()
          Checks the request for a parameter string associated with an HTTP request.
 void setContentType(String contentType)
          Sets the type of content being returned to the portal by a component.
 void setCookieValue(String cookieID, String cookieValue, int maxAge)
          Sets a cookie in the user's browser.
 void setRequestResponse(HttpServletRequest req, HttpServletResponse res)
          Sets both the request and the response objects in the context.
 void setResponsePhrase(String phrase)
          Sets a piece of text in the context object.
 void setResponseStatus(int status)
          Sets the status code associated with the response.
 void setServletContext(ServletContext scontext)
          Sets the current Servlet context.
 void setURI(String uri)
          Sets URI of the current context.
 
Methods implemented from interface com.sssw.fw.api.EbiContext
cloneCopy, getAttributeNames, getBrowserInfo, getContextName, getEbiRequest, getEbiResponse, getEbiSession, getEbiSession, getEbiWhiteboard, getEJBContext, getException, getLocale, getPrincipal, getTemporaryData, getTemporaryValue, getValue, getValue, getValueNames, hasSession, hasValue, isNewSession, removeAllValues, removeValue, setEbiRequest, setEbiResponse, setEbiSession, setEJBContext, setException, setTemporaryValue, setValue
 

Method Detail

getContentType

public String getContentType()
Gets the type of content being returned by a component. These correspond to HTTP MIME types. Constants for content types have the prefix MIME and are defined in EbiComponentConstants.

See Also:
EbiRequestContext.setContentType(String)

setContentType

public void setContentType(String contentType)
Sets the type of content being returned to the portal by a component.

The types of content typically are HTML or XML. The XML can be returned as a DOM or String. Constants for content types have the prefix MIME and are defined in EbiComponentConstants.

See Also:
EbiRequestContext.getContentType(), EbiComponentConstants.MIME_TYPE_HTML, EbiComponentConstants.MIME_TYPE_XML, EbiComponentConstants.MIME_TYPE_XMLDOM

getResponsePhrase

public String getResponsePhrase()
Gets a piece of content or other text that was set in the context object by a component or a rule's action. The information in the phrase can be used by the component as it generates its content.

A response phrase is available if the component runs a rule or calls other code that sets the phrase. For rules and actions, check the documentation to find out what their effects are.

To find out the format of the response phrase, check the response type by calling EbiResponse.getResponseType().

The response phrase is available whenever a context object exists, but it is not used directly by the portal. It is up to your component's code to fire rules, get the response phrase, and use it to affect the content the component generates.

Returns:
A text value that is usually set by actions taken by the component, such as firing rules.

getResponseStatus

public int getResponseStatus()
Gets the status code associated with the response. A response status is an HTTP status code, the same values that are defined as named constants in javax.servlet.http.HttpServletResponse. You will also find constants for these values defined in EbiResponse.

The status is valid only if a rule or other code set it.

Returns:
An integer status code indicating the success or failure of the request, if the application uses status codes.
See Also:
EbiResponse

getURI

public String getURI()
Gets the URI of the current context.
Returns:
The URI of the current context.
See Also:
EbiRequest

hasQueryString

public boolean hasQueryString()
Checks the request for a parameter string associated with an HTTP request. The presence of a query string tells you that the user responded to a form and that your component needs to process the results.

To get the parameter values, use code like this:

  String value = context.getRequest().getParameter(name);
  
Returns:
Boolean true if a query string is present, false otherwise.

getCookieValue

public String getCookieValue(String cookieID)
Gets the value associated with a particular cookie ID. A cookie is available if you have previously called setCookieValue() and the cookie hasn't expired.
See Also:
EbiRequestContext.setCookieValue(String, String, int)

setCookieValue

public void setCookieValue(String cookieID,
                           String cookieValue,
                           int maxAge)
Sets a cookie in the user's browser.

When the maximum age of the cookie is a positive value, it indicates that the cookie will expire after that many seconds have passed. Note that the value is the maximum age when the cookie will expire, not the cookie's current age.

A negative value means that the cookie will be deleted when the Web browser exits. A zero value causes the cookie to be deleted.

Parameters:
cookieID - An identifier for the cookie.
cookieValue - The value for the cookie.
maxAge - The duration in seconds that the cookie will be saved by the browser.

setRequestResponse

public void setRequestResponse(HttpServletRequest req,
                               HttpServletResponse res)
Sets both the request and the response objects in the context.
Parameters:
req - An HTTP servlet request object.
res - An HTTP servlet response object.

setResponsePhrase

public void setResponsePhrase(String phrase)
Sets a piece of text in the context object. The text can be used by the component as it generates its content. When setting a response phrase, you should also call setResponseType() to specify the format of the phrase. You can also call setResponseStatus() to specify a status code for the response.

Typically, the response phrase is set by a rule's action to hold data that was selected by the rule. Check the documentation for rules that you use to find out the effects of their actions.

Parameters:
phrase - A String.
See Also:
EbiRequestContext.getResponsePhrase(), EbiRequestContext.setResponseStatus( int status ), EbiResponse.setResponseType( int responseType )

setResponseStatus

public void setResponseStatus(int status)
Sets the status code associated with the response. A response status is an HTTP status code, the same values that are defined as named constants in javax.servlet.http.HttpServletResponse. You will also find constants for these values defined in EbiResponse.

Typically, a rule sets the response status, and your component calls getResponseStatus() to find out the rule's results.

Parameters:
status - An integer status code indicating the success or failure of the request.
See Also:
EbiResponse, EbiRequestContext.getResponseStatus()

setURI

public void setURI(String uri)
Sets URI of the current context.
Parameters:
uri - A URI.
See Also:
EbiRequest

getServletContext

public ServletContext getServletContext()

Gets the servlet context.

Returns:
The servlet context for the current Web applicaiton. If no servlet context exists, returns null.

setServletContext

public void setServletContext(ServletContext scontext)
Sets the current Servlet context.
Parameters:
scontext - The servlet context of the current Web application.

Novell exteNd
Director 5.2 API