+

Search Tips   |   Advanced Search

 PREV CLASS   NEXT CLASS
Tree 
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

com.ibm.portal.portlet.apiconvert
Class APIConverterFactory

java.lang.Object
  extended by com.ibm.portal.portlet.apiconvert.APIConverterFactory
public class APIConverterFactory
extends java.lang.Object

Factory class which is used tp wrap Jetspeed API objects with Java Portlet API interfaces. Some methods on the returned objects are not supported, even though they are part of the interface, because the functionality cannot be mapped to the Jetspeed API. This means that the implementation of the returned objects is not fully compliant to the Java portlet specification. See the documentation of the individual methods for incompatibilities

This functionality should not be used in portlet code but only in the implementation of extended APIs for portlets, such as portlet services. It helps portlet service providers to write portlet services that should be available to both portlets written to the IBM portet API and portlets written to the Java portlet API, so they can maintain compatibility to existing portlets when extending support to the Java Portlet API. Those services can have a single implementation for javax API objects only. The interface for IBM portlets can then be implemented by wrapping Jetspeed API objects and calling the method for javax API objects.

Coding example:

    public void doSomething(javax.portlet.RenderRequest request, ...) {         ... implementation code written to the Java Portlet API ...
    }

    public void doSomething(org.apache.jetspeed.portlet.PortletRequest request, ...) {         doSomething(APIConverterFactory.getInstance().getRenderRequest(request), ...);
    }
 
When using this approach, you must make sure that the actual implementation code that works on the javax API objects uses only those methods that are also supported by the wrappers and not declared as incompatible.

Since:
5.1

Method Summary
 javax.portlet.ActionRequest getActionRequest(org.apache.jetspeed.portlet.PortletRequest jetspeedRequest)
          Return a wrapper that converts a Jetspeed portlet request to a javax action request.
 javax.portlet.ActionResponse getActionResponse(org.apache.jetspeed.portlet.PortletResponse jetspeedResponse, org.apache.jetspeed.portlet.PortletRequest jetspeedRequest)
          Return a wrapper that converts a Jetspeed portlet response to a javax portlet response.
static APIConverterFactory getInstance()
          Return an instance of this factory
 javax.portlet.PortletContext getPortletContext(org.apache.jetspeed.portlet.PortletContext jetspeeedContext)
          Return a wrapper that converts a Jetspeed portlet context to a javax portlet context.
 javax.portlet.PortletRequestDispatcher getPortletRequestDispatcher(org.apache.jetspeed.portlet.PortletContext jetspeeedContext, java.lang.String path)
          Return a wrapper that converts a Jetspeed portlet context to a javax portlet request dispatcher.
 javax.portlet.PortletSession getPortletSession(org.apache.jetspeed.portlet.PortletSession jetspeeedSession, org.apache.jetspeed.portlet.PortletContext jetspeedContext)
          Return a wrapper that converts a Jetspeed portlet session to a javax portlet session.
 javax.portlet.RenderRequest getRenderRequest(org.apache.jetspeed.portlet.PortletRequest jetspeedRequest)
          Return a wrapper that converts a Jetspeed portlet request to a javax render request.
 javax.portlet.RenderResponse getRenderResponse(org.apache.jetspeed.portlet.PortletResponse jetspeedResponse)
          Return a wrapper that converts a Jetspeed portlet response to a javax render response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static APIConverterFactory getInstance()
Returns an instance of this factory

getRenderRequest

public javax.portlet.RenderRequest getRenderRequest(org.apache.jetspeed.portlet.PortletRequest jetspeedRequest)
Returns a wrapper that converts a Jetspeed portlet request to a javax render request. Some methods on the returned object have no meaningful implementation because they have no equivalent in the Jetspeed API.

The following methods on the returned object are not supported or are not compatible with the JSR 168 standard:

  • isWindowStateAllowed: always returns true
  • isPortletModeAllowed: always returns true
  • getPreferences: throws UnsupportedOperationException
  • getProperty, getProperties, getPropertyNames: return the request headers only, not portal properties
  • getPortalContext: throws UnsupportedOperationException
  • getParameter, getParameterNames, getParameterValues, getParameterMap: no support for navigational state, parameters are not preserved across requests
  • isSecure: always returns false

Parameters:
jetspeedRequest - the Jetspeed request
Returns:
a javax.portlet.ActionRequest

getActionRequest

