|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.portal.generic.GenericWindow
public abstract class GenericWindow
| Field Summary | |
|---|---|
protected static java.util.logging.Logger |
log
|
| Constructor Summary | |
|---|---|
GenericWindow()
|
|
| Method Summary | |
|---|---|
void |
addInitParam(NameValuePair nameValuePair)
|
void |
addInitParam(java.lang.String name,
java.lang.String value)
Add an init-param for the portlet. |
void |
destroy()
|
int |
getBufferSize()
Return a preferred buffer size, may be overridden by the portlet if it calls setBufferSize(). |
java.util.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. |
PortletPreferences |
getDefaultPreferences()
Return the default preferences for the portlet, null if there are no default preferences. |
int |
getExpirationCache()
Time in seconds, 0 disables caching and -1 means never expire. |
java.lang.String |
getInitParameter(java.lang.String name)
|
java.util.Enumeration |
getInitParameterNames()
|
protected java.lang.String |
getNamespace()
|
PortletConfig |
getPortletConfig()
|
PortletContext |
getPortletContext()
|
java.lang.String |
getPortletName()
|
java.util.ArrayList<PreferencesValidator> |
getPreferencesValidators()
Return the preferences validators for the portlet, null if there are no preference validators. |
Renderer |
getRenderer()
|
java.util.ResourceBundle |
getResourceBundle(java.util.Locale locale)
|
java.util.Map<java.lang.String,java.lang.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. |
java.util.Set<java.lang.String> |
getSupportedContentTypes(PortletMode portletMode)
Return the content types supported for the mode, null if all content types are permitted. |
java.util.Set<java.util.Locale> |
getSupportedLocales()
Return the Locales supported, null if all Locales are permitted. |
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. |
void |
handleException(RenderRequest request,
RenderResponse response,
ExceptionEvent event)
Optionally handle an exception by sending some output to the client using the response or by hiding the window. |
PortletMode |
handlePortletModeFailure(PortletRequest request,
PortletMode notAllowed)
This is called when a request arrives requesting a PortletMode that does not pass the isPortletModeAllowed() tests. |
WindowState |
handleWindowStateFailure(PortletRequest request,
WindowState notAllowed)
This is called when a request arrives requesting a WindowState that does not pass the isWindowStateAllowed() tests. |
void |
init(PortletContext portletContext)
|
boolean |
isPortletModeAllowed(PortletRequest request,
PortletMode portletMode)
Return true if the PortletMode is allowed. |
boolean |
isPrivate()
Return true if the contents of the portlet are private. |
boolean |
isWindowStateAllowed(PortletRequest request,
WindowState windowState)
Return true if the WindowState is allowed. |
protected java.lang.Object |
newInstance(java.lang.Class targetClass,
java.lang.String className)
Instantiate a new instance of an object, performing checks for validity. |
abstract void |
processAction(PortletConnection connection)
|
abstract void |
render(PortletConnection connection)
|
void |
setBufferSize(int bufferSize)
0 disables buffering, -1 allows the portal to choose a buffer size, a positive number indicaets a minimum buffer size. |
void |
setErrorPage(java.lang.String errorPage)
Specify a location to forward to if an exception or constraint failure occurs while rendering the portlet. |
void |
setExpirationCache(int expirationCache)
Enable caching of the response and set the expiration time in seconds. |
void |
setNamespace(java.lang.String namespace)
The namespace is used to uniquely identify this usage of the portlet, the default is "" (the empty string). |
void |
setPortletName(java.lang.String portletName)
The default is the namespace. |
void |
setPortletPreferences(GenericPortletPreferences defaultPreferences)
Set the default preferences. |
void |
setPrivate(boolean isPrivate)
If true then the response is private, indicating that it contains information that should only be provided to the current client, default is false. |
void |
setRenderer(Renderer renderer)
A Renderer wraps decorations around the portlet, see AbstractRenderer. |
void |
setRendererClass(java.lang.String className)
An alternative to setRenderer(Renderer), specify the class
name of an object to instantiate |
void |
setResourceBundle(java.lang.String name)
Set a resource bundle name, used to instantiate an instance of ResourceBundleFactory. |
void |
setResourceBundleFactory(ResourceBundleFactory factory)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.util.logging.Logger log
| Constructor Detail |
|---|
public GenericWindow()
| Method Detail |
|---|
public void setNamespace(java.lang.String namespace)
public void setPortletName(java.lang.String portletName)
public void addInitParam(java.lang.String name,
java.lang.String value)
public void addInitParam(NameValuePair nameValuePair)
public void setPortletPreferences(GenericPortletPreferences defaultPreferences)
public void setExpirationCache(int expirationCache)
public void setPrivate(boolean isPrivate)
public void setResourceBundle(java.lang.String name)
public void setResourceBundleFactory(ResourceBundleFactory factory)
public void setRenderer(Renderer renderer)
AbstractRenderer.
public void setRendererClass(java.lang.String className)
setRenderer(Renderer), specify the class
name of an object to instantiate
public void setBufferSize(int bufferSize)
setErrorPage(String) has been used, then
the default is -1.
public void setErrorPage(java.lang.String errorPage)
public void init(PortletContext portletContext)
throws PortletException
PortletException
protected java.lang.Object newInstance(java.lang.Class targetClass,
java.lang.String className)
throws java.lang.IllegalArgumentException
className must be an instance of
targetClass.
targetClass - the class that the instantiated Object should be
compatible with.className - the String name of a class to use when instantiating the
object.
java.lang.IllegalArgumentExceptionprotected java.lang.String getNamespace()
public PortletContext getPortletContext()
public PortletConfig getPortletConfig()
getPortletConfig in interface Windowpublic java.lang.String getPortletName()
public java.lang.String getInitParameter(java.lang.String name)
public java.util.Enumeration getInitParameterNames()
public int getExpirationCache()
getExpirationCache in interface Windowpublic boolean isPrivate()
isPrivate in interface Window
public boolean isWindowStateAllowed(PortletRequest request,
WindowState windowState)
portletRequest.getResponseContentType() can be used
if the allowed portlet modes depends on the mime type of the
response.
This implementation returns true.
isWindowStateAllowed in interface Window
public boolean isPortletModeAllowed(PortletRequest request,
PortletMode portletMode)
portletRequest.getResponseContentType() can be used
if the allowed portlet modes depends on the mime type of the
response.
This implementation returns true.
isPortletModeAllowed in interface Windowpublic java.util.Set<java.lang.String> getSupportedContentTypes(PortletMode portletMode)
getSupportedContentTypes in interface Windowpublic java.util.Set<java.util.Locale> getSupportedLocales()
getSupportedLocales in interface Windowpublic PortletPreferences getDefaultPreferences()
getDefaultPreferences in interface Windowpublic java.util.ArrayList<PreferencesValidator> getPreferencesValidators()
getPreferencesValidators in interface Windowpublic java.util.Map<java.lang.String,java.lang.String> getRoleRefMap()
getRoleRefMap in interface Windowpublic java.util.ArrayList<Constraint> getConstraints()
Constraint that are applied before the
processAction() and render() of the portlet are called, null if there
are no Constraints.
This implementation returns null.
getConstraints in interface Windowpublic Renderer getRenderer()
getRenderer in interface Window
public PortletMode handlePortletModeFailure(PortletRequest request,
PortletMode notAllowed)
handleException to handle
PortletModeException.
This implementation returns PortletMode.VIEW.
handlePortletModeFailure in interface Window
public WindowState handleWindowStateFailure(PortletRequest request,
WindowState notAllowed)
handleException to handle
WindowStateException.
This implementation returns WindowState.NORMAL.
handleWindowStateFailure in interface Window
public void handleConstraintFailure(RenderRequest request,
RenderResponse response,
ConstraintFailureEvent event)
PortletConnection#handleConstraintFailure() is called.
Implementations of this method can change that behaviour by using the
event.setHandled(boolean hideWindow) callback method.
See Window.handleException(RenderRequest, RenderResponse, com.caucho.portal.generic.ExceptionEvent) for more information.
handleConstraintFailure in interface WindowsetErrorPage(String)
public void handleException(RenderRequest request,
RenderResponse response,
ExceptionEvent event)
PortletConnection#handleException()
is called.
Implementations of this method can change that behaviour by using the
event.setHandled(boolean hideWindow) callback method.
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);
}
public void handleException(ExceptionEvent event)
throws PortletException, IOException
{
log.log(Level.WARNING, ex.toString(), ex);
event.setHandled(true);
}
handleException in interface WindowsetErrorPage(String)public java.util.ResourceBundle getResourceBundle(java.util.Locale locale)
public int getBufferSize()
getBufferSize in interface Window
public abstract void processAction(PortletConnection connection)
throws PortletException,
java.io.IOException
PortletException
java.io.IOException
public abstract void render(PortletConnection connection)
throws PortletException,
java.io.IOException
PortletException
java.io.IOExceptionpublic void destroy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||