com.sun.portal.wireless.providers.rendering
Class JSPRenderingProvider

java.lang.Object
  extended byJSPProvider
      extended bycom.sun.portal.wireless.providers.rendering.JSPRenderingProvider

public class JSPRenderingProvider
extends JSPProvider

The JSPRenderingProvider class extends from the JSPProvider and overrides the getContent, getEdit and getMostSpecificPath methods of JSPProvider. This is a public class and can be extended to add more functionality to the provider if needed. It gets the AML content from JSP templates for the provider and based on a few checks, it decides whether to pass the AML content back to the container or call the RenderingEngine itself and pass back device specific markup to the container.

Rendering Channels created using this JSPRenderingProvider can be a part of either RenderingContainers or NativeContainers. While creating channels using JSPRenderingProvider, the channel developer has to write a contentPage.jsp and editPage.jsp (if channel is editable) which would get the content from AML JSPs it has.

All JSPs created for the channel should be valid AML documents.

See Also:
Serialized Form

Constructor Summary
JSPRenderingProvider()
           
 
Method Summary
 java.lang.StringBuffer getContent(HttpServletRequest req, HttpServletResponse res)
          This method overrides JSPProvider.getContent() method.
 java.lang.StringBuffer getEdit(HttpServletRequest req, HttpServletResponse res)
          This method overrides JSPProvider.getEdit() method.
 java.io.File getExistingJSPPath(ProviderContext pc, java.lang.String name, java.lang.String file)
          Get the most specific JSP path for the given channel name and file name.
protected  java.io.File getMostSpecificJSPPath(ProviderContext pc, java.lang.String name, java.lang.String file)
          Get the most specific JSP path for the given channel name and file name.
 void init(java.lang.String name, HttpServletRequest req)
          Initializes this JSPRenderingProvider.
protected  java.lang.StringBuffer renderContent(HttpServletRequest req, java.lang.StringBuffer sb)
          This method is expected to be called from the Provider's getContent() methods after it creates its content StringBuffer.
protected  java.lang.StringBuffer renderEditContent(HttpServletRequest req, java.lang.StringBuffer sb)
          This method is expected to be called from the Provider's getEdit() methods after it creates its content StringBuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSPRenderingProvider

public JSPRenderingProvider()
Method Detail

init

public void init(java.lang.String name,
                 HttpServletRequest req)
          throws ProviderException
Initializes this JSPRenderingProvider.

Throws:
ProviderException

getContent

public java.lang.StringBuffer getContent(HttpServletRequest req,
                                         HttpServletResponse res)
                                  throws ProviderException
This method overrides JSPProvider.getContent() method. It gets the JSP content from JSPProvider and pass it to renderContent() method. Based on a few check, it will either return device specfic markup or AML.

Returns:
StringBuffer holding the channel content that is markup specific or AML.
Throws:
ProviderException - If there was an error generating the content.
See Also:
com.sun.portal.providers.jsp.JSPProvider#getContent

getEdit

public java.lang.StringBuffer getEdit(HttpServletRequest req,
                                      HttpServletResponse res)
                               throws ProviderException
This method overrides JSPProvider.getEdit() method. It gets the JSP edit page content from JSPProvider and pass it to renderContent() method. Based on a few check, it will either return device specfic markup or AML.

Returns:
StringBuffer holding the channel edit page that is markup specific or AML.
Throws:
ProviderException - If there was an error generating the content.
See Also:
com.sun.portal.providers.jsp.JSPProvider#getEdit

renderContent

protected java.lang.StringBuffer renderContent(HttpServletRequest req,
                                               java.lang.StringBuffer sb)
                                        throws ProviderException
This method is expected to be called from the Provider's getContent() methods after it creates its content StringBuffer. It calls RenderingUtil.renderContent() to render the content. The return buffer can contain device specific markup (rendered) or remain as AML document (not rendered).

Parameters:
req - An HttpServletRequest that contains information related to this request for content.
sb - The StringBuffer representing the content obtained from the JSPs.
Returns:
StringBuffer The return content can be rendered or not rendered.
Throws:
ProviderException
See Also:
RenderingUtil#renderContent

renderEditContent

protected java.lang.StringBuffer renderEditContent(HttpServletRequest req,
                                                   java.lang.StringBuffer sb)
                                            throws ProviderException
This method is expected to be called from the Provider's getEdit() methods after it creates its content StringBuffer. It calls RenderingUtil.renderEditContent() to render the content. The return buffer can contain device specific markup (rendered) or remain as AML document (not rendered).

Parameters:
req - An HttpServletRequest that contains information related to this request for content.
sb - The StringBuffer representing the content obtained from the JSPs.
Returns:
StringBuffer The return content can be rendered or not rendered.
Throws:
ProviderException
See Also:
RenderingUtil#renderContent

getMostSpecificJSPPath

protected java.io.File getMostSpecificJSPPath(ProviderContext pc,
                                              java.lang.String name,
                                              java.lang.String file)
                                       throws ProviderException
Get the most specific JSP path for the given channel name and file name. This method overrides the JSPProvider. getMostSpecificJSPPath() method and calls RenderingUtils.getTemplateMostSpecificPath to get the real path.

Parameters:
pc - The ProviderContext.
name - The channel name.
file - The jsp file name.
Returns:
Throws:
ProviderException - if an error occurs in getting the path.
See Also:
com.sun.portal.providers.jsp.JSPProvider#getMostSpecificJSPPath, RenderingUtil#getTemplateMostSpecificPath

getExistingJSPPath

public java.io.File getExistingJSPPath(ProviderContext pc,
                                       java.lang.String name,
                                       java.lang.String file)
                                throws ProviderException
Get the most specific JSP path for the given channel name and file name. This method overrides the JSPProvider. getExistingJSPPath() method and calls RenderingUtils.getTemplatePath to get the real path.

Parameters:
pc - The ProviderContext.
name - The channel name.
file - The jsp file name.
Returns:
Throws:
ProviderException - if an error occurs in getting the path.
See Also:
com.sun.portal.providers.jsp.JSPProvider#getExistingJSPPath, RenderingUtil#getTemplatePath