Overview | Package | Class | Tree | Deprecated | Index | Help
| The PDK Java API is part of the Portal Developer Kit on Portal Studio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.portal.provider.v2.render.http
Class ResourceRenderer

    java.lang.Object
      |
      +--oracle.portal.provider.v2.render.ManagedRenderer
            |
            +--oracle.portal.provider.v2.render.http.BaseManagedRenderer
                  |
                  +--oracle.portal.provider.v2.render.http.ResourceRenderer

All Implemented Interfaces:
  InitializableXMLObject, Validateable

Direct Known Subclasses:
  ResourceValidateRenderer

public class ResourceRenderer
extends BaseManagedRenderer

When maintained by a `RenderManager`, a `ResourceRenderer` renders a single page's contents from resource known to the servlet container. Examples of such resources include JSPs, servlets and static HTML files. Any resource can be used as long as the servlet container can return a valid `javax.servlet.RequestDispatcher` for it. The resource can be located in the same servlet context as the current provider or a different one.

Constructor Summary
`ResourceRenderer()` Null Constructor.
`ResourceRenderer(RenderManager parent, java.lang.String path)` Creates and initializes a `ResourceRenderer` owned by the given `RenderManager`, to render from the resource at the given path.

Method Summary
`java.lang.String` | `getContext()` Gets the context root of the `javax.servlet.ServletContext` containing the resource.
`java.lang.String` | `getResourcePath()` Gets the path to the resource used for rendering.
`void` | `postInitialize()` Performs the extra steps required to initialize and validate a `ResourceRenderer` object once its properties have been set with the appropriate accessor methods.
`boolean` | `prepareResponse(PortletRenderRequest pr)` In addition to setting default http headers for the response (see `BaseManagedRenderer`), `ResourceRenderer` ensures the `HttpServletResponse` is wrapped in the correct manner.
`void` | `renderBody(PortletRenderRequest pr)` Render the specified page's contents from the required resource.
`void` | `setCharSet(java.lang.String charSet)` Sets the character set to be used for rendering resource content.
`void` | `setContext(java.lang.String context)` Sets the context root of the `javax.servlet.ServletContext` containing the resource.
`void` | `setResourcePath(java.lang.String path)` Sets the path of the resource used for rendering.
`void` | `validate(java.lang.String context, ValidationError errors)` Validates the internal state of this `ResourceRenderer` instance.

Methods inherited from class oracle.portal.provider.v2.render.http.BaseManagedRenderer
`addParameter, getContentType, getGeneratesESI, preInitialize, setContentType, setGeneratesESI, setGeneratesESI, setPageExpires, setPageExpires, setUseInvalidationCaching, setUseInvalidationCaching`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ResourceRenderer

    public ResourceRenderer()

  Null Constructor. The `BaseManagedRenderer.preInitialize(Object)` method should be called after creating an object with this constructor and the `BaseManagedRenderer.postInitialize()` method should be called after setting up page properties with the various accessor methods. Normally a `DefaultNodeHandler` takes care of these details.

### ResourceRenderer

    public ResourceRenderer(RenderManager parent,
                            java.lang.String path)
                     throws PortletException

  Creates and initializes a `ResourceRenderer` owned by the given `RenderManager`, to render from the resource at the given path.
  Parameters:
    ``RenderManager`` - that owns this page
    `path` - the path to the resource.
  Throws:
    `PortletException` - if an error occurs while initializing the object

Method Detail

### getContext

    public java.lang.String getContext()

  Gets the context root of the `javax.servlet.ServletContext` containing the resource. If the resource is located in the same context as the current provider, this method returns `null`.
  Returns:
    the context root, or `null` if the context is the same as the current provider.

### setContext

    public void setContext(java.lang.String context)

  Sets the context root of the `javax.servlet.ServletContext` containing the resource. This should only be set if the resource is located in a different servelet context than the current provider.
  Parameters:
    `context` - context root known to the server.

### getResourcePath

    public java.lang.String getResourcePath()

  Gets the path to the resource used for rendering. This path is relative to the context root of the J2EE Application.
  Returns:
    the resource path, relative to the context root.

### setResourcePath

    public void setResourcePath(java.lang.String path)

  Sets the path of the resource used for rendering. This path should be relative to the context root of the J2EE Application. It should fully locate the resource so, in the case of JSPs and static files, should include the file name.
  Parameters:
    `path` - resource location.

### setCharSet

    public void setCharSet(java.lang.String charSet)

  Sets the character set to be used for rendering resource content. Overrides the default behaviour where the character set is defined in the content type request header or defaults to ISO-8859-1.

### postInitialize

    public void postInitialize()
                        throws NodeHandlerException

  Performs the extra steps required to initialize and validate a `ResourceRenderer` object once its properties have been set with the appropriate accessor methods. A `ResourceRenderer` object must be supplied with a non null resource path.
  Overrides:
    `postInitialize` in class `BaseManagedRenderer`
  Throws:
    `NodeHandlerException` - if a resource path has not been specified.

### prepareResponse

    public boolean prepareResponse(PortletRenderRequest pr)
                            throws PortletException

  In addition to setting default http headers for the response (see `BaseManagedRenderer`), `ResourceRenderer` ensures the `HttpServletResponse` is wrapped in the correct manner.
  Overrides:
    `prepareResponse` in class `BaseManagedRenderer`
  Parameters:
    `pr` - a `PortletRenderRequest`.

### renderBody

    public void renderBody(PortletRenderRequest pr)
                    throws PortletException

  Render the specified page's contents from the required resource. This resource may be any that the servlet container can return a valid `javax.servlet.RequestDispatcher` for. Examples include JSPs, servlets and static HTML files.
  Overrides:
    `renderBody` in class `ManagedRenderer`
  Parameters:
    `pr` - a `PortletRenderRequest`.

### validate

    public void validate(java.lang.String context,
                         ValidationError errors)

  Validates the internal state of this `ResourceRenderer` instance. Errors found are reported using the supplied `ValidationError` instance.
  Overrides:
    `validate` in class `BaseManagedRenderer`
  Parameters:
    `context` - The context of the calling instance.
    `errors` - The current list of errors.

Overview | Package | Class | Tree | Deprecated | Index | Help
| The PDK Java API is part of the Portal Developer Kit on Portal Studio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2002, Oracle Corporation. All Rights Reserved.