org.ajax4jsf.resource
Class ResourceContext

java.lang.Object
  extended by org.ajax4jsf.resource.ResourceContext

public abstract class ResourceContext
extends java.lang.Object

Abstraction context class for rendering resource ( image, script, style ) can be work in 2 variants - for simple ServletRequest and as JSF context encapsulation.

Version:
$Revision: 1.1.2.1 $ $Date: 2007/01/09 18:56:57 $
Author:
asmirnov@exadel.com (latest modification by $Author: alexsmirnov $)

Constructor Summary
ResourceContext()
           
 
Method Summary
abstract  java.lang.Object getContextAttribute(java.lang.String name)
          Get ServletContext attribute by name.
abstract  java.lang.String getInitParameter(java.lang.String name)
           
abstract  java.io.OutputStream getOutputStream()
           
abstract  java.lang.String getPathInfo()
          Deprecated. 
abstract  java.lang.String getQueryString()
          Deprecated. 
abstract  java.lang.String getRequestParameter(java.lang.String dataParameter)
          Get request parameter for given name.
abstract  java.net.URL getResource(java.lang.String path)
          Return a URL for the application resource mapped to the specified path, if it exists; otherwise, return null.
abstract  java.io.InputStream getResourceAsStream(java.lang.String path)
          Return an InputStream for an application resource mapped to the specified path, if it exists; otherwise, return null.
 java.lang.Object getResourceData()
           
abstract  java.util.Set<java.lang.String> getResourcePaths(java.lang.String path)
          Return the Set of resource paths for all application resources whose resource path starts with the specified argument.
abstract  java.lang.String getServletPath()
          Deprecated. 
abstract  java.lang.Object getSessionAttribute(java.lang.String name)
          Get session attribute for given name.
abstract  java.io.Writer getWriter()
          get output writer for send response.
 boolean isCacheEnabled()
           
 void release()
          Release any data used by this context.
 void setCacheEnabled(boolean cacheEnabled)
           
abstract  void setContentLength(int contentLength)
          Setup response content length as javax.servlet.ServletResponse#setContentLength(int)
abstract  void setContentType(java.lang.String contentType)
          Setup response content type as javax.servlet.ServletResponse#setContentType(java.lang.String)
abstract  void setDateHeader(java.lang.String name, long value)
          Delegate to javax.servlet.ServletResponse setHeader
abstract  void setHeader(java.lang.String name, java.lang.String value)
          Delegate to javax.servlet.ServletResponse setHeader
abstract  void setIntHeader(java.lang.String name, int value)
          Delegate to javax.servlet.ServletResponse setHeader
 void setResourceData(java.lang.Object data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceContext

public ResourceContext()
Method Detail

setHeader

public abstract void setHeader(java.lang.String name,
                               java.lang.String value)
Delegate to javax.servlet.ServletResponse setHeader

Parameters:
name - name of header
value - new value

setIntHeader

public abstract void setIntHeader(java.lang.String name,
                                  int value)
Delegate to javax.servlet.ServletResponse setHeader

Parameters:
name - name of header
value - new value

setDateHeader

public abstract void setDateHeader(java.lang.String name,
                                   long value)
Delegate to javax.servlet.ServletResponse setHeader

Parameters:
name - name of header
value - new value

getOutputStream

public abstract java.io.OutputStream getOutputStream()
                                              throws java.io.IOException
Returns:
Throws:
java.io.IOException

getQueryString

@Deprecated
public abstract java.lang.String getQueryString()
Deprecated. 

Returns:

getPathInfo

@Deprecated
public abstract java.lang.String getPathInfo()
Deprecated. 

Returns:

getServletPath

@Deprecated
public abstract java.lang.String getServletPath()
Deprecated. 

Returns:

getSessionAttribute

public abstract java.lang.Object getSessionAttribute(java.lang.String name)
Get session attribute for given name. session not created

Parameters:
name - attribute name
Returns:
value for attribute, or null.

getContextAttribute

public abstract java.lang.Object getContextAttribute(java.lang.String name)
Get ServletContext attribute by name.

Parameters:
name -
Returns:
value for attribute, or null.

getResource

public abstract java.net.URL getResource(java.lang.String path)
                                  throws java.net.MalformedURLException

Return a URL for the application resource mapped to the specified path, if it exists; otherwise, return null.

Servlet: This must be the value returned by the javax.servlet.ServletContext method getResource(path).

Portlet: This must be the value returned by the javax.portlet.PortletContext method getResource(path).

Parameters:
path - The path to the requested resource, which must start with a slash ("/" character
Throws:
java.net.MalformedURLException - if the specified path is not in the correct form
java.lang.NullPointerException - if path is null

getResourceAsStream

public abstract java.io.InputStream getResourceAsStream(java.lang.String path)

Return an InputStream for an application resource mapped to the specified path, if it exists; otherwise, return null.

Servlet: This must be the value returned by the javax.servlet.ServletContext method getResourceAsStream(path).

Portlet: This must be the value returned by the javax.portlet.PortletContext method getResourceAsStream(path).

Parameters:
path - The path to the requested resource, which must start with a slash ("/" character
Throws:
java.lang.NullPointerException - if path is null

getResourcePaths

public abstract java.util.Set<java.lang.String> getResourcePaths(java.lang.String path)

Return the Set of resource paths for all application resources whose resource path starts with the specified argument.

Servlet: This must be the value returned by the javax.servlet.ServletContext method getResourcePaths(path).

Portlet: This must be the value returned by the javax.portlet.PortletContext method getResourcePaths(path).

Parameters:
path - Partial path used to match resources, which must start with a slash ("/") character
Throws:
java.lang.NullPointerException - if path is null

getRequestParameter

public abstract java.lang.String getRequestParameter(java.lang.String dataParameter)
Get request parameter for given name.

Parameters:
dataParameter -
Returns:

isCacheEnabled

public boolean isCacheEnabled()
Returns:
Returns the cacheEnabled.

setCacheEnabled

public void setCacheEnabled(boolean cacheEnabled)
Parameters:
cacheEnabled - The cacheEnabled to set.

getWriter

public abstract java.io.Writer getWriter()
                                  throws java.io.IOException
get output writer for send response.

Returns:
Throws:
java.io.IOException

setContentType

public abstract void setContentType(java.lang.String contentType)
Setup response content type as javax.servlet.ServletResponse#setContentType(java.lang.String)

Parameters:
contentType -

setContentLength

public abstract void setContentLength(int contentLength)
Setup response content length as javax.servlet.ServletResponse#setContentLength(int)

Parameters:
contentLength -

getInitParameter

public abstract java.lang.String getInitParameter(java.lang.String name)

getResourceData

public java.lang.Object getResourceData()

setResourceData

public void setResourceData(java.lang.Object data)

release

public void release()
Release any data used by this context. Close buffers used by cached context, release FacesContext, if exist.



Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.