public javax.portlet.ActionRequest getActionRequest(org.apache.jetspeed.portlet.PortletRequest jetspeedRequest)
Returns a wrapper that converts a Jetspeed portlet request to a javax action request. Some methods on the returned object have no meaningful implementation because they have no equivalent in the Jetspeed API.

The following methods on the returned object are not supported or are not compatible with the JSR 168 standard:

  • isWindowStateAllowed: always returns true
  • isPortletModeAllowed: always returns true
  • getPreferences: throws UnsupportedOperationException
  • getProperty, getProperties, getPropertyNames: return the request headers only, not portal properties
  • getPortalContext: throws UnsupportedOperationException
  • getParameter, getParameterNames, getParameterValues, getParameterMap: are mapped to the parameter handling methods on the jetspeed request, which have a different behavior (namespacing etc.)
  • isSecure: always returns false

Parameters:
jetspeedRequest - the Jetspeed request

getRenderResponse

public javax.portlet.RenderResponse getRenderResponse(org.apache.jetspeed.portlet.PortletResponse jetspeedResponse)
Returns a wrapper that converts a Jetspeed portlet response to a javax render response. Some methods on the returned object have no meaningful implementation because they have no equivalent in the Jetspeed API.

The following methods on the returned object are not supported or are not compatible with the JSR 168 standard:

  • addProperty, setProperty: does nothing
  • createRenderURL, createActionURL: throws UnsupportedOperationException
  • setTitle: does nothing
  • setContentType: does nothing, not allowed in the Jetspeed API
  • getContentType: returns the content type that the portal uses for the response, independent of what has been set before

Parameters:
jetspeedResponse - the Jetspeed response

getActionResponse

public javax.portlet.ActionResponse getActionResponse(org.apache.jetspeed.portlet.PortletResponse jetspeedResponse,
                                                      org.apache.jetspeed.portlet.PortletRequest jetspeedRequest)
Returns a wrapper that converts a Jetspeed portlet response to a javax portlet response. Some methods on the returned object have no meaningful implementation because they have no equivalent in the Jetspeed API.

The following methods on the returned object are not supported or are not compatible with the JSR 168 standard:

  • addProperty, setProperty: does nothing
  • setWindowState: only supported if Jetspeed request has been provided, does nothing otherwise. Only possible during the event phase.
  • setPortletMode: does nothing
  • setRenderParameter, setRenderParameters: does nothing

Parameters:
jetspeedResponse - the Jetspeed response
jetspeedRequest - the Jetspeed request, may be null (only needed for setWindowState)

getPortletSession

public javax.portlet.PortletSession getPortletSession(org.apache.jetspeed.portlet.PortletSession jetspeeedSession,
                                                      org.apache.jetspeed.portlet.PortletContext jetspeedContext)
Returns a wrapper that converts a Jetspeed portlet session to a javax portlet session. Some methods on the returned object have no meaningful implementation because they have no equivalent in the Jetspeed API.

The following methods on the returned object are not supported or are not compatible with the JSR 168 standard:

  • getAttribte, getAttributeNames, setAttribute, removeAttribute: no support for APPLICATION_SCOPE; no values are returned or modified if this argument is given
  • getPortletContext: only supported if Jetspeed context has been provided, throws UnsupportedOperationException otherwise

Parameters:
jetspeedSession - the Jetspeed session
jetspeedContext - the Jetspeed context, may be null (only needed for getPortletContext)

getPortletContext

public javax.portlet.PortletContext getPortletContext(org.apache.jetspeed.portlet.PortletContext jetspeeedContext)
Returns a wrapper that converts a Jetspeed portlet context to a javax portlet context. Some methods on the returned object have no meaningful implementation because they have no equivalent in the Jetspeed API.

The following methods on the returned object are not supported or are not compatible with the JSR 168 standard:

  • getNamedDispatcher: throws UnsupportedOperationException

Parameters:
jetspeedContext - the Jetspeed context

getPortletRequestDispatcher

public javax.portlet.PortletRequestDispatcher getPortletRequestDispatcher(org.apache.jetspeed.portlet.PortletContext jetspeeedContext,
                                                                          java.lang.String path)
Returns a wrapper that converts a Jetspeed portlet context to a javax portlet request dispatcher. the returned request dispatcher can only be used with a request and response that are also wrappers created by this factory. using them with normal javax API objects will result in an IllegalArgumentException.

Parameters:
jetspeedContext - the Jetspeed context
 PREV CLASS   NEXT CLASS
Tree 
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD