| com.caucho.portal.generic.Window
All known Subclasses: com.caucho.portal.generic.PortletServlet, com.caucho.portal.generic.GenericWindow,
Window | public interface Window (Code) | | A Window represents the use of a portlet on a page.
The Window interface is the main point of contact between a portal
implementation and the generic portlet codebase.
|
Method Summary | |
public int | getBufferSize() Return a preferred buffer size, may be overridden by the portlet
if it calls setBufferSize(). | public ArrayList<Constraint> | getConstraints() Return a list of
Constraint that are applied before the
processAction() and render() of the portlet are called, null if there
are no Constraints. | public PortletPreferences | getDefaultPreferences() Return the default preferences for the portlet, null if there are no
default preferences. | public int | getExpirationCache() Time in seconds, 0 disables caching and -1 means never expire. | public PortletConfig | getPortletConfig() | public ArrayList<PreferencesValidator> | getPreferencesValidators() Return the preferences validators for the portlet, null if there are no
preference validators. | public Renderer | getRenderer() | public Map<String, String> | getRoleRefMap() Return a map that map's role names used by the portlet to the role names
recognized by the portal, null if the role names used by the portlet
are to be used unchanged. | public Set<String> | getSupportedContentTypes(PortletMode portletMode) Return the content types supported for the mode, null if all content
types are permitted. | public Set<Locale> | getSupportedLocales() Return the Locales supported, null if all Locales are permitted. | public void | handleConstraintFailure(RenderRequest request, RenderResponse response, ConstraintFailureEvent event) Optionally handle a constraint failure by sending some output to the
client using the response or by hiding the window.
When a Portlet fails a Constriant during processAction(), it is stored
until the render stage, and handleConstriantFailure() is called instead of
render().
When a Portlet fails a Constraint during render(),
handleConstriantFailure() is immediately called.
If the implementation of this method does nothing, then the response of
this window is reset() and the failure propagates to the parent window.
If there is no parent window,
PortletConnection.handleConstraintFailure is called.
Implementations of this method can change that behaviour by using the
event.setHandled(boolean hideWindow) callback method. | public void | handleException(RenderRequest renderRequest, RenderResponse renderResponse, ExceptionEvent exceptionEvent) Optionally handle an exception by sending some output to the client
using the response or by hiding the window.
When a Portlet throws an Exception during processAction(), it is stored
until the render stage, and handleException() is called instead of
render().
When a Portlet throws an exception during render(), the handleException()
is immediately called.
If the implementation of this method does nothing, then the repsonse of
this window is reset() and the exception propagates to the parent window.
If there is no parent window,
PortletConnection.handleException is called.
Implementations of this method can change that behaviour by using the
event.setHandled(boolean hideWindow) callback method. | public PortletMode | handlePortletModeFailure(PortletRequest request, PortletMode notAllowed) This is called when a request arrives requesting a PortletMode
that does not pass the isPortletModeAllowed() tests.
It gives the Window an opportunity to return a PortletMode
that can be used. | public WindowState | handleWindowStateFailure(PortletRequest request, WindowState notAllowed) This is called when a request arrives requesting a WindowState
that does not pass the isWindowStateAllowed() tests.
It gives the Window an opportunity to return a WindowState
that can be used. | public boolean | isPortletModeAllowed(PortletRequest request, PortletMode portletMode) Return true if the PortletMode is allowed. | public boolean | isPrivate() Return true if the contents of the portlet are private. | public boolean | isWindowStateAllowed(PortletRequest request, WindowState windowState) Return true if the WindowState is allowed. |
getBufferSize | public int getBufferSize()(Code) | | Return a preferred buffer size, may be overridden by the portlet
if it calls setBufferSize().
A value of 0 disables buffering for the portlet.
A value of -1 allows the portal to use a default buffer size.
|
getConstraints | public ArrayList<Constraint> getConstraints()(Code) | | Return a list of
Constraint that are applied before the
processAction() and render() of the portlet are called, null if there
are no Constraints.
|
getDefaultPreferences | public PortletPreferences getDefaultPreferences()(Code) | | Return the default preferences for the portlet, null if there are no
default preferences.
|
getExpirationCache | public int getExpirationCache()(Code) | | Time in seconds, 0 disables caching and -1 means never expire.
|
getPortletConfig | public PortletConfig getPortletConfig()(Code) | | |
getPreferencesValidators | public ArrayList<PreferencesValidator> getPreferencesValidators()(Code) | | Return the preferences validators for the portlet, null if there are no
preference validators.
|
getRoleRefMap | public Map<String, String> getRoleRefMap()(Code) | | Return a map that map's role names used by the portlet to the role names
recognized by the portal, null if the role names used by the portlet
are to be used unchanged.
|
getSupportedContentTypes | public Set<String> getSupportedContentTypes(PortletMode portletMode)(Code) | | Return the content types supported for the mode, null if all content
types are permitted.
|
getSupportedLocales | public Set<Locale> getSupportedLocales()(Code) | | Return the Locales supported, null if all Locales are permitted.
|
handleConstraintFailure | public void handleConstraintFailure(RenderRequest request, RenderResponse response, ConstraintFailureEvent event) throws IOException, PortletException(Code) | | Optionally handle a constraint failure by sending some output to the
client using the response or by hiding the window.
When a Portlet fails a Constriant during processAction(), it is stored
until the render stage, and handleConstriantFailure() is called instead of
render().
When a Portlet fails a Constraint during render(),
handleConstriantFailure() is immediately called.
If the implementation of this method does nothing, then the response of
this window is reset() and the failure propagates to the parent window.
If there is no parent window,
PortletConnection.handleConstraintFailure is called.
Implementations of this method can change that behaviour by using the
event.setHandled(boolean hideWindow) callback method.
See
Window.handleException for more information.
|
handleException | public void handleException(RenderRequest renderRequest, RenderResponse renderResponse, ExceptionEvent exceptionEvent) throws IOException, PortletException(Code) | | Optionally handle an exception by sending some output to the client
using the response or by hiding the window.
When a Portlet throws an Exception during processAction(), it is stored
until the render stage, and handleException() is called instead of
render().
When a Portlet throws an exception during render(), the handleException()
is immediately called.
If the implementation of this method does nothing, then the repsonse of
this window is reset() and the exception propagates to the parent window.
If there is no parent window,
PortletConnection.handleException is called.
Implementations of this method can change that behaviour by using the
event.setHandled(boolean hideWindow) callback method.
exceptionEvent.setHandled(false)
If handleException calls exceptionEvent.setHandled(false) then
the content that the portlet has written is kept, and the request
continues. Implementations use this when they have written some
contents to the portlet that should be visible to the user.
public void handleException(RenderRequest request, RenderResponse response, ExceptionEvent event)
throws PortletException, IOException
{
if (event.getException() instanceof UnavailableException) {
PrintWriter out = response.getWriter();
response.setContentType("text/html");
out.println("This service is currently unavailable.");
event.setHandled(false);
}
}
If an implementation is handling an exception that can occur after the
Portlet has written some content already, it should call response.reset()
before it writes anything to the response.
public void handleException(RenderRequest request, RenderResponse response, ExceptionEvent event)
throws PortletException, IOException
{
response.reset();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
printFancyExceptionMessage(event.getException());
event.setHandled(false);
}
exceptionEvent.setHandled(true)
If handleException calls exceptionEvent.setHandled(true) then
the output is reset(), including any output from a Renderer, and
the request continues. The effect of this call is to make the window
invisible, no content for this window is shown but other windows on
the page will be shown. Implementations use this when they have dealt
with the exception in some way and wish to hide the exception from the
user.
public void handleException(ExceptionEvent event)
throws PortletException, IOException
{
log.log(Level.WARNING, ex.toString(), ex);
event.setHandled(true);
}
|
handlePortletModeFailure | public PortletMode handlePortletModeFailure(PortletRequest request, PortletMode notAllowed)(Code) | | This is called when a request arrives requesting a PortletMode
that does not pass the isPortletModeAllowed() tests.
It gives the Window an opportunity to return a PortletMode
that can be used. If the returned mode is also not allowed, a
PortletModeException occurs.
Implementations can use
handleException to handle
PortletModeException.
a new PortletMode to try, or null to cause an exception. |
handleWindowStateFailure | public WindowState handleWindowStateFailure(PortletRequest request, WindowState notAllowed)(Code) | | This is called when a request arrives requesting a WindowState
that does not pass the isWindowStateAllowed() tests.
It gives the Window an opportunity to return a WindowState
that can be used. If the returned window state is also not allowed, a
WindowStateException occurs.
Implementations can use
handleException to handle
WindowStateException.
a new WindowState to try, or null to cause an exception, |
isPortletModeAllowed | public boolean isPortletModeAllowed(PortletRequest request, PortletMode portletMode)(Code) | | Return true if the PortletMode is allowed.
portletRequest.getResponseContentType() can be used
if the allowed portlet modes depends on the mime type of the
response.
|
isPrivate | public boolean isPrivate()(Code) | | Return true if the contents of the portlet are private.
The portlet specification states that "cached content must not be shared
across different user clients displaying the same portlet".
If a portal implementation supports caching, then a return value of false
will allow the portal to share the cached content across different user
clients.
|
isWindowStateAllowed | public boolean isWindowStateAllowed(PortletRequest request, WindowState windowState)(Code) | | Return true if the WindowState is allowed.
portletRequest.getResponseContentType() can be used
if the allowed portlet modes depends on the mime type of the
response.
|
|
|