portlet-api-2.0-spec-1.0/ 0000755 0001750 0001750 00000000000 11354474716 014747 5 ustar drazzib drazzib portlet-api-2.0-spec-1.0/pom.xml 0000644 0001750 0001750 00000007461 11202413200 016241 0 ustar drazzib drazzib
PreferencesValidator
allows to validate the set of
* preferences of the associated portlet just before they are
* stored in the persistent store.
*
* The portlet container invokes the validate
method as
* part of the invocation of the store
method of the
* PortletPreferences
.
*/
public interface PreferencesValidator
{
/**
* If the preferences values are successfully validated the call to this method
* must finish gracefully. Otherwise it must throw a ValidatorException
.
*
* @param preferences preferences to validate
*
* @throws ValidatorException if the given preferences contains invalid
* settings
*
*/
public void validate(PortletPreferences preferences)
throws ValidatorException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletConfig.java 0000644 0001750 0001750 00000023406 11201125563 025614 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The PortletConfig
interface provides the portlet with
* its configuration. The configuration holds information about the
* portlet that is valid for all users. The configuration is retrieved
* from the portlet definition in the deployment descriptor.
* The portlet can only read the configuration data.
*
* The configuration information contains the portlet name, the portlet * initialization parameters, the portlet resource bundle and the portlet * application context. * * @see Portlet */ public interface PortletConfig { /** * Returns the name of the portlet. *
* The name may be provided via server administration, assigned in the
* portlet application deployment descriptor with the
* Public render parameters are defined in the portlet deployment descriptor
* with the
* If no default namespace is defined in the portlet deployment
* descriptor this methods returns the XML default namespace
*
* Publishing events are defined in the portlet deployment descriptor
* with the
* Note that this call does not return any events published that have not been
* declared in the deployment descriptor as supported.
*
* If the event was defined using the
* Processing events are defined in the portlet deployment descriptor
* with the
* If the event was defined using the
* Supported locales are defined in the portlet deployment descriptor
* with the
* The portlet can set container runtime
* options in the
* The map returned from this method will provide the subset the
* portlet container supports of the options the portlet has specified
* in the
* The map will contain name of the runtime option as key of type String
* and the runtime options as values of type String array (
* A portlet is a Java technology based web component, managed by a portlet container,
* that processes requests and generates dynamic content. Portlets provide a presentation
* layer to Information Systems.
*
* Portlets generate fragments of markup (e.g. HTML, XHTML, WML). A portal combines markup
* fragments generated by different portlets into a portal page.
*
* A portlet container manages the lifecyle of portlets. It also provides the required runtime environment.
*
* Portlets are bundled in Portlet Applications as web applications using the WAR file format.
* A portlet application consists of two deployment descriptors: one to specify
* the web application resources (web.xml) and one to specify the portlet resources
* (portlet.xml). The portlet.xml must follow the schema defined by the
* http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd namespace.
*
*/
package javax.portlet;
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletModeException.java 0000644 0001750 0001750 00000006146 11201125563 027154 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The There is one context per "portlet application" per Java Virtual Machine. (A
* "portlet application" is a collection of portlets, servlets, and content installed
* under a specific subset of the server URL namespace, such as
* Attributes stored in the context are global for all users and all
* components in the portlet application.
*
* In the case of a web
* application marked "distributed" in its deployment descriptor, there will
* be one context instance for each virtual machine. In this situation, the
* context cannot be used as a location to share global information (because
* the information is not truly global). Use an external resource, such as
* a database to achieve sharing on a global scope.
*/
public interface PortletContext
{
/**
* Returns the name and version of the portlet container in which the
* portlet is running.
*
*
* The form of the returned string is The pathname must begin with a slash ( This method returns Servlets (and also JSP pages) may be given names via server
* administration or via a web application deployment descriptor.
*
* This method returns
* In order to access protected resources the path has to be prefixed with
* The real path returned will be in a form
* appropriate to the computer and operating system on
* which the portlet container is running, including the
* proper path separators. This method returns This method allows the portlet container to make a resource
* available to portlets from any source. Resources
* can be located on a local or remote
* file system, in a database, or in a The portlet container must implement the URL handlers
* and This method returns Some containers may allow writing to the URL returned by
* this method using the methods of the URL class.
*
* The resource content is returned directly, so be aware that
* requesting a This method has a different purpose than
* The attribute is returned as a
* This method mapps to the
* This method is mapped to the
* If a null value is passed, the effect is the same as calling
* Attribute names should follow the same convention as package
* names. The Java Portlet API specification reserves names
* matching
* If the user-attribute is not defined for the current user it
* will not show up in the Map.
*
* The value is
* The value is
* Note: these are only available in the Java SE 5.0 supported version
* of the API.
*
* @since 2.0
*/
public enum P3PUserInfos {
USER_BDATE_YMD_YEAR("user.bdate.ymd.year"), USER_BDATE_YMD_MONTH("user.bdate.ymd.month"),
USER_BDATE_YMD_DAY("user.bdate.ymd.day"), USER_BDATE_HMS_HOUR("user.bdate.hms.hour"),
USER_BDATE_HMS_MINUTE("user.bdate.hms.minute"), USER_BDATE_HMS_SECOND("user.bdate.hms.second"),
USER_BDATE_FRACTIONSECOND("user.bdate.fractionsecond"), USER_BDATE_TIMEZONE("user.bdate.timezone"),
USER_GENDER("user.gender"), USER_EMPLOYER("user.employer"),
USER_DEPARTMENT("user.department"), USER_JOBTITLE("user.jobtitle"),
USER_NAME_PREFIX("user.name.prefix"), USER_NAME_GIVEN("user.name.given"),
USER_NAME_FAMILY("user.name.family"), USER_NAME_MIDDLE("user.name.middle"),
USER_NAME_SUFFIX("user.name.suffix"), USER_NAME_NICKNAME("user.name.nickName"),
USER_LOGIN_ID("user.login.id"),
USER_HOMEINFO_POSTAL_NAME("user.home-info.postal.name"),
USER_HOMEINFO_POSTAL_STREET("user.home-info.postal.street"),
USER_HOMEINFO_POSTAL_CITY("user.home-info.postal.city"),
USER_HOMEINFO_POSTAL_STATEPROV("user.home-info.postal.stateprov"),
USER_HOMEINFO_POSTAL_POSTALCODE("user.home-info.postal.postalcode"),
USER_HOMEINFO_POSTAL_COUNTRY("user.home-info.postal.country"),
USER_HOMEINFO_POSTAL_ORGANIZATION("user.home-info.postal.organization"),
USER_HOMEINFO_TELECOM_TELEPHONE_INTCODE("user.home-info.telecom.telephone.intcode"),
USER_HOMEINFO_TELECOM_TELEPHONE_LOCCODE("user.home-info.telecom.telephone.loccode"),
USER_HOMEINFO_TELECOM_TELEPHONE_NUMBER("user.home-info.telecom.telephone.number"),
USER_HOMEINFO_TELECOM_TELEPHONE_EXT("user.home-info.telecom.telephone.ext"),
USER_HOMEINFO_TELECOM_TELEPHONE_COMMENT("user.home-info.telecom.telephone.comment"),
USER_HOMEINFO_TELECOM_FAX_INTCODE("user.home-info.telecom.fax.intcode"),
USER_HOMEINFO_TELECOM_FAX_LOCCODE("user.home-info.telecom.fax.loccode"),
USER_HOMEINFO_TELECOM_FAX_NUMBER("user.home-info.telecom.fax.number"),
USER_HOMEINFO_TELECOM_FAX_EXT("user.home-info.telecom.fax.ext"),
USER_HOMEINFO_TELECOM_FAX_COMMENT("user.home-info.telecom.fax.comment"),
USER_HOMEINFO_TELECOM_MOBILE_INTCODE("user.home-info.telecom.mobile.intcode"),
USER_HOMEINFO_TELECOM_MOBILE_LOCCODE("user.home-info.telecom.mobile.loccode"),
USER_HOMEINFO_TELECOM_MOBILE_NUMBER("user.home-info.telecom.mobile.number"),
USER_HOMEINFO_TELECOM_MOBILE_EXT("user.home-info.telecom.mobile.ext"),
USER_HOMEINFO_TELECOM_MOBILE_COMMENT("user.home-info.telecom.mobile.comment"),
USER_HOMEINFO_TELECOM_PAGER_INTCODE("user.home-info.telecom.pager.intcode"),
USER_HOMEINFO_TELECOM_PAGER_LOCCODE("user.home-info.telecom.pager.loccode"),
USER_HOMEINFO_TELECOM_PAGER_NUMBER("user.home-info.telecom.pager.number"),
USER_HOMEINFO_TELECOM_PAGER_EXT("user.home-info.telecom.pager.ext"),
USER_HOMEINFO_TELECOM_PAGER_COMMENT("user.home-info.telecom.pager.comment"),
USER_HOMEINFO_ONLINE_EMAIL("user.home-info.online.email"),
USER_HOMEINFO_ONLINE_URI("user.home-info.online.uri"),
USER_BUSINESSINFO_POSTAL_NAME("user.business-info.postal.name"),
USER_BUSINESSINFO_POSTAL_STREET("user.business-info.postal.street"),
USER_BUSINESSINFO_POSTAL_CITY("user.business-info.postal.city"),
USER_BUSINESSINFO_POSTAL_STATEPROV("user.business-info.postal.stateprov"),
USER_BUSINESSINFO_POSTAL_POSTALCODE("user.business-info.postal.postalcode"),
USER_BUSINESSINFO_POSTAL_COUNTRY("user.business-info.postal.country"),
USER_BUSINESSINFO_POSTAL_ORGANIZATION("user.business-info.postal.organization"),
USER_BUSINESSINFO_TELECOM_TELEPHONE_INTCODE("user.business-info.telecom.telephone.intcode"),
USER_BUSINESSINFO_TELECOM_TELEPHONE_LOCCODE("user.business-info.telecom.telephone.loccode"),
USER_BUSINESSINFO_TELECOM_TELEPHONE_NUMBER("user.business-info.telecom.telephone.number"),
USER_BUSINESSINFO_TELECOM_TELEPHONE_EXT("user.business-info.telecom.telephone.ext"),
USER_BUSINESSINFO_TELECOM_TELEPHONE_COMMENT("user.business-info.telecom.telephone.comment"),
USER_BUSINESSINFO_TELECOM_FAX_INTCODE("user.business-info.telecom.fax.intcode"),
USER_BUSINESSINFO_TELECOM_FAX_LOCCODE("user.business-info.telecom.fax.loccode"),
USER_BUSINESSINFO_TELECOM_FAX_NUMBER("user.business-info.telecom.fax.number"),
USER_BUSINESSINFO_TELECOM_FAX_EXT("user.business-info.telecom.fax.ext"),
USER_BUSINESSINFO_TELECOM_FAX_COMMENT("user.business-info.telecom.fax.comment"),
USER_BUSINESSINFO_TELECOM_MOBILE_INTCODE("user.business-info.telecom.mobile.intcode"),
USER_BUSINESSINFO_TELECOM_MOBILE_LOCCODE("user.business-info.telecom.mobile.loccode"),
USER_BUSINESSINFO_TELECOM_MOBILE_NUMBER("user.business-info.telecom.mobile.number"),
USER_BUSINESSINFO_TELECOM_MOBILE_EXT("user.business-info.telecom.mobile.ext"),
USER_BUSINESSINFO_TELECOM_MOBILE_COMMENT("user.business-info.telecom.mobile.comment"),
USER_BUSINESSINFO_TELECOM_PAGER_INTCODE("user.business-info.telecom.pager.intcode"),
USER_BUSINESSINFO_TELECOM_PAGER_LOCCODE("user.business-info.telecom.pager.loccode"),
USER_BUSINESSINFO_TELECOM_PAGER_NUMBER("user.business-info.telecom.pager.number"),
USER_BUSINESSINFO_TELECOM_PAGER_EXT("user.business-info.telecom.pager.ext"),
USER_BUSINESSINFO_TELECOM_PAGER_COMMENT("user.business-info.telecom.pager.comment"),
USER_BUSINESSINFO_ONLINE_EMAIL("user.business-info.online.email"),
USER_BUSINESSINFO_ONLINE_URI("user.business-info.online.uri");
P3PUserInfos(String value) {this.value = value; }
private final String value;
public String toString() {return value;}
}
/**
* String identifier for the portlet action lifecycle phase. In this
* phase the portlet request and response are from type
*
* The value of the constant is
* The value of the constant is
* The value of the constant is
* The value of the constant is
* Valid values are: ACTION_PHASE, EVENT_PHASE, RENDER_PHASE,
* RESOURCE_SERVING_PHASE.
*
* The value of the constant is
* Non-streaming portals will not set this attribute and thus
* the portlet should set headers, portlet title and produce
* its markup in a single render request.
*
* The value of the constant is
* The value of the constant is
* The value of the constant is
* The value is
* Creating a new portlet session will result in creating
* a new
* If the given flag is
* Creating a new portlet session will result in creating
* a new
* A portlet can access portal/portlet-container specific properties
* through this method and, if available, the
* headers of the HTTP client request.
*
* This method should only be used if the
* property has only one value. If the property might have
* more than one value, use {@link #getProperties}.
*
* If this method is used with a multivalued
* parameter, the value returned is equal to the first value
* in the Enumeration returned by
* If the request did not include any properties
* of the specified name, this method returns an empty
*
* To encode a URL the {@link PortletResponse#encodeURL} method must be used.
*
* @return a
* Attribute names should follow the same conventions as package
* names. This specification reserves names matching
* In a distributed portlet web application the
* Only parameters targeted to the current portlet are accessible.
*
* This method should only be used if the
* parameter has only one value. If the parameter might have
* more than one value, use {@link #getParameterValues}.
*
* If this method is used with a multivalued
* parameter, the value returned is equal to the first value
* in the array returned by
* Only parameters targeted to the current portlet are returned.
*
*
* @return an
* If the parameter has a single value, the array has a length
* of 1.
*
*
* @param name a
* The values in the returned
* If no parameters exist this method returns an empty Attribute names should follow the same conventions as
* package names. Names beginning with Attribute names should follow the same conventions as
* package names. Names beginning with
* The following restrictions apply:
*
* The following restrictions apply:
*
* This ID is the same that is used by the portlet container for
* scoping the portlet-scope session attributes.
*
* @since 2.0
* @return the portlet window ID
*/
public String getWindowID();
/**
* Returns an array containing all of the Cookie properties.
*
* This method returns
* The values in the returned
* If no private parameters exist this method returns an empty
* The values in the returned
* If no public parameters exist this method returns an empty
* The included servlet cannot set or change the response status code or set
* headers; any attempt to make a change is ignored.
*
* This method is kept in order to provide backward compatibility with
* version 1.0. Please use {@link #include(PortletRequest, PortletResponse)} instead
* of this method.
*
* @param request
* a {@link RenderRequest} object that contains the client
* request. Must be either the render request passed to the
* portlet in
* The included servlet cannot set or change the response status code or set
* headers; any attempt to make a change is ignored.
*
*
* @param request
* a {@link PortletRequest} object that contains the portlet
* request. Must be either the original request passed to the
* portlet or a wrapped version of this request.
*
* @param response
* a {@link PortletResponse} object that contains the portlet
* response. Must be either the portlet response passed to the
* portlet or a wrapped version of this response.
*
* @exception PortletException
* if the included resource throws a ServletException, or
* other exceptions that are not Runtime- or IOExceptions.
*
* @exception java.io.IOException
* if the included resource throws this exception
*
* @since 2.0
*/
public void include(PortletRequest request, PortletResponse response)
throws PortletException, java.io.IOException;
/**
* Forwards a portlet request from a portlet to another resource (servlet, JSP file, or HTML file)
* on the server. This method allows the portlet to do preliminary processing of a
* request and another resource to generate the response.
*
* The
* The request and response parameters must be either the same objects as were passed to
* the calling portlet or be wrapped versions of these.
*
* @param request a request object that represents the request to the
* portlet
* @param response a reponse object that contains the portlet response
*
* @exception PortletException
* if the included resource throws a ServletException, or
* other exceptions that are not Runtime- or IOExceptions.
* @exception java.io.IOException
* if the included resource throws this exception
* @exception java.lang.IllegalStateException
* if the response was already committed
* @since 2.0
*/
public void forward(PortletRequest request, PortletResponse response)
throws PortletException, java.io.IOException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletPreferences.java 0000644 0001750 0001750 00000025415 11201125563 026652 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The
* There are two different types of preferences:
*
* Changes are persisted when the
* Modifiable preferences can be changed by the
* portlet in any standard portlet mode (
* Read-only preferences cannot be changed by the
* portlet in any standard portlet mode, but inside of custom modes,
* like the
* Preferences are read-only, if they are defined in the
* deployment descriptor with
* Note that even if this call returns Returns the specified default if there is no value
* associated with the key, or if the backing store is inaccessible.
* A If the implementation supports stored defaults and such a
* default exists and is accessible, it is used in favor of the
* specified default.
*
*
* @param key key for which associated value is to be returned.
* @param def the value to be returned in the event that this
* preference node has no value associated with
* The key cannot be
* If the same key contained already a
* The key cannot be
* If the same key contained already a
* The values in the returned
* If no preferences exist this method returns an empty
* If this implementation supports stored defaults, and there is such
* a default for the specified preference, the given key will be
* reset to the stored default.
*
* If there is no default available the key will be removed.
*
* @param key to reset
*
* @exception java.lang.IllegalArgumentException if key is
* If this call returns successful, all changes are made
* persistent. If this call fails, no changes are made
* in the persistent store. This call is an atomic operation
* regardless of how many preference attributes have been modified.
*
* All changes made to preferences not followed by a call
* to the
* If a validator is defined for this preferences in the
* deployment descriptor, this validator is called before
* the actual store is performed to check whether the given
* preferences are valid. If this check fails a
*
* For HTTP POST data of type application/x-www-form-urlencoded
* this method throws an
* This method only sets the character set for the Reader that the
* {@link #getReader} method returns.
*
* @param enc a
* For HTTP POST data of type application/x-www-form-urlencoded
* this method throws an
* This call returns the same value as the
*
* If the expiration value is set to 0, caching is disabled for this
* portlet; if the value is set to -1, the cache does not expire.
*
* This call is equivalent to calling
*
* Public cache scope indicates that the cache entry can be shared across
* users. Non-public, or private cache scope indicates that the cache entry
* must not be shared across users.
*
* This call is equivalent to calling
*
* Public cache scope indicates that the cache entry can be shared across
* users. Non-public, or private cache scope indicates that the cache entry
* must not be shared across users.
*
* This call is equivalent to calling
*
* This call is equivalent to calling
*
* This call is equivalent to calling
*
* Setting the ETag to
* This call is equivalent to calling
*
* This call is equivalent to calling
*
* This method replaces all parameters with the given key.
*
* The
* A portlet container may prefix the attribute names internally
* in order to preserve a unique namespace for the portlet.
*
* A parameter value of
* This method replaces all parameters with the given key.
*
* The
* A portlet container may prefix the attribute names internally
* in order to preserve a unique namespace for the portlet.
*
* @param name
* the parameter name
* @param values
* the parameter values
*
* @exception java.lang.IllegalArgumentException
* if name is
* All previously set parameters are cleared.
*
* The
* A portlet container may prefix the attribute names internally,
* in order to preserve a unique namespace for the portlet.
*
* @param parameters Map containing parameter names for
* the render phase as
* keys and parameter values as map
* values. The keys in the parameter
* map must be of type String. The values
* in the parameter map must be of type
* String array (
* Secure set to
* The returned URL is not XML escaped.
*
* For writing URLs to an output stream the {@link #write(java.io.Writer)} or
* {@link #write(java.io.Writer, boolean)} method should be used as these are
* more efficient.
*
* @return the encoded URL as a string
*/
public String toString ();
/**
* Returns a
* The values in the returned
* If no parameters exist this method returns an empty
* Note that the URL written to the output stream may not be a valid URL, as it may
* be rewritten by the portal/portlet-container before returning the
* markup to the client.
*
* The URL written to the output stream is always XML escaped. For writing
* non-escaped URLs use {@link #write(java.io.Writer, boolean)}.
*
* @param out the writer to write the portlet URL to
* @throws java.io.IOException if an I/O error occured while writing the URL
*
* @since 2.0
*/
public void write(java.io.Writer out) throws java.io.IOException;
/**
* Writes the portlet URL to the output stream using the provided writer.
* If the parameter escapeXML is set to true the URL will be escaped to be
* valid XML characters, i.e. <, >, &, ', " will get converted
* into their corresponding character entity codes (< to &<, > to &>,
* & to &&, ' to &', " to &").
* If escapeXML is set to false no escaping will be done.
*
* Note that the URL written to the output stream may not be a valid URL, as it may
* be rewritten by the portal/portlet-container before returning the
* markup to the client.
*
* @param out the writer to write the portlet URL to
* @param escapeXML denotes if the URL should be XML escaped before written to the output
* stream or not
* @throws java.io.IOException if an I/O error occurred while writing the URL
*
* @since 2.0
*/
public void write(java.io.Writer out, boolean escapeXML) throws java.io.IOException;
/**
* Adds a String property to an existing key on the URL.
*
* This method allows URL properties to have multiple values.
*
* Properties can be used by portlets to provide vendor specific information
* to the URL.
*
* @param key
* the key of the property
* @param value
* the value of the property
*
* @exception java.lang.IllegalArgumentException
* if key is
* Properties can be used by portlets to provide vendor specific information
* to the URL.
*
* This method resets all properties previously added with the same key.
*
* @param key
* the key of the property
* @param value
* the value of the property
*
* @exception java.lang.IllegalArgumentException
* if key is
* The collection of failed keys may contain all failed keys, only the
* first key that failed validation, or may be
* The Collection of failed keys may contain all failed keys, only the
* first key that failed validation, or may be
* The Collection of failed keys may contain all failed keys, only the
* first key that failed validation, or may be
* The Enumeration of failed keys may contain all failed keys, only the
* first key that failed validation, or an empty
*
* Events are part of the action processing and must
* be finished before the rendering phase can start.
* Portlets can receive events issued by other portlets or
* portlet container defined events.
*
* Portlets should declare the events it would like to receive
* via the
* The event model is a loosely coupled model where the wiring between
* published and receiving events is done at the portal / portlet container
* level.
*
* @since 2.0
*/
public interface EventPortlet {
/**
* Called by the portlet container requesting the portlet
* to process a specific event.
*
* @param request the event request
* @param response the event response
* @exception PortletException
* if the portlet has problems fulfilling the
* request
* @exception UnavailableException
* if the portlet is unavailable to process the event at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception IOException
* if the streaming causes an I/O problem
*/
public void processEvent (EventRequest request, EventResponse response)
throws PortletException, java.io.IOException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/RenderResponse.java 0000644 0001750 0001750 00000007305 11201125563 025773 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The
* The value can be a text String
*
* @param title
* portlet title as text String or resource URI
*/
public void setTitle(String title);
/**
* This method allows the portlet to tell the portal the next possible
* portlet modes that the make sense from the portlet point of view.
*
* If set, the portal should honor these enumeration of portlet modes and
* only provide the end user with choices to the provided portlet modes or a
* subset of these modes based on access control considerations.
*
* If the portlet does not set any next possible portlet modes the default
* is that all portlet modes that the portlet has defined supporting in the
* portlet deployment descriptor are meaningful new portlet modes.
*
* @param portletModes
*
* Calling
* The portlet container will ignore any character encoding
* specified as part of the content type for
* This method only accepts an absolute URL (e.g.
*
* The sendRedirect method can not be invoked after any of the
* following methods of the ActionResponse interface has been called:
*
* This method only accepts an absolute URL (e.g.
*
* The portlet container will attach a render URL with the currently set portlet mode, window state
* and render parameters on the
* New values for
*
* A PortletURL is created through the
* There are two types of PortletURLs:
*
* The string representation of a PortletURL does not need to be a valid
* URL at the time the portlet is generating its content. It may contain
* special tokens that will be converted to a valid URL, by the portal,
* before the content is returned to the client.
*/
public interface PortletURL extends BaseURL
{
/**
* Indicates the window state the portlet should be in, if this
* portlet URL triggers a request.
*
* A URL can not have more than one window state attached to it.
* If more than one window state is set only the last one set
* is attached to the URL.
*
* @param windowState
* the portlet window state
*
* @exception WindowStateException
* if the portlet cannot switch to this state,
* because the portal does not support this state, the portlet has not
* declared in its deployment descriptor that it supports this state, or the current
* user is not allowed to switch to this state.
* The
* A URL can not have more than one portlet mode attached to it.
* If more than one portlet mode is set only the last one set
* is attached to the URL.
*
* @param portletMode
* the portlet mode
*
* @exception PortletModeException
* if the portlet cannot switch to this mode,
* because the portal does not support this mode, the portlet has not
* declared in its deployment descriptor that it supports this mode for the current markup,
* or the current user is not allowed to switch to this mode.
* The
* Note that calling this method on a PortletURL of type
* Action URL does not have any effect.
*
* @param name a
* The difference between the
* A portlet can set HTTP headers for the response via the setProperty or
* addProperty call in the
* The portlet container creates a
* This method can be called repeatedly to change the character encoding.
* This method has no effect if it is called after getWriter has been called
* or after the response has been committed.
*
* @param charset a String specifying only the character set defined by
* IANA Character Sets (http://www.iana.org/assignments/character-sets)
*/
public void setCharacterEncoding(java.lang.String charset);
/**
* Sets the length of the content body in the response.
*
* @param len an integer specifying the length of the content being returned
*/
public void setContentLength(int len);
/**
* @throws java.lang.IllegalStateException
* if the cacheability level of the resource URL
* triggering this
* It provides an abstract class to be subclassed to create portlets. A subclass
* of
* Normally there is no need to override the render or the doDispatch methods.
* Render handles render requests setting the title of the portlet in the
* response and invoking doDispatch. doDispatch dispatches the request to one of
* the doView, doEdit or doHelp method depending on the portlet mode indicated
* in the request.
*
* Portlets typically run on multithreaded servers, so please note that a
* portlet must handle concurrent requests and be careful to synchronize access
* to shared resources. Shared resources include in-memory data such as instance
* or class variables and external objects such as files, database connections,
* and network connections.
*/
public abstract class GenericPortlet implements Portlet, PortletConfig, EventPortlet, ResourceServingPortlet {
private transient PortletConfig config;
private transient Map
* The default implementation stores the
* The portlet container calls the
* The portlet container cannot place the portlet into service if the
*
* Instead of overriding {@link #init(PortletConfig)}, simply override this
* method and it will be called by
*
* The default implementation tries to dispatch to a method
* annotated with
* It also evaluates the
* The default implementation gets the title from the ResourceBundle of the
* PortletConfig of the portlet. The title is retrieved using the
* 'javax.portlet.title' resource name.
*
* Portlets can overwrite this method to provide dynamic titles (e.g. based
* on locale, client, and session information). Examples are:
*
* If the window state of this portlet is
* For handling custom portlet modes the portlet should either use the
*
* The default implementation throws an exception.
*
* @param request
* the portlet request
* @param response
* the render response
*
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this
* time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of
* security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*
*/
protected void doView(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException {
throw new PortletException("doView method not implemented");
}
/**
* Helper method to serve up the
* The default implementation throws an exception.
*
* @param request
* the portlet request
* @param response
* the render response
*
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this
* time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of
* security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*
*/
protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException {
throw new PortletException("doEdit method not implemented");
}
/**
* Helper method to serve up the
* The default implementation throws an exception.
*
* @param request
* the portlet request
* @param response
* the render response
*
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this
* time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of
* security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*/
protected void doHelp(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException {
throw new PortletException("doHelp method not implemented");
}
/**
* Returns the PortletConfig object of this portlet.
*
* @return the PortletConfig object of this portlet
*/
public PortletConfig getPortletConfig() {
return config;
}
/**
* Called by the portlet container to indicate to a portlet that the portlet
* is being taken out of service.
*
* The default implementation does nothing.
*
*/
public void destroy() {
// do nothing
}
// -------------------------------------------------------------------------
// implement PortletConfig
// -------------------------------------------------------------------------
/**
* Returns the name of this portlet.
*
* @return the portlet name
*
* @see PortletConfig#getPortletName()
*/
public String getPortletName() {
if (config == null)
throw new java.lang.IllegalStateException(
"Config is null, please ensure that your init(config) method calls super.init(config)");
return config.getPortletName();
}
/**
* Returns the
* The default implemention of this method is to call a
* RequestDispatcher.foward with the ResourceID of the ResourceRequest.
*
* If no ResourceID is set on the resource URL the default implementation
* does nothing.
*
* @since 2.0
*/
public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
if (request.getResourceID() != null) {
PortletRequestDispatcher rd = getPortletConfig().getPortletContext().getRequestDispatcher(
request.getResourceID());
if (rd != null)
rd.forward(request, response);
}
}
/**
* The default implementation tries to dispatch to a method
* annotated with
* The portlet should override this method and set its response header using
* this method in order to ensure that they are set before anything is
* written to the output stream.
*
* The default implemention of this method is emtpy.
*
* @param request the render request
* @param response the render response
* @since 2.0
*/
protected void doHeaders(RenderRequest request, RenderResponse response) {
return;
}
/**
* Used by the render method to set the next possible portlet modes.
*
* The portlet should override this method and set the next possible portlet
* modes using this method in order to ensure that they are set before
* anything is written to the output stream.
*
* The default implemention of this method returns
* If no default namespace is defined in the portlet deployment descriptor
* this methods returns the XML default namespace
*
* This class defines a standard set of the most basic portlet window states.
* Additional window states may be defined by calling the constructor of
* this class. If a portal/portlet-container does not support a
* custom window state defined in the portlet application deployment descriptor,
* the custom window state will be ignored by the portal/portlet container.
*/
public class WindowState
{
/**
* The
* The string value for this state is
* The string value for this state is
* The string value for this state is
* Upper case letters in the name are converted to
* lower case letters.
*
* @param name The name of the window state
*/
public WindowState(String name) {
if (name==null) {
throw new IllegalArgumentException("WindowState name can not be NULL");
}
_name = name.toLowerCase(Locale.ENGLISH);
}
/**
* Returns a String representation of this window state.
* Window state names are always lower case names.
*
* @return String representation of this window state.
*/
public String toString() {
return _name;
}
/**
* Returns the hash code value for this window state.
* The hash code is constructed by producing the
* hash value of the String value of this window state.
*
* @return hash code value for this window state
*/
public int hashCode() {
return _name.hashCode();
}
/**
* Compares the specified object with this window state
* for equality. Returns
* A
* A portlet can bind an object attribute into a
* The portlet session is based on the
* Portlets may need to prefix attributes set in this scope with some
* ID, to avoid overwriting each other's attributes in the
* case where two portlets of the same portlet definition
* are created.
*
* Value:
* Value: Actions that your portlet takes, such as getting or setting
* a value associated with the session, do not affect the access
* time.
*
* @return a
* Invalidating the portlet session will result in invalidating the underlying
* After this method has been executed, and if the new object
* implements If an object was already bound to this session
* that implements If the value is After this method has been executed, and if the new object
* implements If an object was already bound to this session
* that implements If the value is
* The keys are of type
* If no session attributes exist this method returns an empty
* The keys are of type
* If no session attributes exist this method returns an empty
* The portlet container creates an
* The portlet can only read the
* A non-null value indicates that the portal application supports
* the
* The value is
* The portlet modes must at least include the
* standard portlet modes
* The window states must at least include the
* standard window states
* The form of the returned string is servername/versionnumber. For
* example, the reference implementation Pluto may return the string
*
* The portlet container may return other optional information after the
* primary string in parentheses, for example,
* The value is
* This call returns the same value as
* In some cases, the portlet cannot make an estimate. For
* example, the portlet might know that a server it needs is
* not running, but it might not be able to report how long it will take
* to be restored to functionality. This can be indicated with
* a negative or zero value for the
* If the portlet is called again while it is still unavailable, it
* indicates the same time estimate. No effort is
* made to correct for the time elapsed since the exception was
* first reported.
*
* If this method returns zero or a negative number, the portlet
* is permanently unavailable or cannot provide an estimate of
* how long it will be unavailable.
*
* @return an integer specifying the number of seconds
* the portlet will be temporarily unavailable,
* or zero or a negative number if the portlet is permanently
* unavailable or cannot make an estimate.
*
*/
public int getUnavailableSeconds() {
return permanent ? -1 : seconds;
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ResourceURL.java 0000644 0001750 0001750 00000013423 11201125563 025205 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The
* Each resource URL has a specific cache level assigned with it. This level
* can be either
* The default cache level of a resource URL is either the cache level of the
* parent resource URL, or
* Only URLs of the type
* URLs of the type
* Only URLs of the type
* URLs of the type
* URLs of the type
* When set, this property indicates to the portal application
* that it can share this resource across different portlet applications.
*
* The value of this property should be a QName in the
* format of
* Possible return values are:
* Possible values are:
* Note that if this URL is created inside a
*
* The default cache level of a resource URL is either the cache level of the
* parent resource URL, or
* The
* The portlet must define the events it is able to receive in the portlet deployment
* descriptor with the
* If the expiration value is set to
* A default can be defined in the portlet deployment descriptor
* with the
* Non-integer values are treated as
* The value is
* Predefined cache scopes are:
* A default can be defined in the portlet deployment descriptor
* with the
* Values that are not either
* The value is
* This property needs to be set using the
* The value is
* The value is
* This property needs to be set using the
* The value is
* Support for this property is optional and the portlet can verify if the
* calling portal supports this property via the
* Even if the calling portal support this property delivery of the DOM
* element to the client cannot be guaranteed, e.g. due to possible security
* rules of the portal application or elements that conflict with the
* response of other portlets.
*
* This property needs to be set using the
*
* The value is
* If no content type was set previously using the {@link #setContentType}
* method this method returns
* Calling
*
* @param type
* the content MIME type
*
* @see PortletRequest#getResponseContentTypes
* @see #getContentType
*/
public void setContentType(String type);
/**
* Returns the name of the charset used for the MIME body sent in this
* response.
*
*
* See RFC 2047 for
* more information about character encoding and MIME.
*
* @return a
* Before calling this method the content type of the render response should
* be set using the {@link #setContentType} method.
*
* Either this method or {@link #getPortletOutputStream} may be called to
* write the body, not both.
*
* @return a
* This method must be called before any response body content is written;
* if content has been written, or the portlet container does not support
* buffering, this method may throw an
* Before calling this method the content type of the render response must
* be set using the {@link #setContentType} method.
*
* Calling
* Either this method or {@link #getWriter} may be called to write the body,
* not both.
*
* @return a
* The returned URL can be further extended by adding portlet-specific
* parameters and portlet modes and window states.
*
* The created URL will per default not contain any parameters of the
* current render request.
*
* @return a portlet render URL
*/
public PortletURL createRenderURL();
/**
* Creates a portlet URL targeting the portlet. If no portlet mode, window
* state or security modifier is set in the PortletURL the current values
* are preserved. If a request is triggered by the PortletURL, it results in
* an action request.
*
* The returned URL can be further extended by adding portlet-specific
* parameters and portlet modes and window states.
*
* The created URL will per default not contain any parameters of the
* current render request.
*
* @return a portlet action URL
*/
public PortletURL createActionURL();
/**
* Creates a portlet URL targeting the portlet. If no security modifier is
* set in the PortletURL the current values are preserved. The current
* render parameters, portlet mode and window state are preserved.
*
* If a request is triggered by the PortletURL, it results in a serve
* resource request of the
* The returned URL can be further extended by adding portlet-specific
* parameters .
*
* The created URL will per default contain the current
* cacheability setting of the parent resource.
* If no parent resource is available,
* A portlet mode indicates the function a portlet is performing.
* Normally, portlets perform different tasks and create different
* content depending on the function they are currently performing.
* When invoking a portlet, the portlet container provides the
* current portlet mode to the portlet.
*
* Portlets can programmatically change their portlet
* mode when processing an action request.
*
* This class defines the default portlet modes
* This mode must be supported by the portlet.
*
* The string value for this mode is
* Typically, portlets in
* This mode is optional.
*
* The string value for this mode is
* This mode is optional.
*
* The string value for this mode is
* Upper case letters in the name are converted to
* lower case letters.
*
* @param name The name of the portlet mode
*/
public PortletMode(String name) {
if (name==null) {
throw new IllegalArgumentException("PortletMode name can not be NULL");
}
_name = name.toLowerCase(Locale.ENGLISH);
}
/**
* Returns a String representation of this portlet mode.
* Portlet mode names are always lower case names.
*
* @return String representation of this portlet mode
*/
public String toString() {
return _name;
}
/**
* Returns the hash code value for this portlet mode.
* The hash code is constructed by producing the
* hash value of the String value of this mode.
*
* @return hash code value for this portlet mode
*/
public int hashCode() {
return _name.hashCode();
}
/**
* Compares the specified object with this portlet mode
* for equality. Returns
* Possible values are the standard window states and any custom window
* states supported by the portal and the portlet. Standard window states
* are:
*
* Possible values are the standard portlet modes and any custom portlet
* modes supported by the portal and the portlet. Portlets must declare in
* the deployment descriptor the portlet modes they support for each markup
* type. Standard portlet modes are:
*
* Note: The portlet may still be called in a different window state in the
* next render call, depending on the portlet container / portal.
*
* @param portletMode
* the new portlet mode
*
* @exception PortletModeException
* if the portlet cannot switch to this portlet mode, because
* the portlet or portal does not support it for this markup,
* or the current user is not allowed to switch to this
* portlet mode. To avoid this exception the portlet can
* check the allowed portlet modes with
*
* All previously set render parameters are cleared.
*
* These parameters will be accessible in all sub-sequent render calls via
* the
* The given parameters do not need to be encoded prior to calling this
* method.
*
* The portlet should not modify the map any further after calling
* this method.
*
* @param parameters
* Map containing parameter names for the render phase as keys
* and parameter values as map values. The keys in the parameter
* map must be of type String. The values in the parameter map
* must be of type String array (
* These parameters will be accessible in all sub-sequent render calls via
* the
* This method replaces all parameters with the given key.
*
* The given parameter do not need to be encoded prior to calling this
* method.
*
* @param key
* key of the render parameter
* @param value
* value of the render parameter
*
* @exception java.lang.IllegalArgumentException
* if key is
* These parameters will be accessible in all sub-sequent render calls via
* the
* This method replaces all parameters with the given key.
*
* The given parameter do not need to be encoded prior to calling this
* method.
*
* @param key
* key of the render parameter
* @param values
* values of the render parameter
*
* @exception java.lang.IllegalArgumentException
* if key or value are
* The object type of the value must be compliant with the specified event
* type in the portlet deployment descriptor.
*
* The value must have a valid JAXB binding and be serializable.
*
* @param name
* the event name to publish, must not be
* The name is treated as local part of the event QName and the namespace
* is either taken from the
* The object type of the value must be compliant with the specified event
* type in the portlet deployment descriptor.
*
* The value must have a valid JAXB binding and be serializable.
*
* @param name
* the local part of the event name to publish, must not be
* The values in the returned
* If no parameters exist this method returns an empty
* The portlet container creates an
* The
* The value is
* This call returns the same value as
*
* The parameters returned do not include the resource parameters that
* the portlet may have set on the resource URL triggering this
*
* The values in the returned
* If no private parameters exist this method returns an empty
* The returned content type should be based on the HTTP Accept header
* provided by the client.
*
* @return preferred content type of the response
*/
public String getResponseContentType();
/**
* Gets a list of content types which the portal accepts for the response.
* This list is ordered with the most preferable types listed first.
*
* The returned content types should be based on the HTTP Accept header
* provided by the client.
*
* @return ordered list of content types for the response
*/
public java.util.Enumeration
* Possible return values are:
*
* A portlet is a Java technology-based web component. It is managed by the portlet container and
* processes requests and generates dynamic content as response. Portlets are used by portals as
* pluggable user interface components.
*
* The content generated by a portlet is called a fragment. A fragment is a piece of
* markup (e.g. HTML, XHTML, WML) adhering to certain rules and can be aggregated
* with other fragments into a complete document. The content of a portlet is normally
* aggregated with the content of other portlets into the portal page.
*
* The portlet container instantiates portlets, manages their lifecycle
* and invoking them to process requests. The lifecycle consists of:
*
* Request processing is divided into two types:
* The portlet container calls the The portlet container cannot place the portlet into service
* if the
* Typically, in response to an action request, a portlet updates state
* based on the information sent in the action request parameters.
* In an action the portlet may:
*
* A client request triggered by an action URL translates into one
* action request and many render requests, one per portlet in the portal page.
* The action processing must be finished before the render requests
* can be issued.
*
* @param request
* the action request
* @param response
* the action response
* @exception PortletException
* if the portlet has problems fulfilling the
* request
* @exception UnavailableException
* if the portlet is unavailable to process the action at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception IOException
* if the streaming causes an I/O problem
*/
public void processAction (ActionRequest request, ActionResponse response)
throws PortletException, java.io.IOException;
/**
* Called by the portlet container to allow the portlet to generate
* the content of the response based on its current state.
*
* @param request
* the render request
* @param response
* the render response
*
* @exception PortletException
* if the portlet has problems fulfilling the
* rendering request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*/
public void render (RenderRequest request, RenderResponse response)
throws PortletException, java.io.IOException;
/**
*
* Called by the portlet container to indicate to a portlet that the
* portlet is being taken out of service.
*
* Before the portlet container calls the destroy method, it should
* allow any threads that are currently processing requests within
* the portlet object to complete execution. To avoid
* waiting forever, the portlet container can optionally wait for
* a predefined time before destroying the portlet object.
*
* This method enables the portlet to do the following:
*
* All previously set render parameters are cleared.
*
* These parameters will be accessible in all
* subsequent render calls via the
*
* The given parameters do not need to be encoded
* prior to calling this method.
*
* @param request The request the portlet has been provided
* with by the portlet container for the current
*
* Filters perform filtering in the
* Filters are configured in the portlet deployment descriptor of a
* portlet application.
*
* @since 2.0
*/
public interface EventFilter extends PortletFilter {
/**
* The
* The
* The
* Filters perform filtering in the
* Filters are configured in the portlet deployment descriptor of a
* portlet application.
*
* @since 2.0
*/
public interface RenderFilter extends PortletFilter {
/**
* The
* The
* The
* Filters perform filtering in the
* Filters are configured in the portlet deployment descriptor of a
* portlet application.
*
* @since 2.0
*/
public interface ActionFilter extends PortletFilter {
/**
* The
* The
* The
* Initialization parameters are defined in the portlet deployment descriptor.
*
* @param name the name of the initialization parameter to return
* @return initialization parameter, or
* Initialization parameters are defined in the portlet deployment descriptor.
*
* @return the names of the filter's initialization parameters,
* or an empty Enumeration if the filter has no initialization parameters.
*/
public Enumeration
* Filters perform filtering in the
* Filters are configured in the portlet deployment descriptor of a
* portlet application.
*
* @since 2.0
*/
public interface ResourceFilter extends PortletFilter {
/**
* The
* The
* The
* The portlet container cannot place the filter into service if the init method either
*
* After the portlet container calls this method, it will not call the
*
* This method gives the filter an opportunity to clean up any resources
* that are being held (for example, memory, file handles, threads) and
* make sure that any persistent state is synchronized with the
* filter's current state in memory.
*/
public void destroy();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ResourceServingPortlet.java 0000644 0001750 0001750 00000005204 11201125563 027530 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The
* The portlet container must call this method for links created by
* the
* This method allows response properties to have multiple values.
*
* Response properties can be viewed as header values set for the portal application.
* If these header values are intended to be transmitted to the client they should be
* set before the response is committed.
*
* @param key
* the key of the property to be returned to the portal
* @param value
* the value of the property to be returned to the portal
*
* @exception java.lang.IllegalArgumentException
* if key is
* Response properties can be viewed as header values set for the portal application.
* If these header values are intended to be transmitted to the client they should be
* set before the response is committed.
*
* This method resets all properties previously added with the same key.
*
* @param key
* the key of the property to be returned to the portal
* @param value
* the value of the property to be returned to the portal
*
* @exception java.lang.IllegalArgumentException
* if key is
* Portlets should encode all resource URLs pointing to resources in the
* portlet application via this method in order to ensure that they get
* served via the portal application.
*
* Some portal/portlet-container implementation may require those URLs to
* contain implementation specific data encoded in it. Because of that,
* portlets should use this method to create such URLs.
*
* The
* Portlet developer should be aware that the returned URL might not be a well formed
* URL but a special token at the time the portlet is generating its content.
* Thus portlets should not add additional parameters on the resulting URL or
* expect to be able to parse the URL. As a result, the outcome of the encodeURL
* call may be different than calling encodeURL in the servlet world.
*
* @param path
* the URI path to the resource. This must be either an absolute
* URL (e.g.
*
* The namespace value must be constant for the lifetime of the portlet
* window.
*
* @return the namespace
*/
public String getNamespace();
/**
* Adds a HTTP Cookie property to the response.
* This method allows response properties to have multiple cookies.
*
*
* @param cookie the cookie to be added to the response
*
* @exception java.lang.IllegalArgumentException
* if cookie is
* If a DOM element with the provided key already exists
* the provided element will be stored in addition to the
* existing element under the same key.
*
* If the element is
* Response XML DOM element properties can be viewed as
* additional response document sections
* set for the portal application.
* If these header values are intended to be transmitted to the client they should be
* set before the response is committed.
*
* @param key
* the key of the property to be returned to the portal
* @param element
* the XML DOM element to be added to the response
*
* @exception java.lang.IllegalArgumentException
* if key is portlet-name
* tag.
*
* @return the portlet name
*/
public String getPortletName ();
/**
* Returns the PortletContext
of the portlet application
* the portlet is in.
*
* @return a PortletContext
object, used by the
* caller to interact with its portlet container
*
* @see PortletContext
*/
public PortletContext getPortletContext ();
/**
* Gets the resource bundle for the given locale based on the
* resource bundle defined in the deployment descriptor
* with resource-bundle
tag or the inlined resources
* defined in the deployment descriptor.
*
* @param locale the locale for which to retrieve the resource bundle
*
* @return the resource bundle for the given locale
*
*/
public java.util.ResourceBundle getResourceBundle(java.util.Locale locale);
/**
* Returns a String containing the value of the named initialization parameter,
* or null if the parameter does not exist.
*
* @param name a String
specifying the name
* of the initialization parameter
*
* @return a String
containing the value
* of the initialization parameter
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public String getInitParameter(java.lang.String name);
/**
* Returns the names of the portlet initialization parameters as an
* Enumeration
of String objects, or an empty Enumeration
if the
* portlet has no initialization parameters.
*
* @return an Enumeration
of String
* objects containing the names of the portlet
* initialization parameters, or an empty Enumeration
if the
* portlet has no initialization parameters.
*/
public java.util.EnumerationEnumeration
of String
objects,
* or an empty Enumeration
if the
* portlet has not defined public render parameters.
* supported-public-render-parameter
element.
*
* @return an Enumeration
of String
* objects containing the names of the public
* render parameters, or an empty Enumeration
if the
* portlet has not defined support for any public render parameters
* in the portlet deployment descriptor.
* @since 2.0
*/
public java.util.Enumerationdefault-namespace
element.
* XMLConstants.NULL_NS_URI
.
*
* @return the default namespace defined in the portlet deployment
* descriptor, or XMLConstants.NULL_NS_URI
is non is
* defined.
* @since 2.0
*/
public java.lang.String getDefaultNamespace();
/**
* Returns the QNames of the publishing events supported by the portlet
* as an Enumeration
of QName
objects,
* or an empty Enumeration
if the
* portlet has not defined any publishing events.
* supported-publishing-event
element.
* name
element instead of
* the qname
element the defined default namespace
* is added as namespace for the returned QName.
*
* @return an Enumeration
of QName
* objects containing the names of the publishing events,
* or an empty Enumeration
if the
* portlet has not defined any support for publishing events in
* the deployment descriptor.
* @since 2.0
*/
public java.util.EnumerationEnumeration
of QName
objects,
* or an empty Enumeration
if the
* portlet has not defined any processing events.
* supported-processing-event
element.
* name
element instead of
* the qname
element the defined default namespace
* is added as namespace for the returned QName.
*
* @return an Enumeration
of QName
* objects containing the names of the processing events,
* or an empty Enumeration
if the
* portlet has not defined any support for processing events in
* the deployment descriptor.
* @since 2.0
*/
public java.util.EnumerationEnumeration
of Locale
objects,
* or an empty Enumeration
if the
* portlet has not defined any supported locales.
* supported-locale
element.
*
* @return an Enumeration
of Locale
* objects containing the supported locales,
* or an empty Enumeration
if the
* portlet has not defined any supported locales in
* the deployment descriptor.
* @since 2.0
*/
public java.util.Enumerationportlet.xml
via the
* container-runtime-option
element with a name and a
* value on the application and portlet level.
* If a container runtime option is set on the portlet application
* level and on the portlet level with the same name the setting
* on the portlet level takes precedence and overwrites the one
* set on the portal application level.
* portlet.xml
. Options that the portlet container
* does not support will not be returned in this map.
* String[]
)
* with the values specified in the portlet.xml
deployment descriptor.
*
* @since 2.0
*
* @return an immutable Map
containing portlet
* container runtime options names as keys and the
* container runtime values as map values, or an empty Map
* if no portlet container runtime options are set
* in the portlet.xml
or supported by this portlet container.
* The keys in the map are of type String. The values in the map are of type
* String array (String[]
).
*/
public java.util.MapPortletModeException
is thrown when a portlet
* tries to use or set a portlet mode that is not supported by the current
* runtime environment or the portlet.
*/
public class PortletModeException extends PortletException
{
private transient PortletMode _mode = null;
private static final long serialVersionUID = 1L;
/**
* Constructs a new portlet mode exception with the given text and the
* portlet mode that caused this exception. The
* portlet container may use the text and portlet mode write it to a log.
*
* @param text
* the exception text
* @param mode
* the mode causing the exception
*/
public PortletModeException (String text, PortletMode mode)
{
super (text);
_mode = mode;
}
/**
* Constructs a new portlet mode exception when the portlet needs to do
* the following:
*
*
*
* @param text
* the exception text
* @param cause
* the root cause
* @param mode
* the mode causing the exception
*/
public PortletModeException (String text, Throwable cause, PortletMode mode)
{
super(text, cause);
_mode = mode;
}
/**
* Constructs a new portlet mode exception when the portlet needs to throw an
* exception. The exception message is based on the localized message
* of the underlying exception and the portlet mode that caused this exception.
*
* @param cause
* the root cause
* @param mode
* the mode causing the exception
*/
public PortletModeException (Throwable cause, PortletMode mode)
{
super(cause);
_mode = mode;
}
/**
* Returns the unsupported portlet mode causing this exception.
*
* @return the portlet mode that caused this exception
*/
public PortletMode getMode()
{
return _mode;
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ProcessAction.java 0000644 0001750 0001750 00000003326 11201125563 025610 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* Annotation for marking a method for processing
* a specific action.
* The GenericPortlet
tries to dispatch to methods annotated
* with the tag @ProcessAction
for any received
* processAction
call.
*
* @since 2.0
*/
@Target(ElementType.METHOD)
@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
public @interface ProcessAction {
/**
* Name of the action.
* Must be set on the
* ActionURL
as value of the
* parameter javax.portlet.action
.
*
* @return action name
*/
String name();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletContext.java 0000644 0001750 0001750 00000040134 11201125563 026030 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
import java.net.MalformedURLException;
/**
* The PortletContext
interface defines a portlet view
* of the portlet container.
* The PortletContext
also makes resources available
* to the portlet. Using the context, a portlet can access
* the portlet log, and obtain URL references to resources.
*
* /catalog
.
* They are possibly installed via a .war
file.)
* As a web application, a portlet application also has a servlet context.
* The portlet context leverages most of its functionality from the
* servlet context of the portlet application.
* containername/versionnumber
.
*
*
* @return the string containing at least name and version number
*/
public String getServerInfo ();
/**
* Returns a {@link PortletRequestDispatcher} object that acts
* as a wrapper for the resource located at the given path.
* A PortletRequestDispatcher
object can be used include the
* resource in a response. The resource can be dynamic or static.
*
* /
) and is interpreted as relative
* to the current context root.
*
* null
if the PortletContext
* cannot return a PortletRequestDispatcher
* for any reason.
*
*
* @param path a String
specifying the pathname
* to the resource
* @return a PortletRequestDispatcher
object
* that acts as a wrapper for the resource
* at the specified path.
* @see PortletRequestDispatcher
*/
public PortletRequestDispatcher getRequestDispatcher(String path);
/**
* Returns a {@link PortletRequestDispatcher} object that acts
* as a wrapper for the named servlet.
*
* null
if the
* PortletContext
cannot return a
* PortletRequestDispatcher
for any reason.
*
*
* @param name a String
specifying the name
* of a servlet to be wrapped
*
* @return a PortletRequestDispatcher
object
* that acts as a wrapper for the named servlet
*
* @see PortletRequestDispatcher
*
*/
public PortletRequestDispatcher getNamedDispatcher(String name);
/**
* Returns the resource located at the given path as an InputStream object.
* The data in the InputStream can be of any type or length. The method returns
* null if no resource exists at the given path.
* /WEB-INF/
(for example /WEB-INF/myportlet/myportlet.jsp
).
* Otherwise, the direct path is used
* (for example /myportlet/myportlet.jsp
).
*
* @param path the path to the resource
*
* @return the input stream
*/
public java.io.InputStream getResourceAsStream (String path);
/**
* Returns the major version of the Portlet API that this portlet
* container supports.
*
* @return the major version
*
* @see #getMinorVersion()
*/
public int getMajorVersion ();
/**
* Returns the minor version of the Portlet API that this portlet
* container supports.
*
* @return the minor version
*
* @see #getMajorVersion()
*/
public int getMinorVersion ();
/**
* Returns the MIME type of the specified file, or null
if
* the MIME type is not known. The MIME type is determined
* by the configuration of the portlet container and may be specified
* in a web application deployment descriptor. Common MIME
* types are text/html
and image/gif
.
*
*
* @param file a String
specifying the name
* of a file
*
* @return a String
specifying the MIME type of the file
*
*/
public String getMimeType(String file);
/**
* Returns a String
containing the real path
* for a given virtual path. For example, the path /index.html
* returns the absolute file path of the portlet container file system.
*
* null
* if the portlet container cannot translate the virtual path
* to a real path for any reason (such as when the content is
* being made available from a .war
archive).
*
* @param path a String
specifying a virtual path
*
* @return a String
specifying the real path,
* or null if the transformation cannot be performed.
*/
public String getRealPath(String path);
/**
* Returns a directory-like listing of all the paths to resources within
* the web application longest sub-path of which
* matches the supplied path argument. Paths indicating subdirectory paths
* end with a slash (/
). The returned paths are all
* relative to the root of the web application and have a leading slash.
* For example, for a web application
* containing
*
* /welcome.html
*
*
* /catalog/index.html
* /catalog/products.html
* /catalog/offers/books.html
* /catalog/offers/music.html
* /customer/login.jsp
* /WEB-INF/web.xml
* /WEB-INF/classes/com.acme.OrderPortlet.class,
* getResourcePaths("/")
returns
* {"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}
* getResourcePaths("/catalog/")
returns
* {"/catalog/index.html", "/catalog/products.html", "/catalog/offers/"}
.
*
* @param path
* the partial path used to match the resources, which must start with a slash
* @return a Set containing the directory listing, or null
if there
* are no resources in the web application of which the path
* begins with the supplied path.
*/
public java.util.Set/
) and is interpreted
* as relative to the current context root.
*
* .war
file.
*
* URLConnection
objects that are necessary
* to access the resource.
*
* null
* if no resource is mapped to the pathname.
*
* .jsp
page returns the JSP source code.
* Use a RequestDispatcher
instead to include results of
* an execution.
*
* java.lang.Class.getResource
,
* which looks up resources based on a class loader. This
* method does not use class loaders.
*
* @param path a String
specifying
* the path to the resource
*
* @return the resource located at the named path,
* or null
if there is no resource
* at that path
*
* @exception MalformedURLException if the pathname is not given in
* the correct form
*
*/
public java.net.URL getResource(String path) throws java.net.MalformedURLException;
/**
* Returns the portlet container attribute with the given name,
* or null if there is no attribute by that name.
* An attribute allows a portlet container to give the
* portlet additional information not
* already provided by this interface.
* A list of supported attributes can be retrieved using
* getAttributeNames
.
*
* java.lang.Object
* or some subclass.
* Attribute names should follow the same convention as package
* names. The Java Portlet API specification reserves names
* matching java.*
, javax.*
,
* and sun.*
.
*
*
* @param name a String
specifying the name
* of the attribute
*
* @return an Object
containing the value
* of the attribute, or null
* if no attribute exists matching the given
* name
*
* @see #getAttributeNames
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public java.lang.Object getAttribute(java.lang.String name);
/**
* Returns an Enumeration
containing the attribute names
* available within this portlet context, or an empty
* Enumeration
if no attributes are available. Use the
* {@link #getAttribute} method with an attribute name
* to get the value of an attribute.
*
* @return an Enumeration
of attribute names
*
* @see #getAttribute
*/
public java.util.Enumerationnull
if the parameter does not exist.
* This method provides configuration information which may be useful for
* an entire "portlet application".
*
* @param name a String
containing the name of the
* requested parameter
*
* @return a String
containing the value
* of the initialization parameter, or
* null
if the parameter does not exist.
*
* @see #getInitParameterNames
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public java.lang.String getInitParameter(java.lang.String name);
/**
* Returns the names of the context initialization parameters as an
* Enumeration
of String objects, or an empty Enumeration if the context
* has no initialization parameters.
*
* @return an Enumeration
of String
* objects containing the names of the context
* initialization parameters
*
* @see #getInitParameter
*/
public java.util.EnumerationServletContext.log
method.
* The portlet container may in addition log this message in a
* portlet container specific log file.
*
* @param msg a String
specifying the
* message to be written to the log file
*/
public void log(java.lang.String msg);
/**
* Writes an explanatory message and a stack trace for a given
* Throwable exception to the portlet log file.
* The name and type of the portlet log file is specific to the
* portlet container, usually an event log.
* ServletContext.log
method.
* The portlet container may in addition log this message in a
* portlet container specific log file.
*
* @param message a String
that
* describes the error or exception
* @param throwable the Throwable
error
* or exception
*/
public void log(java.lang.String message, java.lang.Throwable throwable);
/**
* Removes the attribute with the given name from the portlet context.
* After removal, subsequent calls to
* {@link #getAttribute} to retrieve the attribute's value
* will return null
.
*
* @param name a String
specifying the name
* of the attribute to be removed
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public void removeAttribute(java.lang.String name);
/**
* Binds an object to a given attribute name in this portlet context.
* If the name specified is already used for an attribute, this method
* removes the old attribute and binds the name to the new attribute.
* removeAttribute()
.
*
* java.*
, javax.*
, and
* sun.*
.
*
* @param name a String
specifying the name
* of the attribute
* @param object an Object
representing the
* attribute to be bound
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public void setAttribute(java.lang.String name, java.lang.Object object);
/**
* Returns the name of this portlet application correponding to this PortletContext as specified
* in the web.xml
deployment descriptor for this web application by the
* display-name
element.
*
*
* @return The name of the web application or null if no name has been declared in the deployment descriptor.
*/
public String getPortletContextName();
/**
* Returns the container container runtime options
* keys supported by this portlet container.
*
* @since 2.0
*
* @return container runtime options keys supported by this
* container as String values.
*/
public java.util.EnumerationPortletRequest
defines the base interface to provide client
* request information to a portlet. The portlet container uses two specialized
* versions of this interface when invoking a portlet, ActionRequest
* and RenderRequest
. The portlet container creates these objects and
* passes them as arguments to the portlet's processAction
and
* render
methods.
*
* @see ActionRequest
* @see RenderRequest
*/
public interface PortletRequest
{
/** Used to retrieve user information attributes with the
* getAttribute
call. The user information is returned
* as a Map
object. The portlet must define the
* user information attribute it is interested in inside the
* user-attribute
section of the deployment descriptor.
* If an attribute is not supported
* by the current runtime system it will not show up in the user
* attribute map.
* If the user-attribute is supported by the runtime system, but not
* defined for a particular user, then for that user the attribute
* exists in the returned map and the attribute has a null
value.
* javax.portlet.userinfo
.
*/
public static final String USER_INFO = "javax.portlet.userinfo";
/**
* Used to retrieve an instance of the javax.ccpp.Profile
* with the getAttribute
call. The returned profile is based
* on the current portlet request and may contain additional CC/PP
* information set by the portal / portlet container.
* javax.portlet.ccpp
.
*
* @since 2.0
*/
public static final String CCPP_PROFILE = "javax.portlet.ccpp";
/**
* String identifier for Basic authentication. Value "BASIC".
*/
public static final String BASIC_AUTH = "BASIC";
/**
* String identifier for Form based authentication. Value "FORM".
*/
public static final String FORM_AUTH = "FORM";
/**
* String identifier for Certification based authentication. Value "CLIENT_CERT".
*/
public static final String CLIENT_CERT_AUTH = "CLIENT_CERT";
/**
* String identifier for Digest based authentication. Value "DIGEST".
*/
public static final String DIGEST_AUTH = "DIGEST";
/**
* P3P user information constants.
* ActionRequest
and ActionResponse
.
* ACTION_PHASE
.
*
* @since 2.0
*/
public static final String ACTION_PHASE = "ACTION_PHASE";
/**
* String identifier for the portlet event lifecycle phase. In this
* phase the portlet request and response are from type
* EventRequest
and EventResponse
.
* EVENT_PHASE
.
*
* @since 2.0
*/
public static final String EVENT_PHASE = "EVENT_PHASE";
/**
* String identifier for the portlet render lifecycle phase. In this
* phase the portlet request and response are from type
* RenderRequest
and RenderResponse
.
* RENDER_PHASE
.
*
* @since 2.0
*/
public static final String RENDER_PHASE = "RENDER_PHASE";
/**
* String identifier for the portlet resource serving lifecycle phase. In this
* phase the portlet request and response are from type
* ResourceRequest
and ResourceResponse
.
* RESOURCE_PHASE
.
*
* @since 2.0
*/
public static final String RESOURCE_PHASE = "RESOURCE_PHASE";
/**
* Provides the portlet lifecycle phase of the current request
* as request attribute.
* javax.portlet.lifecylce_phase
.
*
* @since 2.0
*/
public static final String LIFECYCLE_PHASE = "javax.portlet.lifecycle_phase";
/**
* The RENDER_PART portlet request attribute is set by portals
* that are streaming based and therefore need to split the
* render phase into two parts: first the RENDER_HEADERS part
* where the portlet should only set the header related data
* and the portlet title, and second the RENDER_MARKUP part
* in which the portlet should produce its markup.
* javax.portlet.render_part
.
*
* @since 2.0
*/
public static final String RENDER_PART = "javax.portlet.render_part";
/**
* The RENDER_HEADERS is a possible value of the RENDER_PART
* request attribute and denotes that the portlet should set
* the intended headers and the portlet title of this render
* request.
* RENDER_HEADERS
.
*
* @since 2.0
*/
public static final String RENDER_HEADERS = "RENDER_HEADERS";
/**
* The RENDER_MARKUP is a possible value of the RENDER_PART
* request attribute and denotes that the portlet should
* produce its markup for this render request.
* RENDER_MARKUP
.
*
* @since 2.0
*/
public static final String RENDER_MARKUP = "RENDER_MARKUP";
/**
* The action scope ID that the portlet container uses
* for storing the current action scope as render parameter
* if the javax.portlet.actionScopedRequestAttributes
* container runtime option is used by the portlet.
* javax.portlet.as
.
* @since 2.0
*/
public static final String ACTION_SCOPE_ID = "javax.portlet.as";
/**
* Returns true, if the given window state is valid
* to be set for this portlet in the context
* of the current request.
*
* @param state window state to checked
*
* @return true, if it is valid for this portlet
* in this request to change to the
* given window state
*
*/
public boolean isWindowStateAllowed(WindowState state);
/**
* Returns true, if the given portlet mode is a valid
* one to set for this portlet in the context
* of the current request.
*
* @param mode portlet mode to check
*
* @return true, if it is valid for this portlet
* in this request to change to the
* given portlet mode
*
*/
public boolean isPortletModeAllowed(PortletMode mode);
/**
* Returns the current portlet mode of the portlet.
*
* @return the portlet mode
*/
public PortletMode getPortletMode ();
/**
* Returns the current window state of the portlet.
*
* @return the window state
*/
public WindowState getWindowState ();
/**
* Returns the preferences object associated with the portlet.
*
* @return the portlet preferences
*/
public PortletPreferences getPreferences ();
/**
* Returns the current portlet session or, if there is no current session,
* creates one and returns the new session.
* HttpSession
on which the portlet session is based on.
*
* @return the portlet session
*/
public PortletSession getPortletSession ();
/**
* Returns the current portlet session or, if there is no current session
* and the given flag is true
, creates one and returns
* the new session.
* false
and there is no current
* portlet session, this method returns null
.
* HttpSession
on which the portlet session is based on.
*
* @param create
* true
to create a new session,
* false
to return null
if there
* is no current session
* @return the portlet session
*
*/
public PortletSession getPortletSession (boolean create);
/**
* Returns the value of the specified request property
* as a String
. If the request did not include a property
* of the specified name, this method returns null
.
* getProperties
.
*
* @param name a String
specifying the
* property name
*
* @return a String
containing the
* value of the requested
* property, or null
* if the request does not
* have a property of that name.
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public String getProperty(String name);
/**
* Returns all the values of the specified request property
* as a Enumeration
of String
objects.
* Enumeration
.
* The property name is case insensitive. You can use
* this method with any request property.
*
* @param name a String
specifying the
* property name
*
* @return a Enumeration
containing
* the values of the requested property. If
* the request does not have any properties of
* that name return an empty Enumeration
.
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public java.util.EnumerationEnumeration
of all the property names
* this request contains. If the request has no
* properties, this method returns an empty Enumeration
.
*
*
* @return an Enumeration
of all the
* property names sent with this
* request; if the request has
* no properties, an empty Enumeration
.
*/
public java.util.EnumerationBASIC_AUTH
, CLIENT_CERT_AUTH
,
* a custom one or null
if there was no authentication.
*
* @return one of the static members BASIC_AUTH
,
* FORM_AUTH
, CLIENT_CERT_AUTH
,
* DIGEST_AUTH
(suitable for == comparison)
* indicating the authentication scheme,
* a custom one, or
* null
if the request was
* not authenticated.
*/
public java.lang.String getAuthType();
/**
* Returns the context path which is the path prefix associated with the deployed
* portlet application. If the portlet application is rooted at the
* base of the web server URL namespace (also known as "default" context),
* this path must be an empty string. Otherwise, it must be the path the
* portlet application is rooted to, the path must start with a '/' and
* it must not end with a '/' character.
* String
specifying the
* portion of the request URL that indicates the context
* of the request
*
* @see PortletResponse#encodeURL
*/
public String getContextPath();
/**
* Returns the login of the user making this request, if the user
* has been authenticated, or null if the user has not been authenticated.
*
* @return a String
specifying the login
* of the user making this request, or null
* if the user login is not known.
*
*/
public java.lang.String getRemoteUser();
/**
* Returns a java.security.Principal object containing the name of the
* current authenticated user.
*
* @return a java.security.Principal
containing
* the name of the user making this request, or
* null
if the user has not been
* authenticated.
*/
public java.security.Principal getUserPrincipal();
/**
* Returns a boolean indicating whether the authenticated user is
* included in the specified logical "role". Roles and role membership can be
* defined using deployment descriptors. If the user has not been
* authenticated, the method returns false
.
*
* @param role a String
specifying the name
* of the role
*
* @return a boolean
indicating whether
* the user making this request belongs to a given role;
* false
if the user has not been
* authenticated.
*/
public boolean isUserInRole(java.lang.String role);
/**
*
* Returns the value of the named attribute as an Object
,
* or null
if no attribute of the given name exists.
* java.*
,
* and javax.*
.
* Object
* needs to be serializable.
*
* @param name a String
specifying the name of
* the attribute
*
* @return an Object
containing the value
* of the attribute, or null
if
* the attribute does not exist.
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*
*/
public Object getAttribute(String name);
/**
* Returns an Enumeration
containing the
* names of the attributes available to this request.
* This method returns an empty Enumeration
* if the request has no attributes available to it.
*
*
* @return an Enumeration
of strings
* containing the names
* of the request attributes, or an empty
* Enumeration
if the request
* has no attributes available to it.
*/
public java.util.EnumerationString
,
* or null
if the parameter does not exist. Request parameters
* are extra information sent with the request. The returned parameter
* are "x-www-form-urlencoded" decoded.
* getParameterValues
.
*
*
*
* @param name a String
specifying the
* name of the parameter
*
* @return a String
representing the
* single value of the parameter
*
* @see #getParameterValues
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*
*/
public String getParameter(String name);
/**
*
* Returns an Enumeration
of String
* objects containing the names of the parameters contained
* in this request. If the request has
* no parameters, the method returns an
* empty Enumeration
.
* Enumeration
of String
* objects, each String
containing
* the name of a request parameter; or an
* empty Enumeration
if the
* request has no parameters.
*/
public java.util.EnumerationString
objects containing
* all of the values the given request parameter has, or
* null
if the parameter does not exist.
* The returned parameters are "x-www-form-urlencoded" decoded.
* String
containing the name of
* the parameter the value of which is requested
*
* @return an array of String
objects
* containing the parameter values.
*
* @see #getParameter
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*
*/
public String[] getParameterValues(String name);
/**
* Returns a Map
of the parameters of this request.
* Request parameters are extra information sent with the request.
* The returned parameters are "x-www-form-urlencoded" decoded.
* Map
are from type
* String array (String[]
).
* Map
.
*
* @return an immutable Map
containing parameter names as
* keys and parameter values as map values, or an empty Map
* if no parameters exist. The keys in the parameter
* map are of type String. The values in the parameter map are of type
* String array (String[]
).
*/
public java.util.Mapjava.*
,
* javax.*
, and com.sun.*
are
* reserved.
*
If the value passed into this method is null
,
* the effect is the same as calling {@link #removeAttribute}.
*
*
* @param name a String
specifying
* the name of the attribute
*
* @param o the Object
to be stored
*
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public void setAttribute(String name, Object o);
/**
*
* Removes an attribute from this request. This method is not
* generally needed, as attributes only persist as long as the request
* is being handled.
*
* java.*
,
* javax.*
, and com.sun.*
are
* reserved.
*
* @param name a String
specifying
* the name of the attribute to be removed
*
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public void removeAttribute(String name);
/**
*
* Returns the session ID indicated in the client request.
* This session ID may not be a valid one, it may be an old
* one that has expired or has been invalidated.
* If the client request
* did not specify a session ID, this method returns
* null
.
*
* @return a String
specifying the session
* ID, or null
if the request did
* not specify a session ID
*
* @see #isRequestedSessionIdValid
*
*/
public String getRequestedSessionId();
/**
*
* Checks whether the requested session ID is still valid.
*
* @return true
if this
* request has an id for a valid session
* in the current session context;
* false
otherwise
*
* @see #getRequestedSessionId
* @see #getPortletSession
*/
public boolean isRequestedSessionIdValid();
/**
* Returns the portal preferred content type for the response.
*
*
*
* @return preferred MIME type of the response
*/
public String getResponseContentType();
/**
* Gets a list of content types which the portal accepts for the response.
* This list is ordered with the most preferable types listed first.
* '*'
or '* / *'
as supported content
* types, these may also be valid return values.
*
*
* @return ordered list of MIME types for the response
*/
public java.util.Enumeration'*'
or '* / *'
as supported content
* types, these may also be valid return values.http
, https
, or ftp
.
* Different schemes have different rules for constructing URLs,
* as noted in RFC 1738.
*
* @return a String
containing the name
* of the scheme used to make this request
*/
public String getScheme();
/**
* Returns the host name of the server that received the request.
*
* @return a String
containing the name
* of the server to which the request was sent
*/
public String getServerName();
/**
* Returns the port number on which this request was received.
*
* @return an integer specifying the port number
*/
public int getServerPort();
/**
* Returns the portlet window ID. The portlet window ID is
* unique for this portlet window and is constant for the lifetime
* of the portlet window.
* null
if no cookies exist.
*
* @since 2.0
* @return array of cookie properties, or
* null
if no cookies exist.
* @see MimeResponse#addProperty(Cookie)
*/
public javax.servlet.http.Cookie[] getCookies();
/**
* Returns a Map
of the private parameters of this request.
* Private parameters are not shared with other portlets or components.
* The returned parameters are "x-www-form-urlencoded" decoded.
* Map
are from type
* String array (String[]
).
* Map
.
*
* @since 2.0
* @return an immutable Map
containing private parameter names as
* keys and private parameter values as map values, or an empty Map
* if no private parameters exist. The keys in the parameter
* map are of type String. The values in the parameter map are of type
* String array (String[]
).
*/
public java.util.MapMap
of the public parameters of this request.
* Public parameters may be shared with other portlets or components and
* defined in the portlet deployment descriptor with the
* supported-public-render-parameter
element.
* The returned parameters are "x-www-form-urlencoded" decoded.
* Map
are from type
* String array (String[]
).
* Map
.
*
* @since 2.0
* @return an immutable Map
containing public parameter names as
* keys and public parameter values as map values, or an empty Map
* if no public parameters exist. The keys in the parameter
* map are of type String. The values in the parameter map are of type
* String array (String[]
).
*/
public java.util.MapPortletRequestDispatcher
interface defines an object that
* receives requests from the client and sends them to the specified resources
* (such as a servlet, HTML file, or JSP file) on the server. The portlet
* container creates the PortletRequestDispatcher
object, which
* is used as a wrapper around a server resource located at a particular path or
* given by a particular name.
*
*/
public interface PortletRequestDispatcher {
/**
*
* Includes the content of a resource (servlet, JSP page, HTML file) in the
* response. In essence, this method enables programmatic server-side
* includes.
* render
or a wrapped version of this
* render request.
*
* @param response
* a {@link RenderResponse} object that contains the render
* response. Must be either the render response passed to the
* portlet in render
or a wrapped version of this
* render response.
*
* @exception PortletException
* if the included resource throws a ServletException, or
* other exceptions that are not Runtime- or IOExceptions.
*
* @exception java.io.IOException
* if the included resource throws this exception
*
*
*/
public void include(RenderRequest request, RenderResponse response)
throws PortletException, java.io.IOException;
/**
*
* Includes the content of a resource (servlet, JSP page, HTML file) in the
* response. In essence, this method enables programmatic server-side
* includes.
* forward
method should be called before the response has been
* committed to the portlet container (before response body output has been flushed).
* If the response already has been committed, this method throws an
* IllegalStateException
. Uncommitted output in the response buffer
* is automatically cleared before the forward.
* PortletPreferences
interface allows the portlet to store
* configuration data. It is not the
* purpose of this interface to replace general purpose databases.
*
*
* EDIT, HELP, VIEW
).
* Per default every preference is modifiable.
* read-only
set to true
,
* or if the portlet container restricts write access.
* store
method is called. The store
method
* can only be invoked within the scope of a processAction
call.
* Changes that are not persisted are discarded when the
* processAction
or render
method ends.
*/
public interface PortletPreferences
{
/**
* Returns true, if the value of this key is defined as read-only and thus
* cannot be modified by the user.
* EDIT, HELP, VIEW
).
* Per default every preference is modifiable.
* CONFIG
mode, it may be allowed changing them.
* read-only
set to true
,
* or if the portlet container restricts write access.
* false
and the
* preference key is modifiable in general it does not mean that it
* is modifiable in the scope of the current request, e.g. if this
* request is a render request.
*
* @return false, if the value of this key can be changed, or
* if the key is not known
*
* @exception java.lang.IllegalArgumentException
* if key
is null
.
*/
public boolean isReadOnly(String key);
/**
* Returns the first String value associated with the specified key of this preference.
* If there is one or more preference values associated with the given key
* it returns the first associated value.
* If there are no preference values associated with the given key, or the
* backing preference database is unavailable, it returns the given
* default value.
* A null
value is treated as a non-existent value.
*
* @param key key for which the associated value is to be returned
* @param def the value to be returned in the event that there is no
* value available associated with this key
.
*
* @return the value associated with key
, or def
* if no value is associated with key
, or the backing
* store is inaccessible.
*
* @exception java.lang.IllegalArgumentException
* if key
is null
. (A
* null
value for def
is permitted.)
*
* @see #getValues(String, String[])
*/
public String getValue(String key, String def);
/**
* Returns the String array value associated with the specified key in this preference.
*
* null
value is treated as a non-existent value.
*
* key
* or the associated value cannot be interpreted as a String array,
* or the backing store is inaccessible.
*
* @return the String array value associated with
* key
, or def
if the
* associated value does not exist.
*
* @exception java.lang.IllegalArgumentException if key
is null
. (A
* null
value for def
is permitted.)
*
* @see #getValue(String,String)
*/
public String[] getValues(String key, String[] def);
/**
* Associates the specified String value with the specified key in this
* preference.
* null
, but null
values
* for the value parameter are allowed.
* String
or String[]
* value it must be replaced by the new value.
*
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
*
* @exception ReadOnlyException
* if this preference cannot be modified for this request
* @exception java.lang.IllegalArgumentException if key is null
,
* or key.length()
* or value.length
are to long. The maximum length
* for key and value are implementation specific.
*
* @see #setValues(String, String[])
*/
public void setValue(String key, String value) throws ReadOnlyException;
/**
* Associates the specified String array value with the specified key in this
* preference.
* null
, but null
values
* in the values parameter are allowed.
* String
or String[]
* value it must be replaced by the new value.
*
* @param key key with which the value is to be associated
* @param values values to be associated with key
*
* @exception java.lang.IllegalArgumentException if key is null
, or
* key.length()
* is to long or value.size
is to large. The maximum
* length for key and maximum size for value are implementation specific.
* @exception ReadOnlyException
* if this preference cannot be modified for this request
*
* @see #setValue(String,String)
*/
public void setValues(String key, String[] values) throws ReadOnlyException;
/**
* Returns all of the keys that have an associated value,
* or an empty Enumeration
if no keys are
* available.
*
* @return an Enumeration of the keys that have an associated value,
* or an empty Enumeration
if no keys are
* available.
*/
public java.util.EnumerationMap
of the preferences.
* Map
are from type
* String array (String[]
).
* Map
.
*
* @return an immutable Map
containing preference names as
* keys and preference values as map values, or an empty Map
* if no preference exist. The keys in the preference
* map are of type String. The values in the preference map are of type
* String array (String[]
).
*/
public java.util.Mapnull
.
* @exception ReadOnlyException
* if this preference cannot be modified for this request
*/
public void reset(String key) throws ReadOnlyException;
/**
* Commits all changes made to the preferences via the
* set
methods in the persistent store.
* store
method are discarded when the
* portlet finishes the processAction
method.
* ValidatorException
is thrown.
*
* @exception java.io.IOException
* if changes cannot be written into
* the backend store
* @exception ValidatorException
* if the validation performed by the
* associated validator fails
* @exception java.lang.IllegalStateException
* if this method is called inside a render call
*
* @see PreferencesValidator
*/
public void store() throws java.io.IOException, ValidatorException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ClientDataRequest.java 0000644 0001750 0001750 00000014074 11201125563 026417 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The ClientDataRequest
represents the request information
* of the HTTP request issued from the client to the portal.
* It extends the PortletRequest interface.
*
* @since 2.0
* @see PortletRequest
*/
public interface ClientDataRequest extends PortletRequest {
/**
* Retrieves the body of the HTTP request from client to
* portal as binary data using
* an InputStream
. Either this method or
* {@link #getReader} may be called to read the body, but not both.
* IllegalStateException
* as this data has been already processed by the
* portal/portlet-container and is available as request parameters.
*
* @return an input stream containing the body of the request
*
* @exception java.lang.IllegalStateException
* if getReader was already called, or it is a
* HTTP POST data of type application/x-www-form-urlencoded
* @exception java.io.IOException
* if an input or output exception occurred
*/
public java.io.InputStream getPortletInputStream () throws java.io.IOException;
/**
* Overrides the name of the character encoding used in the body of this
* request. This method must be called prior to reading input
* using {@link #getReader} or {@link #getPortletInputStream}.
* String
containing the name of
* the character encoding.
*
* @exception java.io.UnsupportedEncodingException if this is not a valid encoding
* @exception java.lang.IllegalStateException if this method is called after
* reading request parameters or reading input using
* getReader()
*/
public void setCharacterEncoding(String enc)
throws java.io.UnsupportedEncodingException;
/**
* Retrieves the body of the HTTP request from the client to the portal
* as character data using
* a BufferedReader
. The reader translates the character
* data according to the character encoding used on the body.
* Either this method or {@link #getPortletInputStream} may be called to read the
* body, not both.
* IllegalStateException
* as this data has been already processed by the
* portal/portlet-container and is available as request parameters.
*
* @return a BufferedReader
* containing the body of the request
*
* @exception java.io.UnsupportedEncodingException
* if the character set encoding used is
* not supported and the text cannot be decoded
* @exception java.lang.IllegalStateException
* if {@link #getPortletInputStream} method
* has been called on this request, it is a
* HTTP POST data of type application/x-www-form-urlencoded.
* @exception java.io.IOException
* if an input or output exception occurred
*
* @see #getPortletInputStream
*/
public java.io.BufferedReader getReader()
throws java.io.UnsupportedEncodingException, java.io.IOException;
/**
* Returns the name of the character encoding used in the body of this request.
* This method returns null
if the request
* does not specify a character encoding.
*
* @return a String
containing the name of
* the character encoding, or null
* if the request does not specify a character encoding.
*/
public java.lang.String getCharacterEncoding();
/**
* Returns the MIME type of the body of the request,
* or null if the type is not known.
*
* @return a String
containing the name
* of the MIME type of the request, or null
* if the type is not known.
*/
public java.lang.String getContentType();
/**
* Returns the length, in bytes, of the request body
* which is made available by the input stream, or -1 if the
* length is not known.
*
*
* @return an integer containing the length of the
* request body or -1 if the length is not known
*
*/
public int getContentLength();
/**
* Returns the name of the HTTP method with which this request was made,
* for example, GET, POST, or PUT.
*
* @since 2.0
* @return a String specifying the name of the HTTP method with which
* this request was made
*/
public String getMethod();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/CacheControl.java 0000644 0001750 0001750 00000013507 11201125563 025402 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The CacheControl
interface represents cache settings
* for a piece of markup. The settings are only valid for the current
* request.
*
* @since 2.0
*/
public interface CacheControl {
/**
* Get the currently set expiration time.
* If no expiration time is set on this response the
* default defined in the portlet deployment descriptor
* with the expiration-cache
tag is returned,
* or
0
if no default is defined.
* getProperty(EXPIRATION_CACHE)
* call.
*
* @return the currently set expiration time in seconds,
* or 0
if no expiration time
* is set.
*/
public int getExpirationTime();
/**
* Sets a new expiration time for the current response
* in seconds.
* setProperty(EXPIRATION_CACHE)
.
*
* @param time expiration time in seconds
*/
public void setExpirationTime(int time);
/**
* Returns a boolean indicating whether the
* caching scope is set to public for the current response.
* If no caching scope is set on this response, the default
* defined in the deployment descriptor with the
* cache-scope
tag is returned,
* or false
if no default is defined.
* getProperty(CACHE_SCOPE).equals(PUBLIC_SCOPE)
.
*
* @return true if the cache scope is public for the
* current response.
*/
public boolean isPublicScope();
/**
* Sets the caching scope for the current response
* to public with true
as
* publicScope
and to private with
* false
as publicScope
.
* (publicScope ? setProperty(CACHE_SCOPE, PUBLIC_SCOPE |
* setProperty(CACHE_SCOPE, PRIVATE_SCOPE)
.
*
* @param publicScope indicating if the cache entry can be shared across users
*/
public void setPublicScope(boolean publicScope);
/**
* Returns the ETag for the current response that is
* used as validation tag, or null
* if no ETag is set on the response.
*
getProperty(ETAG)
.
*
* @return the ETag for the current response that is
* used as validation tag, or null
* if no ETag is set.
*/
public String getETag();
/**
* Sets an ETag for the current response that is
* used as validation tag. If an ETag was already
* set it is replaced with the new value.
*
setProperty(ETAG, token)
.
* null
removes
* the currently set ETag.
*
* @param token the ETag token
*/
public void setETag(String token);
/**
* Returns a boolean indicating whether the
* cached content for the provided ETag at the request
* can still be considerated valid.
* If not set, the default is false
.
* getProperty(USE_CACHED_CONTENT)
and getting a non-null
* value back.
*
* @return boolean indicating whether the
* caching scope is set to public for the current response
*/
public boolean useCachedContent();
/**
* Sets the indication whether the cached content
* for the provided ETag at the request is still valid or not.
* If set to true
no output should be rendered,
* but a new expiration time should be set for the
* markup with the given ETag .
* setProperty(USE_CACHED_CONTENT, "true")
.
*
* @param useCachedContent boolean indication whether the
* the cached content is still valid or not
*/
public void setUseCachedContent(boolean useCachedContent);
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/BaseURL.java 0000644 0001750 0001750 00000022504 11201125563 024270 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The BaseURL
defines the basic capabilities
* of a portlet URL pointing back to the portlet.
*
* @since 2.0
*/
public interface BaseURL {
/**
* Sets the given String parameter to this URL.
* PortletURL
implementation 'x-www-form-urlencoded' encodes
* all parameter names and values. Developers should not encode them.
* null
indicates that this
* parameter should be removed.
*
* @param name
* the parameter name
* @param value
* the parameter value
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public void setParameter (String name, String value);
/**
* Sets the given String array parameter to this URL.
* PortletURL
implementation 'x-www-form-urlencoded' encodes
* all parameter names and values. Developers should not encode them.
* null
.
*/
public void setParameter (String name, String[] values);
/**
* Sets a parameter map for this URL.
* PortletURL
implementation 'x-www-form-urlencoded' encodes
* all parameter names and values. Developers should not encode them.
* String[]
).
*
* @exception java.lang.IllegalArgumentException
* if parameters is null
, if
* any of the keys in the Map are null
,
* if any of the keys is not a String, or if any of
* the values is not a String array.
*/
public void setParameters(java.util.Maptrue
indicates that the portlet requests
* a secure connection between the client and the portlet window for
* this URL. Secure set to false
indicates that the portlet
* does not need a secure connection for this URL. If the security is not
* set for a URL, it should stay the same as the current request.
*
* @param secure true, if portlet requests to have a secure connection
* between its portlet window and the client; false, if
* the portlet does not require a secure connection.
*
* @throws PortletSecurityException if the run-time environment does
* not support the indicated setting
*/
public void setSecure (boolean secure) throws PortletSecurityException;
/**
* Returns the portlet URL string representation to be embedded in the
* markup.
* Note that the returned String may not be a valid URL, as it may
* be rewritten by the portal/portlet-container before returning the
* markup to the client.
* Map
of the parameters
* currently set on this portlet URL via the
* setParameter
or setParameters
* methods.
* Map
are from type
* String array (String[]
).
* Map
.
*
* @return Map
containing parameter names as
* keys and parameter values as map values, or an empty Map
* if no parameters exist. The keys in the parameter
* map are of type String. The values in the parameter map are of type
* String array (String[]
).
*
* @since 2.0
*/
public java.util.Mapnull
.
*
* @since 2.0
*/
public void addProperty(String key, String value);
/**
* Sets a String property on the URL.
* null
.
*
* @since 2.0
*/
public void setProperty(String key, String value);
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ValidatorException.java 0000644 0001750 0001750 00000010213 11201125563 026631 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
/**
* The ValidatorException
is thrown by the
* validate
method of a PreferencesValidator when
* the validation of a preference failed.
*/
public class ValidatorException extends PortletException
{
private transient ArrayListnull
.
*
* @param text
* the exception text
* @param failedKeys
* keys that failed the validation; may be null
*/
public ValidatorException (String text, Collection
*
* null
.
*
* @param text
* the exception text
* @param cause
* the root cause
* @param failedKeys
* keys that failed the validation; may be null
*/
public ValidatorException (String text, Throwable cause, Collectionnull
.
*
* @param cause
* the root cause
* @param failedKeys
* keys that failed the validation; may be null
*/
public ValidatorException (Throwable cause, CollectionEnumeration
if no failed keys are available.
*
* @return the keys that failed validation, or an empty
* Enumeration
if no failed keys are available.
*/
public EnumerationEventPortlet
interface allows
* portlets receiving events.
* supported-processing-event
tag and events published
* via the supported-publishing-event
tag in the portlet
* deployment descriptor.
* RenderResponse
defines an object to assist a portlet in
* sending a response to the portal. It extends the MimeResponse
* interface to provide specific render response functionality to portlets.
* The portlet container creates a RenderResponse
object and
* passes it as argument to the portlet's render
method.
*
* @see RenderRequest
* @see PortletResponse
* @see MimeResponse
*/
public interface RenderResponse extends MimeResponse {
/**
* This method sets the title of the portlet.
* Enumeration
of PortletMode
objects with the
* next possible portlet modes that the make sense from the
* portlet point of view, must not be null
or an
* empty enumeration.
* @since 2.0
*/
public void setNextPossiblePortletModes(java.util.CollectionsetContentType
after getWriter
or
* getOutputStream
does not change the content type.
* render
* calls.
*
* @param type
* the content MIME type
*
* @throws java.lang.IllegalArgumentException
* if the given type is not in the list
* returned by PortletRequest.getResponseContentTypes
*
* @see PortletRequest#getResponseContentTypes
* @see #getContentType
*/
public void setContentType(String type);
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ReadOnlyException.java 0000644 0001750 0001750 00000004562 11201125563 026433 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The ReadOnlyException
is thrown when a portlet tries
* to change the value for a read-only preference attribute.
*/
public class ReadOnlyException extends PortletException
{
private static final long serialVersionUID = 1L;
private ReadOnlyException ()
{
}
/**
* Constructs a new read-only exception with the given text. The
* portlet container may use the text write it to a log.
*
* @param text
* the exception text
*/
public ReadOnlyException (String text)
{
super (text);
}
/**
* Constructs a new read-only exception when the portlet needs to do
* the following:
*
*
*
* @param text
* the exception text
* @param cause
* the root cause
*/
public ReadOnlyException (String text, Throwable cause)
{
super(text, cause);
}
/**
* Constructs a new read-only exception when the portlet needs to throw an
* exception. The exception message is based on the localized message
* of the underlying exception.
*
* @param cause
* the root cause
*/
public ReadOnlyException (Throwable cause)
{
super(cause);
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletException.java 0000644 0001750 0001750 00000004624 11201125563 026346 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The PortletException
class defines a general exception
* that a portlet can throw when it is unable to perform its operation
* successfully.
*/
public class PortletException extends java.lang.Exception
{
private static final long serialVersionUID = 1L;
/**
* Constructs a new portlet exception.
*/
public PortletException ()
{
super();
}
/**
* Constructs a new portlet exception with the given text. The
* portlet container may use the text write it to a log.
*
* @param text
* the exception text
*/
public PortletException (String text)
{
super (text);
}
/**
* Constructs a new portlet exception when the portlet needs to do
* the following:
*
*
*
* @param text
* the exception text
* @param cause
* the root cause
*/
public PortletException (String text, Throwable cause)
{
super(text, cause);
}
/**
* Constructs a new portlet exception when the portlet needs to throw an
* exception. The exception's message is based on the localized message
* of the underlying exception.
*
* @param cause
* the root cause
*/
public PortletException (Throwable cause)
{
super(cause);
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/EventRequest.java 0000644 0001750 0001750 00000004007 11201125563 025463 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The EventRequest
represents the request sent to the portlet
* to handle an event.
* It extends the PortletRequest interface to provide event request
* information to portlets.
* The portlet container creates an EventRequest
object and
* passes it as argument to the portlet's processEvent
method.
*
* @see ActionRequest
* @see PortletRequest
* @since 2.0
*/
public interface EventRequest extends PortletRequest {
/**
* Returns the event that triggered the call to the processEvent method.
*
* @return the event that triggered the current processEvent call.
*/
public Event getEvent();
/**
* Returns the name of the HTTP method with which the original action request was made,
* for example, POST, or PUT.
*
* @since 2.0
* @return a String specifying the name of the HTTP method with which
* this request was made
*/
public String getMethod();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ActionResponse.java 0000644 0001750 0001750 00000011222 11201125563 025762 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The ActionResponse
interface represents the portlet
* response to an action request.
* It extends the StateAwareResponse
interface to provide specific
* action response functionality to portlets.
* The portlet container creates an ActionResponse
object and
* passes it as argument to the portlet's processAction
method.
*
* @see StateAwareResponse
* @see PortletResponse
* @see ActionRequest
*/
public interface ActionResponse extends StateAwareResponse
{
/**
* Instructs the portlet container to send a redirect response
* to the client using the specified redirect location URL.
* http://my.co/myportal/mywebap/myfolder/myresource.gif
)
* or a full path URI (e.g. /myportal/mywebap/myfolder/myresource.gif
).
* If required,
* the portlet container may encode the given URL before the
* redirection is issued to the client.
*
*
*
* @param location the redirect location URL
*
* @exception java.io.IOException
* if an input or output exception occurs.
* @exception java.lang.IllegalArgumentException
* if a relative path URL is given
* @exception java.lang.IllegalStateException
* if the method is invoked after any of above mentioned methods of
* the ActionResponse interface has been called.
*/
public void sendRedirect(String location)
throws java.io.IOException;
/**
* Instructs the portlet container to send a redirect response
* to the client using the specified redirect location URL and
* encode a render URL as parameter on the redirect URL.
* http://my.co/myportal/mywebap/myfolder/myresource.gif
)
* or a full path URI (e.g. /myportal/mywebap/myfolder/myresource.gif
).
* If required,
* the portlet container may encode the given URL before the
* redirection is issued to the client.
* ActionResponse
and the current public render parameters.
* The attached URL will be available as query parameter value under the key provided with the
* renderUrlParamName
parameter.
*
*
* are only used for creating the render URL and not remembered after the redirect
* is issued.
*
* @param location the redirect location URL
* @param renderUrlParamName name of the query parameter under which the portlet container should
* store a render URL to this portlet
*
* @exception java.io.IOException
* if an input or output exception occurs.
* @exception java.lang.IllegalArgumentException
* if a relative path URL is given
*
* @since 2.0
*/
public void sendRedirect(String location, String renderUrlParamName)
throws java.io.IOException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletSecurityException.java 0000644 0001750 0001750 00000004732 11201125563 030076 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* A portlet should throw a PortletSecurityException
* when a call fails because of security reasons.
* Additionally it can be thrown by the portal/portlet-container.
*/
public class PortletSecurityException extends PortletException
{
private static final long serialVersionUID = 1L;
private PortletSecurityException ()
{
}
/**
* Constructs a new security exception with the given text. The
* portlet container may use the text write it to a log.
*
* @param text
* the exception text
*/
public PortletSecurityException (String text)
{
super (text);
}
/**
* Constructs a new portlet security exception when the portlet needs to do
* the following:
*
*
*
* @param text
* the exception text
* @param cause
* the root cause
*/
public PortletSecurityException (String text, Throwable cause)
{
super(text, cause);
}
/**
* Constructs a new portlet security exception when the portlet needs to throw an
* exception. The exception message is based on the localized message
* of the underlying exception.
*
* @param cause
* the root cause
*/
public PortletSecurityException (Throwable cause)
{
super(cause);
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletURL.java 0000644 0001750 0001750 00000012216 11201125563 025046 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The PortletURL
interface represents a URL
* that reference the portlet itself.
* RenderResponse
* or ResourceResponse
.
* Parameters, a portlet mode, a window state and a security level
* can be added to PortletURL
objects.
*
*
* createActionURL
, and
* trigger an action request followed by a render request.
* createRenderURL
, and
* trigger a render request.
* PortletRequest.isWindowStateAllowed()
method can be used
* to check if the portlet can set a given window state.
* @see PortletRequest#isWindowStateAllowed
*/
public void setWindowState (WindowState windowState)
throws WindowStateException;
/**
* Indicates the portlet mode the portlet must be in, if this
* portlet URL triggers a request.
* PortletRequest.isPortletModeAllowed()
method can be used
* to check if the portlet can set a given portlet mode.
* @see PortletRequest#isPortletModeAllowed
*/
public void setPortletMode (PortletMode portletMode)
throws PortletModeException;
/**
* Returns the currently set portlet mode on this PortletURL.
*
* @since 2.0
*
* @return the portlet mode, or null
if none is set
*/
public PortletMode getPortletMode ();
/**
* Returns the currently set window state on this PortletURL.
*
* @since 2.0
*
* @return the window state, or null
if none is set
*/
public WindowState getWindowState ();
/**
* Removes the specified public render parameter.
* The name must reference a public render parameter defined
* in the portlet deployment descriptor under the
* public-render-parameter
element with the
* identifier
mapping to the parameter name.
* String
specifying
* the name of the public render parameter to be removed
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
* @since 2.0
*/
public void removePublicRenderParameter(String name);
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ProcessEvent.java 0000644 0001750 0001750 00000004347 11201125563 025460 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* Annotation for marking a method for handling
* a specific event.
* The GenericPortlet
tries to dispatch to methods annotated
* with the tag @ProcessEvent
for any received event.
*
* @since 2.0
*/
@Target(ElementType.METHOD)
@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
public @interface ProcessEvent {
/**
* Event QName.
* Must be in the format:
* "{" + Namespace URI + "}" + local part.
* If the Namespace URI equals(XMLConstants.NULL_NS_URI),
* only the local part is used
* (like the javax.xml.namespace.QName.toString()
method).
*
* @return event QName.
*/
String qname() default "";
/**
* Local part of the event name.
* The namespace for the events is either taken from the default-event-namespace
element
* in the portlet deployment descriptor, or if this element is not provided
* the XML default namespace XMLConstants.NULL_NS_URI is used.
*
* @return local part of the event name.
*/
String name() default "";
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ResourceResponse.java 0000644 0001750 0001750 00000011765 11201125563 026350 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The ResourceResponse
defines an object to assist a portlet
* for rendering a resource.
* RenderResponse
is that for the
* ResourceResponse
the output of this response is delivered
* directly to the client without any additional markup added by the portal.
* It is therefore allowed for the portlet to return binary content in this
* response.
* ResourceResponse
.
* To be successfully transmitted back to the client, headers must be set
* before the response is committed. Headers set after the response is
* committed will be ignored by the portlet container.
* ResourceResponse
object and
* passes it as argument to the portlet's serveResource
method.
*
* @see ResourceServingPortlet
* @see MimeResponse
* @since 2.0
*/
public interface ResourceResponse extends MimeResponse {
/**
* Constant for setting the HTTP status code via the
* setProperty
method.
*/
public static final String HTTP_STATUS_CODE = "portlet.http-status-code";
/**
* Sets the locale of the response, setting the headers
* (including the Content-Type's charset) as appropriate.
* This method should be called before a call to getWriter().
* By default, the response locale is the default locale provided
* by the portlet container.
*
* @param loc the new locale of the response
*/
public void setLocale(java.util.Locale loc);
/**
* Sets the character encoding (MIME charset) of the response being
* sent to the client, for example, to UTF-8. If the character encoding
* has already been set by either the portlet container,
* setContentType(java.lang.String)
or
* setLocale(java.util.Locale)
, this method overrides it. Calling
* setContentType(java.lang.String)
with the String of
* text/html
and calling this method with the String of
* UTF-8
is equivalent with calling setContentType
* with the String of text/html; charset=UTF-8
.
* serveResource
call
* is not PAGE
and thus does not allow
* for creating render URLs.
*/
public PortletURL createRenderURL();
/**
* @throws java.lang.IllegalStateException
* if the cacheability level of the resource URL
* triggering this serveResource
call
* is not PAGE
and thus does not allow
* for creating action URLs.
*/
public PortletURL createActionURL();
/**
* @throws java.lang.IllegalStateException
* if the cacheability level of the resource URL
* triggering this serveResource
call,
* or one of the parent calls, have defined a stricter
* cachability level.
*/
public ResourceURL createResourceURL();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/GenericPortlet.java 0000644 0001750 0001750 00000066127 11201125563 025772 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.xml.namespace.QName;
/**
* The GenericPortlet
class provides a default implementation for
* the Portlet
interface.
* GenericPortlet
should either use one of the following annotations:
*
*
* or override at least one method, usually
* one of the following:
* @ProcessAction
@ProcessEvent
@RenderMode
*
* PortletConfig
object
* and checks for annotated methods with the annotations
*
*
* and stores these in a hashmap for later dispatching.
* init
method exactly once
* after instantiating the portlet. The init
method must
* complete successfully before the portlet can receive any requests.
*
* init
method does one of the following:
*
*
*
*
* @param config
* a PortletException
* PortletConfig
object containing the portlet
* configuration and initialization parameters
*
* @exception PortletException
* if an exception has occurred that interferes with the
* portlet normal operation.
* @exception UnavailableException
* if the portlet cannot perform the initialization at this
* time.
*/
public void init(PortletConfig config) throws PortletException {
this.config = config;
cacheAnnotatedMethods();
this.init();
}
/**
*
* A convenience method which can be overridden so that there's no need to
* call super.init(config)
.
*
* GenericPortlet.init(PortletConfig config)
. The
* PortletConfig
object can still be retrieved via {@link
* #getPortletConfig}.
*
* @exception PortletException
* if an exception has occurred that interferes with the
* portlet normal operation.
* @exception UnavailableException
* if the portlet is unavailable to perform init
*/
public void init() throws PortletException {
}
/**
* Called by the portlet container to allow the portlet to process an action
* request. This method is called if the client request was originated by a
* URL created (by the portlet) with the
* RenderResponse.createActionURL()
method.
* @ProcessAction that matches the action parameter
* value
ActionRequest.ACTION_NAME
or, if no
* such method is found throws a PortletException
.
* Note that the annotated methods needs to be public in order
* to be allowed to be called by GenericPortlet
.
*
* @param request
* the action request
* @param response
* the action response
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to process the action at
* this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of
* security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*/
public void processAction(ActionRequest request, ActionResponse response) throws PortletException,
java.io.IOException {
String action = request.getParameter(ActionRequest.ACTION_NAME);
try {
// check if action is cached
Method actionMethod = processActionHandlingMethodsMap.get(action);
if (actionMethod != null) {
actionMethod.invoke(this, request, response);
return;
}
} catch (Exception e) {
throw new PortletException(e);
}
// if no action processing method was found throw exc
throw new PortletException("processAction method not implemented");
}
/**
* The default implementation of this method sets the headers using the
* doHeaders
method, sets the title using the
* getTitle
method and invokes the doDispatch
* method.
* RENDER_PART
request attribute and if
* set calls the doHeaders, getNextPossiblePortletModes
and
* getTitle
methods for the RENDER_HEADERS
* part and the doDispatch
method for the
* RENDER_MARKUP
part.
* If the RENDER_PART
request attribute is not set all of the
* above methods will be called.
*
* @param request
* the render request
* @param response
* the render response
*
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this
* time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of
* security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*
*/
public void render(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException {
Object renderPartAttrValue = request.getAttribute(RenderRequest.RENDER_PART);
if (renderPartAttrValue != null) {
// streaming portal calling
if (renderPartAttrValue.equals(RenderRequest.RENDER_HEADERS)) {
doHeaders(request, response);
Collection
*
*
* @return the portlet title for this window
* @throws java.lang.IllegalStateException
* if no portlet config object is available
*/
protected java.lang.String getTitle(RenderRequest request) {
if (config == null)
throw new java.lang.IllegalStateException(
"Config is null, please ensure that your init(config) method calls super.init(config)");
return config.getResourceBundle(request.getLocale()).getString("javax.portlet.title");
}
/**
* The default implementation of this method routes the render request to:
*
*
@RenderMode and the name of the
* portlet mode
*
* doView
for handling view
requestsdoEdit
for handling edit
requestsdoHelp
for handling help
requestsminimized
, this
* method does not invoke any of the portlet mode rendering methods.
* @RenderMode
annotation or override this
* method. Note that the annotated methods needs to be public in order
* to be allowed to be called by GenericPortlet
.
*
* @param request
* the render request
* @param response
* the render response
*
* @exception PortletException
* if the portlet cannot fulfilling the request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this
* time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of
* security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*
* @see #doView(RenderRequest, RenderResponse)
* @see #doEdit(RenderRequest, RenderResponse)
* @see #doHelp(RenderRequest, RenderResponse)
*/
protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException,
java.io.IOException {
WindowState state = request.getWindowState();
if (!state.equals(WindowState.MINIMIZED)) {
PortletMode mode = request.getPortletMode();
// first look if there are methods annotated for
// handling the rendering of this mode
try {
// check if mode is cached
Method renderMethod = renderModeHandlingMethodsMap.get(mode.toString());
if (renderMethod != null) {
renderMethod.invoke(this, request, response);
return;
}
} catch (Exception e) {
throw new PortletException(e);
}
// if not, try the default doXYZ methods
if (mode.equals(PortletMode.VIEW)) {
doView(request, response);
} else if (mode.equals(PortletMode.EDIT)) {
doEdit(request, response);
} else if (mode.equals(PortletMode.HELP)) {
doHelp(request, response);
} else {
throw new PortletException("unknown portlet mode: " + mode);
}
}
}
/**
* Helper method to serve up the mandatory view
mode.
* edit
mode.
* help
mode.
* PortletContext
of the portlet application the
* portlet is in.
*
* @return the portlet application context
*/
public PortletContext getPortletContext() {
if (config == null)
throw new java.lang.IllegalStateException(
"Config is null, please ensure that your init(config) method calls super.init(config)");
return config.getPortletContext();
}
/**
* Gets the resource bundle for the given locale based on the resource
* bundle defined in the deployment descriptor with
* resource-bundle
tag or the inlined resources defined in
* the deployment descriptor.
*
* @return the resource bundle for the given locale
*/
public java.util.ResourceBundle getResourceBundle(java.util.Locale locale) {
if (config == null)
throw new java.lang.IllegalStateException(
"Config is null, please ensure that your init(config) method calls super.init(config)");
return config.getResourceBundle(locale);
}
/**
* Returns a String containing the value of the named initialization * parameter, or null if the parameter does not exist.
*
* @param name
* a String
specifying the name of the
* initialization parameter
*
* @return a String
containing the value of the
* initialization parameter
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public String getInitParameter(java.lang.String name) {
if (config == null)
throw new java.lang.IllegalStateException(
"Config is null, please ensure that your init(config) method calls super.init(config)");
return config.getInitParameter(name);
}
/**
* Returns the names of the portlet initialization parameters as an
* Enumeration of String objects, or an empty Enumeration if the portlet has
* no initialization parameters.
*
* @return an Enumeration
of String
objects
* containing the names of the portlet initialization parameters, or
* an empty Enumeration if the portlet has no initialization
* parameters.
*/
public java.util.Enumeration@ProcessEvent that matches the
* event name or, if no
* such method is found just sets the current render parameters on
* the response.
* Note that the annotated methods needs to be public in order
* to be allowed to be called by GenericPortlet
.
*
* @see javax.portlet.EventPortlet#processEvent(javax.portlet.EventRequest,
* javax.portlet.EventResponse)
* @since 2.0
*/
public void processEvent(EventRequest request, EventResponse response) throws PortletException, IOException {
String eventName = request.getEvent().getQName().toString();
try {
// check for exact match
Method eventMethod = processEventHandlingMethodsMap.get(eventName);
if (eventMethod != null) {
eventMethod.invoke(this, request, response);
return;
} else {
// Search for the longest possible matching wildcard annotation
int endPos = eventName.indexOf('}');
int dotPos = eventName.lastIndexOf('.');
while (dotPos > endPos) {
String wildcardLookup = eventName.substring(0, dotPos + 1);
eventMethod = processEventHandlingMethodsMap.get(wildcardLookup);
if (eventMethod != null) {
eventMethod.invoke(this, request, response);
return;
}
if (dotPos == 0) {
break;
}
dotPos = eventName.lastIndexOf('.', dotPos - 1);
}
}
} catch (Exception e) {
throw new PortletException(e);
}
// if no event processing method was found just keep render params
response.setRenderParameters(request);
}
/**
* Used by the render method to set the response properties and headers.
* null
.
*
* @since 2.0
*/
protected java.util.CollectionEnumeration
of String objects, or an empty
* Enumeration
if the portlet has no public render
* parameters.
*
* @return an Enumeration
of String
objects
* containing the names of the public render parameters, or an empty
* Enumeration
if the portlet does not define any
* public render parameters.
*
* @see javax.portlet.PortletConfig#getPublicRenderParameterNames()
*/
public Enumerationdefault-namespace
element.
* XMLConstants.NULL_NS_URI
.
*
* @return the default namespace defined in the portlet deployment
* descriptor, or XMLConstants.NULL_NS_URI
is non is
* defined.
*
* @see javax.portlet.PortletConfig#getDefaultNamespace()
*/
public String getDefaultNamespace() {
if (config == null)
throw new java.lang.IllegalStateException(
"Config is null, please ensure that your init(config) method calls super.init(config)");
return config.getDefaultNamespace();
}
private void cacheAnnotatedMethods() {
// cache all annotated and visible public methods
for (Method method : this.getClass().getMethods()) {
Annotation[] annotations = method.getAnnotations();
if (annotations != null) {
for (Annotation annotation : annotations) {
Class extends Annotation> annotationType = annotation.annotationType();
if (ProcessAction.class.equals(annotationType)) {
String name = ((ProcessAction) annotation).name();
if (name != null && name.length() > 0)
processActionHandlingMethodsMap.put(name, method);
} else if (ProcessEvent.class.equals(annotationType)) {
String qname = ((ProcessEvent) annotation).qname();
if (qname == null || qname.length() <= 0) {
if (config == null)
throw new java.lang.IllegalStateException(
"Config is null, please ensure that your init(config) method calls super.init(config)");
String name = ((ProcessEvent) annotation).name();
if (name != null && name.length() > 0) {
qname = new QName(config.getDefaultNamespace(), name).toString();
processEventHandlingMethodsMap.put(qname, method);
}
} else
processEventHandlingMethodsMap.put(qname, method);
} else if (RenderMode.class.equals(annotationType)) {
String name = ((RenderMode) annotation).name();
if (name != null && name.length() > 0)
renderModeHandlingMethodsMap.put(name.toLowerCase(), method);
}
}
}
}
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/WindowState.java 0000644 0001750 0001750 00000010464 11201125563 025305 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
import java.util.Locale;
/**
* The WindowState
class represents
* the possible window states that a portlet window can assume.
* NORMAL
window state indicates that a portlet
* may be sharing the page with other portlets. It may also
* indicate that the target device has limited display capabilities.
* Therefore, a portlet should restrict the size of its rendered
* output in this window state.
* "normal"
.
*/
public final static WindowState NORMAL = new WindowState ("normal");
/**
* The MAXIMIZED
window state is an indication
* that a portlet may be the only portlet being rendered in the
* portal page, or that the portlet has more space compared to other portlets
* in the portal page. A portlet may generate richer content
* when its window state is MAXIMIZED
.
* "maximized"
.
*/
public final static WindowState MAXIMIZED = new WindowState ("maximized");
/**
* When a portlet is in MINIMIZED
window state,
* the portlet should only render minimal output or no output at all.
* "minimized"
.
*/
public final static WindowState MINIMIZED = new WindowState ("minimized");
private String _name;
/**
* Creates a new window state with the given name.
* true
if the
* Strings equals
method for the String
* representing the two window states returns true
.
*
* @param object the window state to compare this window state with.
*
* @return true, if the specified object is equal with this window state.
*/
public boolean equals(Object object) {
if ( object instanceof WindowState )
return _name.equals(((WindowState) object)._name);
else
return false;
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/RenderMode.java 0000644 0001750 0001750 00000003147 11201125563 025061 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* Annotation for marking a method for handling
* a specific portlet mode in the render phase.
* The GenericPortlet
tries to dispatch to methods annotated
* with the tag @RenderMode
for any received render call.
*
* @since 2.0
*/
@Target(ElementType.METHOD)
@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
public @interface RenderMode {
/**
* Name of the render mode.
*
* @return render mode name
*/
String name();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletSession.java 0000644 0001750 0001750 00000035647 11201125563 026044 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
import java.util.Map;
/**
* The PortletSession
interface provides a way to identify a user
* across more than one request and to store transient information about that user.
* PortletSession
is created per user client per portlet application.
* PortletSession
by name.
* The PortletSession
interface defines two scopes for storing objects:
*
*
* All objects stored in the session using the APPLICATION_SCOPE
* PORTLET_SCOPE
* APPLICATION_SCOPE
* must be available to all the portlets, servlets and
* JSPs that belongs to the same portlet application and that handles a
* request identified as being a part of the same session.
* Objects stored in the session using the PORTLET_SCOPE
must be
* available to the portlet during requests for the same portlet window
* that the objects where stored from. Attributes stored in the
* PORTLET_SCOPE
are not protected from other web components
* of the portlet application. They are just conveniently namespaced.
* HttpSession
. Therefore all
* HttpSession
listeners do apply to the portlet session and
* attributes set in the portlet session are visible in the HttpSession
* and vice versa.
*/
public interface PortletSession
{
/**
* This constant defines an application wide scope for the session attribute.
* APPLICATION_SCOPE
session attributes enable Portlets
* within one portlet application to share data.
* 0x01
*/
public static final int APPLICATION_SCOPE = 0x01;
/**
* This constant defines the scope of the session attribute to be
* private to the portlet and its included resources.
* 0x02
*/
public static final int PORTLET_SCOPE = 0x02;
/**
* Returns the object bound with the specified name in this session
* under the PORTLET_SCOPE
, or null
if no
* object is bound under the name in that scope.
*
* @param name a string specifying the name of the object
*
* @return the object with the specified name for
* the PORTLET_SCOPE
.
*
* @exception java.lang.IllegalStateException if this method is called on an
* invalidated session.
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public java.lang.Object getAttribute(java.lang.String name);
/**
* Returns the object bound with the specified name in this session,
* or null
if no object is bound under the name in the given scope.
*
* @param name a string specifying the name of the object
* @param scope session scope of this attribute
*
* @return the object with the specified name
*
* @exception java.lang.IllegalStateException if this method is called on an
* invalidated session, or the scope is unknown to the container.
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public java.lang.Object getAttribute(java.lang.String name,int scope);
/**
* Returns an Enumeration
of String objects containing the names of
* all the objects bound to this session under the PORTLET_SCOPE
, or an
* empty Enumeration
if no attributes are available.
*
* @return an Enumeration
of
* String
objects specifying the
* names of all the objects bound to
* this session, or an empty Enumeration
* if no attributes are available.
*
* @exception java.lang.IllegalStateException if this method is called on an
* invalidated session
*/
public java.util.EnumerationEnumeration
of String objects containing the names of
* all the objects bound to this session in the given scope, or an
* empty Enumeration
if no attributes are available in the
* given scope.
*
* @param scope session scope of the attribute names
*
* @return an Enumeration
of
* String
objects specifying the
* names of all the objects bound to
* this session, or an empty Enumeration
* if no attributes are available in the given scope.
*
* @exception java.lang.IllegalStateException if this method is called on an
* invalidated session, or the scope is unknown to the container.
*/
public java.util.Enumerationlong
specifying
* when this session was created,
* expressed in
* milliseconds since 1/1/1970 GMT
*
* @exception java.lang.IllegalStateException if this method is called on an
* invalidated session
*/
public long getCreationTime();
/**
* Returns a string containing the unique identifier assigned to this session.
*
* @return a string specifying the identifier
* assigned to this session
*/
public java.lang.String getId();
/**
* Returns the last time the client sent a request associated with this session,
* as the number of milliseconds since midnight January 1, 1970 GMT.
*
* long
* representing the last time
* the client sent a request associated
* with this session, expressed in
* milliseconds since 1/1/1970 GMT
*/
public long getLastAccessedTime();
/**
* Returns the maximum time interval, in seconds, for which the portlet container
* keeps this session open between client accesses. After this interval,
* the portlet container invalidates the session. The maximum time
* interval can be set
* with the setMaxInactiveInterval
method.
* A negative time indicates the session should never timeout.
*
* @return an integer specifying the number of
* seconds this session remains open
* between client requests
*
* @see #setMaxInactiveInterval
*/
public int getMaxInactiveInterval();
/**
* Invalidates this session (all scopes) and unbinds any objects bound to it.
* HttpSession
*
* @exception java.lang.IllegalStateException if this method is called on a
* session which has already been invalidated
*/
public void invalidate();
/**
* Returns true if the client does not yet know about the session or
* if the client chooses not to join the session.
*
* @return true
if the
* server has created a session,
* but the client has not joined yet.
*
* @exception java.lang.IllegalStateException if this method is called on a
* session which has already been invalidated
*
*/
public boolean isNew();
/**
* Removes the object bound with the specified name under
* the PORTLET_SCOPE
from
* this session. If the session does not have an object
* bound with the specified name, this method does nothing.
*
* @param name the name of the object to be
* removed from this session in the
* PORTLET_SCOPE
.
*
* @exception java.lang.IllegalStateException
* if this method is called on a
* session which has been invalidated
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public void removeAttribute(String name) ;
/**
* Removes the object bound with the specified name and the given scope from
* this session. If the session does not have an object
* bound with the specified name, this method does nothing.
*
* @param name the name of the object to be
* removed from this session
* @param scope session scope of this attribute
*
* @exception java.lang.IllegalStateException
* if this method is called on a
* session which has been invalidated
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public void removeAttribute(String name, int scope) ;
/**
* Binds an object to this session under the PORTLET_SCOPE
, using the name specified.
* If an object of the same name in this scope is already bound to the session,
* that object is replaced.
*
* HttpSessionBindingListener
,
* the container calls
* HttpSessionBindingListener.valueBound
. The container then
* notifies any HttpSessionAttributeListeners
in the web
* application.
* HttpSessionBindingListener
, its
* HttpSessionBindingListener.valueUnbound
method is called.
*
* null
, this has the same effect as calling
* removeAttribute()
.
*
*
* @param name the name to which the object is bound under
* the PORTLET_SCOPE
;
* this cannot be null
.
* @param value the object to be bound
*
* @exception java.lang.IllegalStateException if this method is called on a
* session which has been invalidated
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public void setAttribute(java.lang.String name, java.lang.Object value);
/**
* Binds an object to this session in the given scope, using the name specified.
* If an object of the same name in this scope is already bound to the session,
* that object is replaced.
*
* HttpSessionBindingListener
,
* the container calls
* HttpSessionBindingListener.valueBound
. The container then
* notifies any HttpSessionAttributeListeners
in the web
* application.
* HttpSessionBindingListener
, its
* HttpSessionBindingListener.valueUnbound
method is called.
*
* null
, this has the same effect as calling
* removeAttribute()
.
*
*
* @param name the name to which the object is bound;
* this cannot be null
.
* @param value the object to be bound
* @param scope session scope of this attribute
*
* @exception java.lang.IllegalStateException if this method is called on a
* session which has been invalidated
* @exception java.lang.IllegalArgumentException
* if name is null
or scope is unknown to the container.
*/
public void setAttribute(java.lang.String name, java.lang.Object value, int scope);
/**
* Specifies the time, in seconds, between client requests, before the
* portlet container invalidates this session. A negative time
* indicates the session should never timeout.
*
* @param interval An integer specifying the number
* of seconds
*/
public void setMaxInactiveInterval(int interval);
/**
* Returns the portlet application context associated with this session.
*
* @return the portlet application context
*/
public PortletContext getPortletContext ();
/**
* Returns a Map
of the session attributes in
* the portlet session scope.
* String
and the values in the
* returned Map
are from type Object
.
* Map
.
*
* @return an immutable Map
containing the session attributes in the
* portlet session scope as keys and attribute values as map values, or an empty Map
* if no session attributes exist. The keys in the
* map are of type String, the values of type
* Object.
* @since 2.0
*/
public MapMap
of the session attributes in
* the given session scope.
* String
and the values in the
* returned Map
are from type Object
.
* Map
.
*
* @param scope session scope of this attribute
*
* @return an immutable Map
containing the session attributes in the
* given scope as keys and attribute values as map values, or an empty Map
* if no session attributes exist. The keys in the
* map are of type String, the values of type
* Object.
* @since 2.0
*/
public MapActionRequest
represents the request sent to the portlet
* to handle an action.
* It extends the ClientDataRequest interface and provides action request
* information to portlets.
* ActionRequest
object and
* passes it as argument to the portlet's processAction
method.
*
* @see ClientDataRequest
*/
public interface ActionRequest extends ClientDataRequest
{
/**
* Predefined action name for usage with the
* @ProcessAction
annotation.
*
* @since 2.0
*/
public static final String ACTION_NAME = "javax.portlet.action";
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortalContext.java 0000644 0001750 0001750 00000007736 11201125563 025653 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The PortalContext
interface gives the portlet
* the ability to retrieve information about the portal calling this portlet.
* PortalContext
data.
*/
public interface PortalContext
{
/**
* Property indicating if the portal application supports the
* MimeResponse
property MARKUP_HEAD_ELEMENT
.
* MARKUP_HEAD_ELEMENT
property.
* "javax.portlet.markup.head.element.support"
.
*
* @since 2.0
*/
public static final String MARKUP_HEAD_ELEMENT_SUPPORT = "javax.portlet.markup.head.element.support";
/**
* Returns the portal property with the given name,
* or a null
if there is
* no property by that name.
*
* @param name property name
*
* @return portal property with key name
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
*/
public java.lang.String getProperty(java.lang.String name);
/**
* Returns all portal property names, or an empty
* Enumeration
if there are no property names.
*
* @return All portal property names as an
* Enumeration
of String
objects
*/
public java.util.EnumerationPortletMode
objects.
* EDIT, HELP, VIEW
.
*
* @return All supported portal modes by the portal
* as an enumeration of PortletMode
objects.
*/
public java.util.EnumerationWindowState
objects.
* MINIMIZED, NORMAL, MAXIMIZED
.
*
* @return All supported window states by the portal
* as an enumeration of WindowState
objects.
*/
public java.util.EnumerationPluto/1.0
.
* Pluto/1.0
* (JDK 1.3.1; Windows NT 4.0 x86)
.
*
* @return a String
containing at least the portal name and version number
*/
public java.lang.String getPortalInfo();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/RenderRequest.java 0000644 0001750 0001750 00000004632 11201125563 025625 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The RenderRequest
represents the request sent to the portlet
* to handle a render.
* It extends the PortletRequest interface to provide render request
* information to portlets.
* The portlet container creates a RenderRequest
object and
* passes it as argument to the portlet's render
method.
*
* @see PortletRequest
* @see ActionRequest
*/
public interface RenderRequest extends PortletRequest
{
/**
* This property is set by the container if the portlet container
* has a cached response for the given validation tag. The property can be
* retrieved using the getProperty
method.
* "portlet.ETag "
.
*
* @since 2.0
*/
public static final String ETAG = "portlet.ETag";
/**
* Returns the validation tag if the portlet container
* has a cached response for this validation tag, or
* null
if no cached response exists.
* RenderRequest.getProperty(RenderRequest.ETAG)
.
*
* @return the validation tag if the portlet container
* has a cached response for this validation tag, or
* null
if no cached response exists.
*
* @since 2.0
*/
public String getETag();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/UnavailableException.java 0000644 0001750 0001750 00000010436 11201125563 027136 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The portlet should throw the UnavailableException
when
* the portlet is either temporarily or permanently unavailable to handle requests.
*
**/
public class UnavailableException extends PortletException
{
private boolean permanent; // needs admin action?
private int seconds; // unavailability estimate
private static final long serialVersionUID = 1L;
/**
*
* Constructs a new exception with a descriptive
* message indicating that the portlet is permanently
* unavailable.
*
* @param text a String
specifying the
* descriptive message
*
*/
public UnavailableException(String text) {
super(text);
permanent = true;
}
/**
* Constructs a new exception with a descriptive message
* indicating that the portlet is temporarily unavailable
* and giving an estimate of how long it will be unavailable.
*
* seconds
argument.
*
* @param text a String
specifying the
* descriptive message. This message can be written
* to a log file or displayed for the user.
*
* @param seconds an integer specifying the number of seconds
* for which the portlet expects to be unavailable; if
* this is zero or negative, it indicates that the portlet
* cannot make an estimate.
*
*/
public UnavailableException(String text, int seconds) {
super(text);
if (seconds <= 0)
this.seconds = -1;
else
this.seconds = seconds;
permanent = false;
}
/**
*
* Returns a boolean
indicating
* whether the portlet is permanently unavailable.
* If so, something is wrong with the portlet, and the
* system administrator must take some corrective action.
*
* @return true
if the portlet is
* permanently unavailable; false
* if the portlet is temporarily
* unavailable.
*
*/
public boolean isPermanent() {
return permanent;
}
/**
* Returns the time in seconds for which the portlet can be expected to
* be unavailable.
* ResourceURL
defines a resource URL that when clicked will
* result in a serveResource
call of the
* ResourceServingPortlet
interface.
* FULL, PORTLET
or PAGE
and denotes
* the cacheability of the resource in the browser.
* PAGE
if no parent resource URL is
* available.
*
* @since 2.0
*/
public interface ResourceURL extends BaseURL {
/**
* The URL of type FULL
does not need to contain the current
* state of the page or the current render parameters, portlet mode, or
* window state of the portlet. Thus the portlet may not be able to
* access the portlet mode, window state, or render parameters in the
* serveResource
call.
* FULL
are allowed in the response.
* The same restriction is true for all downstream URLs that result from
* this response call. Attempts to create URLs that are not of type
* FULL
will result in an IllegalStateException
.
* FULL
have the highest cacheability in the
* browser as they do not depend on any state of the portlet or page.
*/
public static final String FULL = "cacheLevelFull";
/**
* The URL of type PORTLRET
does not need to contain the
* current state of the page, but the current render parameters, portlet
* mode, or window state of the portlet must be accessible to the portlet.
* PORTLET
or FULL
are
* allowed in the response. The same restriction
* is true for all downstream URLs that result from this response.
* Attempts to create URLs that are not of type
* PORTLET
or FULL
will result in an
* IllegalStateException
.
* PORTLET
are cacheable on the portlet
* level in the browser and can be served from the browser cache for as long
* as the state of this portlet does not change.
*/
public static final String PORTLET = "cacheLevelPortlet";
/**
* The URL of type PAGE
may contain artifacts that require
* knowledge of the state of the complete page, like
* PortletURLs
.
* PAGE
are only cacheable on the page level
* and can only be served from the browser cache as long as no state on the
* page changes.
*/
public static final String PAGE = "cacheLevelPage";
/**
* Property that the portlet can set for resources with caching
* type FULL
via the setProperty
method
* on the ResourceURL
.
* javax.xml.namespace.QName.toString()
.
*/
public static final String SHARED = "javax.portlet.shared";
/**
* Allows setting a resource ID that can be retrieved when serving the
* resource through the {@link ResourceRequest#getResourceID} method.
*
* @param resourceID
* ID for this resource URL
*/
public void setResourceID(String resourceID);
/**
* Returns the cache level of this resource URL.
* FULL, PORTLET
* or PAGE
.
*
* @return the cache level of this resource URL.
*/
public String getCacheability();
/**
* Sets the cache level of this resource URL.
* FULL, PORTLET
* or PAGE
.
* serveResource
call it must have
* at minimum the same cacheablity, or a more
* restrictive one, as the parent resource URL,
* otherwise an IllegalStateException is thrown.
* PAGE
if no parent resource URL is
* available.
*
* @param cacheLevel the cache level of this resource URL.
* @throws java.lang.IllegalStateException
* if this resource URL has a weaker cache level
* than the parent resource URL.
* @throws java.lang.IllegalArgumentException
* if the cacheLevel is unknown to the portlet container
*/
public void setCacheability(String cacheLevel);
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/Event.java 0000644 0001750 0001750 00000004106 11201125563 024112 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The Event
interface represents an event that the portlet has received
* in the event processing phase.
* Event
interface encapsulates the event name and event payload,
* it does not represent the event object itself.
* supported-processing-event
.
*
* @since 2.0
* @see EventPortlet
*/
public interface Event {
/**
* Get the event QName.
*
* @return the QName of the event, never null
.
*/
public javax.xml.namespace.QName getQName();
/**
* Get the local part of the event name.
*
* @return the local part of the event, never null
.
*/
public java.lang.String getName();
/**
* Get the event payload.
*
* @return event payload, must be serializable.
* May return null
if this event has no payload.
*/
public java.io.Serializable getValue();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/MimeResponse.java 0000644 0001750 0001750 00000035370 11201125563 025446 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The MimeResponse
defines the base interface to assist a
* portlet in returning MIME content.
*
* @since 2.0
*/
public interface MimeResponse extends PortletResponse {
/**
* Property to set the expiration time in seconds for this response using
* the setProperty
method intended to be used in
* forwarded or included servlets/JSPs.
* 0
, caching is disabled for this
* portlet; if the value is set to -1
, the cache does not expire.
* expiration-cache
tag, otherwise it is
0
.
* 0
.
* "portlet.expiration-cache"
.
*
* @see CacheControl
*/
public static final String EXPIRATION_CACHE = "portlet.expiration-cache";
/**
* Property to set the cache scope for this response using the
* setProperty
method intended to be used in
* forwarded or included servlets/JSPs.
* PUBLIC_SCOPE
and PRIVATE_SCOPE
.
* cache-scope
tag, otherwise it is
PRIVATE_SCOPE
.
* PUBLIC_SCOPE
or PRIVATE_SCOPE
* are treated as PRIVATE_SCOPE
.
* "portlet.cache-scope"
.
*
* @see CacheControl
* @since 2.0
*/
public static final String CACHE_SCOPE = "portlet.cache-scope";
/**
* Public cache scope, indicating that the cache entry can be shared across
* users. The value is "portlet.public-scope"
.
*
* @since 2.0
*/
public static final String PUBLIC_SCOPE = "portlet.public-scope";
/**
* Private cache scope, indicating that the cache entry must not be shared
* across users. The value is "portlet.private-scope"
.
*
* @since 2.0
*/
public static final String PRIVATE_SCOPE = "portlet.private-scope";
/**
* Property to tell the portlet container the new ETag for this response
* intended to be used in forwarded or included servlets/JSPs.
* setProperty
method.
* "portlet.ETag "
.
*
* @see CacheControl
* @since 2.0
*/
public static final String ETAG = "portlet.ETag";
/**
* Property to tell the portlet container to use the cached markup
* for the validation token provided in the request. This property
* needs to be set using the setProperty
method with a non-null
* value and is intended to be used in forwarded or included servlets/JSPs.
* The value itself is not evaluated.
* "portlet.use-cached-content "
.
*
* @see CacheControl
* @since 2.0
*/
public static final String USE_CACHED_CONTENT = "portlet.use-cached-content";
/**
* Property intended to be a hint to the portal application that the returned
* content is completely namespaced.
* This includes all markup id elements, form fields, etc.
* One example where this is might be used is for portal applications that
* are form-based and thus need to re-write any forms included in the portlet
* markup.
* setProperty
method with a non-null
* value. The value itself is not evaluated.
* "X-JAVAX-PORTLET-NAMESPACED-RESPONSE"
.
*
* @since 2.0
*/
public static final String NAMESPACED_RESPONSE = "X-JAVAX-PORTLET-NAMESPACED-RESPONSE";
/**
* Property intended to be a hint to the portal application that the provided
* DOM element should be added to the markup head section of the response to the
* client.
* MARKUP_HEAD_ELEMENT_SUPPORT
* property on the PortalContext
.
* setProperty(String key,org.w3c.dom.Element element)
* method.
* "javax.portlet.markup.head.element"
.
*
* @since 2.0
*/
public static final String MARKUP_HEAD_ELEMENT = "javax.portlet.markup.head.element";
/**
* Returns the MIME type that can be used to contribute markup to the render
* response.
* null
.
*
* @see #setContentType
*
* @return the MIME type of the response, or null
if no
* content type is set
*/
public String getContentType();
/**
* Sets the MIME type for the response. The portlet should set the
* content type before calling {@link #getWriter} or
* {@link #getPortletOutputStream}. If the content type is not
* the {@link PortletRequest#getResponseContentType} value is
* set as response content type by the portlet container.
* setContentType
after getWriter
or
* getOutputStream
does not change the content type.
* String
specifying the name of the charset, for
* example, ISO-8859-1
*
*/
public String getCharacterEncoding();
/**
* Returns a PrintWriter object that can send character text to the portal.
* PrintWriter
object that can return character
* data to the portal
*
* @exception java.io.IOException
* if an input or output exception occurred
* @exception java.lang.IllegalStateException
* if the getPortletOutputStream
method has
* been called on this response.
*
* @see #setContentType
* @see #getPortletOutputStream
*/
public java.io.PrintWriter getWriter() throws java.io.IOException;
/**
* Returns the locale assigned to the response.
*
* @return Locale of this response
*/
public java.util.Locale getLocale();
/**
* Sets the preferred buffer size for the body of the response. The portlet
* container will use a buffer at least as large as the size requested.
* IllegalStateException
.
*
* @param size
* the preferred buffer size
*
* @exception java.lang.IllegalStateException
* if this method is called after content has been written,
* or the portlet container does not support buffering
*
* @see #getBufferSize
* @see #flushBuffer
* @see #isCommitted
* @see #reset
*/
public void setBufferSize(int size);
/**
* Returns the actual buffer size used for the response. If no buffering is
* used, this method returns 0.
*
* @return the actual buffer size used
*
* @see #setBufferSize
* @see #flushBuffer
* @see #isCommitted
* @see #reset
*/
public int getBufferSize();
/**
* Forces any content in the buffer to be written to the underlying output stream. A call to
* this method automatically commits the response.
*
* @exception java.io.IOException
* if an error occurred when writing the output
*
* @see #setBufferSize
* @see #getBufferSize
* @see #isCommitted
* @see #reset
*/
public void flushBuffer() throws java.io.IOException;
/**
* Clears the content of the underlying buffer in the response without
* clearing properties set. If the response has been committed, this method
* throws an IllegalStateException
.
*
* @exception IllegalStateException
* if this method is called after response is committed
*
* @see #setBufferSize
* @see #getBufferSize
* @see #isCommitted
* @see #reset
*/
public void resetBuffer();
/**
* Returns a boolean indicating if the response has been committed.
*
* @return a boolean indicating if the response has been committed
*
* @see #setBufferSize
* @see #getBufferSize
* @see #flushBuffer
* @see #reset
*/
public boolean isCommitted();
/**
* Clears any data that exists in the buffer as well as the properties set.
* If the response has been committed, this method throws an
* IllegalStateException
.
*
* @exception java.lang.IllegalStateException
* if the response has already been committed
*
* @see #setBufferSize
* @see #getBufferSize
* @see #flushBuffer
* @see #isCommitted
*/
public void reset();
/**
* Returns a OutputStream
suitable for writing binary data in
* the response. The portlet container does not encode the binary data.
* flush()
on the OutputStream commits the response.
* OutputStream
for writing binary data
*
* @exception java.lang.IllegalStateException
* if the getWriter
method has been called on
* this response.
*
* @exception java.io.IOException
* if an input or output exception occurred
*
* @see #setContentType
* @see #getWriter
*/
public java.io.OutputStream getPortletOutputStream()
throws java.io.IOException;
/**
* Creates a portlet URL targeting the portlet. If no portlet mode, window
* state or security modifier is set in the PortletURL the current values
* are preserved. If a request is triggered by the PortletURL, it results in
* a render request.
* ResourceServingPortlet
interface.
* PAGE
is the default.
*
* @since 2.0
* @return a portlet resource URL
*/
public ResourceURL createResourceURL();
/**
* Returns the cache control object allowing to set
* specific cache settings valid for the markup
* returned in this response.
*
* @return Cache control for the current response.
*
* @since 2.0
*/
public CacheControl getCacheControl();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletURLGenerationListener.java 0000644 0001750 0001750 00000004332 11201125563 030570 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* Portlet applications can register portlet URL listeners in order to filter URLs
* before they get generated.
* In order to receive a callback from the portlet container before a
* portlet URL is generated the portlet application needs to implement this
* interface and register it in the deployment descriptor with the
* listener
element.
*
* @since 2.0
*/
public interface PortletURLGenerationListener {
/**
* Callback being called by the portlet container
* before toString
or write
* are executed on action URLs.
*
* @param actionURL action URL to be generated
*/
public void filterActionURL(PortletURL actionURL);
/**
* Callback being called by the portlet container
* before toString
or write
* are executed on render URLs.
*
* @param renderURL render URL to be generated
*/
public void filterRenderURL(PortletURL renderURL);
/**
* Callback being called by the portlet container
* before toString
or write
* are executed on resource URLs.
*
* @param resourceURL resource URL to be generated
*/
public void filterResourceURL(ResourceURL resourceURL);
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletMode.java 0000644 0001750 0001750 00000012072 11201125563 025270 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
import java.util.Locale;
/**
* The PortletMode
class represents
* the possible modes that a portlet can assume.
* EDIT, HELP, VIEW
.
* Additional portlet modes may be defined by calling the constructor
* of this class. If a portal/portlet-container does not support a
* custom portlet mode defined in the portlet application deployment descriptor,
* the custom portlet mode will be ignored by the portal/portlet container.
*/
public class PortletMode
{
/**
* The expected functionality for a portlet in VIEW
portlet mode
* is to generate markup reflecting the current state of the portlet.
* For example, the VIEW
portlet mode of a portlet may
* include one or more screens that the user can navigate and interact
* with, or it may consist of static content that does not require any
* user interaction.
* "view"
.
*/
public final static PortletMode VIEW = new PortletMode ("view");
/**
* Within the EDIT
portlet mode, a portlet should provide
* content and logic that lets a user customize the behavior of the portlet.
* The EDIT portlet mode may include one or more screens among which
* users can navigate to enter their customization data.
* EDIT
portlet mode will
* set or update portlet preferences.
* "edit"
.
*/
public final static PortletMode EDIT = new PortletMode ("edit");
/**
* When in HELP
portlet mode, a portlet should provide help
* information about the portlet. This help information could be
* a simple help screen explaining the entire portlet in
* coherent text or it could be context-sensitive help.
* "help"
.
*/
public final static PortletMode HELP = new PortletMode ("help");
private String _name;
/**
* Creates a new portlet mode with the given name.
* true
if the
* Strings equals
method for the String
* representing the two portlet modes returns true
.
*
* @param object the portlet mode to compare this portlet mode with
*
* @return true, if the specified object is equal with this portlet mode
*/
public boolean equals(Object object) {
if ( object instanceof PortletMode )
return _name.equals(((PortletMode) object)._name);
else
return false;
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/StateAwareResponse.java 0000644 0001750 0001750 00000025754 11201125563 026624 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The StateAwareResponse
represents a response that can modify
* state information or send events.
* It extends the PortletResponse interface.
*
* @since 2.0
* @see PortletResponse
*/
public interface StateAwareResponse extends PortletResponse {
/**
* Sets the window state of a portlet to the given window state.
*
*
*
* @param windowState
* the new portlet window state
*
* @exception WindowStateException
* if the portlet cannot switch to the specified window
* state. To avoid this exception the portlet can check the
* allowed window states with
* Request.isWindowStateAllowed()
.
* @exception java.lang.IllegalStateException
* if the method is invoked after sendRedirect
* has been called.
*
* @see WindowState
*/
public void setWindowState(WindowState windowState)
throws WindowStateException;
/**
* Sets the portlet mode of a portlet to the given portlet mode.
*
*
* Request.isPortletModeAllowed()
.
* @exception java.lang.IllegalStateException
* if the method is invoked after sendRedirect
* has been called.
*/
public void setPortletMode(PortletMode portletMode)
throws PortletModeException;
/**
* Sets a parameter map for the render request.
* PortletRequest.getParameter
call until a new request
* is targeted to the portlet.
* String[]
).
*
* @exception java.lang.IllegalArgumentException
* if parameters is null
, if any of the
* keys in the Map are null
, if any of
* the keys is not a String, or if any of the values is not a
* String array.
* @exception java.lang.IllegalStateException
* if the method is invoked after sendRedirect
* has been called.
*/
public void setRenderParameters(java.util.MapPortletRequest.getParameter
call until a request is
* targeted to the portlet.
* null
.
* @exception java.lang.IllegalStateException
* if the method is invoked after sendRedirect
* has been called.
*/
public void setRenderParameter(String key, String value);
/**
* Sets a String array parameter for the render request.
* PortletRequest.getParameter
call until a request is
* targeted to the portlet.
* null
.
* @exception java.lang.IllegalStateException
* if the method is invoked after sendRedirect
* has been called.
*/
public void setRenderParameter(String key, String[] values);
/**
* Publishes an Event with the given payload.
* null
* @param value
* the value of this event, must have a valid JAXB binding and
* be serializable, or null
.
*
* @exception java.lang.IllegalArgumentException
* if name is null
, the value is not
* serializable, the value does not have a valid JAXB binding, the
* object type of the value is not the same as specified in
* the portlet deployment descriptor for this event name.
* @since 2.0
*/
public void setEvent(javax.xml.namespace.QName name, java.io.Serializable value);
/**
* Publishes an Event with the given payload in the default namespace.
* default-event-namespace
element
* in the portlet deployment descriptor, or if this element is not provided
* the XML default namespace XMLConstants.NULL_NS_URI is used.
* null
* @param value
* the value of this event, must have a valid JAXB binding and
* be serializable, or null
.
*
* @exception java.lang.IllegalArgumentException
* if name is null
, the value is not
* serializable, the value does not have a valid JAXB binding, the
* object type of the value is not the same as specified in
* the portlet deployment descriptor for this event name.
* @since 2.0
*/
public void setEvent(String name, java.io.Serializable value);
/**
* Returns a Map
of the render parameters currently set on
* this response.
* Map
are from type String array (String[]
).
* Map
.
*
* @since 2.0
*
* @return Map
containing render parameter names as keys and
* parameter values as map values, or an empty Map
if
* no parameters exist. The keys in the parameter map are of type
* String. The values in the parameter map are of type String array (String[]
).
*/
public java.util.Mapnull
if none is set
*/
public PortletMode getPortletMode();
/**
* Returns the currently set window state on this response.
*
* @since 2.0
*
* @return the window state, or null
if none is set
*/
public WindowState getWindowState();
/**
* Removes the specified public render parameter.
* The name must reference a public render parameter defined
* in the portlet deployment descriptor under the
* public-render-parameter
element with the
* identifier
mapping to the parameter name.
*
* @param name a String
specifying
* the name of the public render parameter to be removed
*
* @exception java.lang.IllegalArgumentException
* if name is null
.
* @since 2.0
*/
public void removePublicRenderParameter(String name);
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/ResourceRequest.java 0000644 0001750 0001750 00000013155 11201125563 026175 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The ResourceRequest
interface represents the request
* send to the portlet for rendering resources.
*
* It extends the ClientDataRequest interface and provides resource request
* information to portlets.
* ResourceRequest
object and
* passes it as argument to the portlet's serveResource
method.
* ResourceRequest
is provided with the current portlet mode, window state,
* and render parameters that the portlet can access via the
* PortletResourceRequest
with getPortletMode
and,
* getWindowState
, or one of the getParameter
methods.
* ResourceURLs cannot change the current portlet mode, window state or
* render parameters. Parameters set on a resource URL are not render parameters
* but parameters for serving this resource and will last only for only
* this the current serveResource request.
* If a parameter is set that has the same name as a render parameter that this
* resource URL contains, the render parameter must be the last entry in the
* parameter value array.
*
* @see ClientDataRequest
* @see ResourceServingPortlet
* @since 2.0
*/
public interface ResourceRequest extends ClientDataRequest {
/**
* This property is set by the container if the container
* has a cached response for the given validation tag. The property can be
* retrieved using the getProperty
method.
* "portlet.ETag "
.
*/
public static final String ETAG = "portlet.ETag";
/**
* Returns the validation tag if the portlet container
* has a cached response for this validation tag, or
* null
if no cached response exists.
* ResourceRequest.getProperty(ResourceRequest.ETAG)
.
*
* @return the validation tag if the portlet container
* has a cached response for this validation tag, or
* null
if no cached response exists.
*/
public String getETag();
/**
* Returns the resource ID set on the ResourceURL or null
* if no resource ID was set on the URL.
*
* @return the resource ID set on the ResourceURL,or null
* if no resource ID was set on the URL.
*/
public String getResourceID();
/**
* Returns a Map
of the private render parameters of this request.
* Private parameters are not shared with other portlets or components.
* The returned parameters are "x-www-form-urlencoded" decoded.
* serveResource
call.
* Map
are from type
* String array (String[]
).
* Map
.
*
* @return an immutable Map
containing private parameter names as
* keys and private parameter values as map values, or an empty Map
* if no private parameters exist. The keys in the parameter
* map are of type String. The values in the parameter map are of type
* String array (String[]
).
*/
public java.util.MapResourceURL.FULL, ResourceURL.PORTLET
* or ResourceURL.PAGE
.
*
* @return the cache level of this resource request.
*/
public String getCacheability();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/Portlet.java 0000644 0001750 0001750 00000015536 11201125563 024473 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
import java.io.IOException;
/**
* The Portlet
interface is used by the portlet container to
* invoke the portlets. Every portlet has to implement this interface,
* either by directly implementing it, or by using an existing class
* implementing the Portlet interface.
*
*
* init
method
* destroy
method
*
*
*/
public interface Portlet
{
/**
* Called by the portlet container to indicate to a portlet that the
* portlet is being placed into service.
*
* processAction
method,
* to perform actions targeted to the portlet
* render
method,
* to perform the render operation
* init
* method exactly once after instantiating the portlet.
* The init
method must complete successfully
* before the portlet can receive any requests.
*
* init
method
*
*
*
*
* @param config a PortletException
* PortletConfig
object
* containing the portlet's
* configuration and initialization parameters
*
* @exception PortletException if an exception has occurred that
* interferes with the portlet's normal
* operation.
* @exception UnavailableException if the portlet cannot perform the initialization at this time.
*
*
*/
public void init(PortletConfig config) throws PortletException;
/**
* Called by the portlet container to allow the portlet to process
* an action request. This method is called if the client request was
* originated by a URL created (by the portlet) with the
* RenderResponse.createActionURL()
method.
*
*
*
*
*/
public void destroy();
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/EventResponse.java 0000644 0001750 0001750 00000004377 11201125563 025643 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The EventResponse
interface represents the portlet
* response to an event request.
* It extends the StateAwareResponse
interface.
* The portlet container creates an EventResponse
object and
* passes it as argument to the portlet's processEvent
method.
*
* @see StateAwareResponse
* @see PortletResponse
* @since 2.0
*/
public interface EventResponse extends StateAwareResponse {
/**
* Maintain the current render parameters of the request for
* the response.
* PortletRequest.getParameter
call until
* a new request is targeted to the portlet.
* processEvent
call, must not be
* null
.
*/
public void setRenderParameters(EventRequest request);
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ 0000755 0001750 0001750 00000000000 11354474716 023472 5 ustar drazzib drazzib portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/package-info.java 0000644 0001750 0001750 00000001672 11202051315 026641 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* The javax.portlet.filter package defines the filter APIs for the Java Portlet Specification.
*/
package javax.portlet.filter; portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/EventFilter.java 0000644 0001750 0001750 00000012563 11201141010 026534 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.io.IOException;
import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
import javax.portlet.PortletException;
/**
* The EventFilter
is an object that performs filtering
* tasks on either the event request to a portlet, or on the event response from
* a portlet, or both.
* doFilter
method. Every Filter has
* access to a FilterConfig
object from which it can obtain
* its initialization parameters, a reference to the PortletContext
* which it can use, for example, to load resources needed for filtering tasks.
* doFilter
method of the Filter is called by the
* portlet container each time a event request/response pair is passed
* through the chain due to a client request for a portlet method
* at the end of the chain.
* FilterChain
passed in to this method allows
* the Filter to pass on the event request and response to the next
* component in the chain.
* doFilter
method of a filter will typically be implemented
* following this or some subset of the following pattern:
*
*
*
* @param request the current event request
* @param response the current event response
* @param chain the remaining filter chain
* @throws IOException if an IO error occurred in the filter processing
* @throws PortletException if a portlet exception occurred in the filter processing
*/
public void doFilter(EventRequest request, EventResponse response,
FilterChain chain)
throws IOException, PortletException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/EventRequestWrapper.java 0000644 0001750 0001750 00000005600 11201125563 030311 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import javax.portlet.Event;
import javax.portlet.EventRequest;
/**
* The ActionRequestWrapper
* in order to modify request data.doFilter
method with a customized implementation
* of the response wrapper ActionResponseWrapper
* to modify response data.doFilter
* method on the FilterChain
object, and passing in
* the request and response with which it was called or passing
* in wrapped versions it may have created.
* The filter chain's implementation of the doFilter
* method, provided by the portlet container, must locate the
* next component in the filter chain and invoke its doFilter
* method, passing in the appropriate request and response objects.
* Alternatively, the filter chain can block the request by not
* making the call to invoke the next component, leaving the filter
* responsible for filling out the response object.UnavailableException
during its doFilter
* processing, the portlet container must not attempt continued
* processing down the filter chain. It may choose to retry the
* whole chain at a later time if the exception is not marked permanent.EventRequestWrapper
provides a convenient
* implementation of the EventRequest
interface
* that can be subclassed by developers wishing to adapt the request.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped request object.
*
* @since 2.0
* @see EventRequest
*/
public class EventRequestWrapper extends PortletRequestWrapper implements EventRequest {
EventRequest request;
/**
* Creates an EventRequest
adaptor
* wrapping the given request object.
*
* @param request the event request to wrap
* @throws java.lang.IllegalArgumentException if the request is null
*/
public EventRequestWrapper(EventRequest request) {
super(request);
this.request = request;
}
/**
* Return the wrapped request object.
*
* @return the wrapped request
*/
public EventRequest getRequest() {
return request;
}
/**
* Sets the request object being wrapped.
*
* @param request the request to set
* @throws java.lang.IllegalArgumentException if the request is null.
*/
public void setRequest(EventRequest request) {
if ( request == null)
throw new java.lang.IllegalArgumentException("Request is null");
this.request = request;
}
/**
* The default behavior of this method is to call
* getEvent()
on the wrapped request object.
*/
public Event getEvent() {
return request.getEvent();
}
/**
* The default behavior of this method is to call
* getMethod()
on the wrapped request object.
*/
public String getMethod() {
return request.getMethod();
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ActionRequestWrapper.java 0000644 0001750 0001750 00000010477 11201125563 030455 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import javax.portlet.ActionRequest;
/**
* The ActionRequestWrapper
provides a convenient
* implementation of the ActionRequest
interface
* that can be subclassed by developers wishing to adapt the request.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped request object.
*
* @since 2.0
* @see ActionRequest
*/
public class ActionRequestWrapper extends PortletRequestWrapper implements ActionRequest {
ActionRequest request;
/**
* Creates an ActionRequest
adaptor
* wrapping the given request object.
*
* @param request the action request to wrap
* @throws java.lang.IllegalArgumentException if the request is null
*/
public ActionRequestWrapper(ActionRequest request) {
super(request);
this.request = request;
}
/**
* The default behavior of this method is to call
* getCharacterEncoding()
on the wrapped request object.
*/
public String getCharacterEncoding() {
return request.getCharacterEncoding();
}
/**
* The default behavior of this method is to call
* getContentLength()
on the wrapped request object.
*/
public int getContentLength() {
return request.getContentLength();
}
/**
* The default behavior of this method is to call
* getContentType()
on the wrapped request object.
*/
public String getContentType() {
return request.getContentType();
}
/**
* The default behavior of this method is to call
* getPortletInputStream()
on the wrapped request object.
*/
public InputStream getPortletInputStream() throws IOException {
return request.getPortletInputStream();
}
/**
* The default behavior of this method is to call
* getReader()
on the wrapped request object.
*/
public BufferedReader getReader() throws UnsupportedEncodingException,
IOException {
return request.getReader();
}
/**
* The default behavior of this method is to call
* setCharacterEncoding(String enc)
* on the wrapped request object.
*/
public void setCharacterEncoding(String enc)
throws UnsupportedEncodingException {
request.setCharacterEncoding(enc);
}
/**
* Return the wrapped request object.
*
* @return the wrapped request
*/
public ActionRequest getRequest() {
return request;
}
/**
* Sets the request object being wrapped.
*
* @param request the request to set
* @throws java.lang.IllegalArgumentException if the request is null.
*/
public void setRequest(ActionRequest request) {
if ( request == null)
throw new java.lang.IllegalArgumentException("Request is null");
this.request = request;
}
/**
* The default behavior of this method is to call
* getMethod()
on the wrapped request object.
*/
public String getMethod() {
return request.getMethod();
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/RenderFilter.java 0000644 0001750 0001750 00000012576 11201141010 026676 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.io.IOException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.PortletException;
/**
* The RenderFilter
is an object that performs filtering
* tasks on either the render request to a portlet, or on the render response from
* a portlet, or both.
* doFilter
method. Every Filter has
* access to a FilterConfig
object from which it can obtain
* its initialization parameters, a reference to the PortletContext
* which it can use, for example, to load resources needed for filtering tasks.
* doFilter
method of the Filter is called by the
* portlet container each time a render request/response pair is passed
* through the chain due to a client request for a portlet method
* at the end of the chain.
* FilterChain
passed in to this method allows
* the Filter to pass on the render request and response to the next
* component in the chain.
* doFilter
method of a filter will typically be implemented
* following this or some subset of the following pattern:
*
*
*
* @param request the current render request
* @param response the current render response
* @param chain the remaining filter chain
* @throws IOException if an IO error occurred in the filter processing
* @throws PortletException if a portlet exception occurred in the filter processing
*/
public void doFilter(RenderRequest request, RenderResponse response,
FilterChain chain)
throws IOException, PortletException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/FilterChain.java 0000644 0001750 0001750 00000010347 11201125563 026512 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;
/**
* A RenderRequestWrapper
* in order to modify request data.doFilter
method with a customized implementation
* of the response wrapper RenderResponseWrapper
* to modify response data.doFilter
* method on the FilterChain
object, and passing in
* the request and response with which it was called or passing
* in wrapped versions it may have created.
* The filter chain's implementation of the doFilter
* method, provided by the portlet container, must locate the
* next component in the filter chain and invoke its doFilter
* method, passing in the appropriate request and response objects.
* Alternatively, the filter chain can block the request by not
* making the call to invoke the next component, leaving the filter
* responsible for filling out the response object.UnavailableException
during its doFilter
* processing, the portlet container must not attempt continued
* processing down the filter chain. It may choose to retry the
* whole chain at a later time if the exception is not marked permanent.FilterChain
is an object provided by the portlet container
* to the developer giving a view into the invocation chain of a
* filtered request for a portlet. Filters use the FilterChain
* to invoke the next filter in the chain, or if the calling filter is the
* last filter in the chain, to invoke the portlet at the end of the chain.
*
* @since 2.0
*/
public interface FilterChain {
/**
* Causes the next filter in the chain to be invoked,
* or if the calling filter is the last filter in the chain,
* causes the portlet at the end of the chain to be invoked.
*
* @param request the current action request.
* @param response the current action response
*
* @throws IOException if an IO error occurred in the filter processing
* @throws PortletException if a portlet exception occurred in the filter processing
*/
public void doFilter(ActionRequest request, ActionResponse response)
throws IOException, PortletException;
/**
* Causes the next filter in the chain to be invoked,
* or if the calling filter is the last filter in the chain,
* causes the portlet at the end of the chain to be invoked.
*
* @param request the current event request.
* @param response the current event response.
*
* @throws IOException if an IO error occured in the filter processing
* @throws PortletException if a portlet exception occured in the filter processing
*/
public void doFilter(EventRequest request, EventResponse response)
throws IOException, PortletException;
/**
* Causes the next filter in the chain to be invoked,
* or if the calling filter is the last filter in the chain,
* causes the portlet at the end of the chain to be invoked.
*
* @param request the current render request.
*
* @param response the current render response.
*
* @throws IOException if an IO error occurred in the filter processing
* @throws PortletException if a portlet exception occurred in the filter processing
*/
public void doFilter(RenderRequest request, RenderResponse response)
throws IOException, PortletException;
/**
* Causes the next filter in the chain to be invoked,
* or if the calling filter is the last filter in the chain,
* causes the portlet at the end of the chain to be invoked.
*
* @param request the current resource request.
* @param response the current resource response.
*
* @throws IOException if an IO error occurred in the filter processing
* @throws PortletException if a portlet exception occurred in the filter processing
*/
public void doFilter(ResourceRequest request, ResourceResponse response)
throws IOException, PortletException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/EventResponseWrapper.java 0000644 0001750 0001750 00000013702 11201125563 030461 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.util.Map;
import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
import javax.portlet.PortletMode;
import javax.portlet.PortletModeException;
import javax.portlet.WindowState;
import javax.portlet.WindowStateException;
import javax.xml.namespace.QName;
/**
* The EventResponseWrapper
provides a convenient
* implementation of the EventResponse
interface
* that can be subclassed by developers wishing to adapt the response.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped response object.
*
* @since 2.0
* @see EventResponse
*/
public class EventResponseWrapper extends PortletResponseWrapper implements EventResponse {
EventResponse response;
/**
* Creates an EventResponse
adaptor
* wrapping the given response object.
*
* @param response the event response to wrap
* @throws java.lang.IllegalArgumentException if the response is null
*/
public EventResponseWrapper(EventResponse response) {
super(response);
this.response = response;
}
/**
* The default behavior of this method is to call
* setEvent(name, value)
on the wrapped response object.
*/
public void setEvent(QName name, java.io.Serializable value) {
response.setEvent(name, value);
}
/**
* The default behavior of this method is to call
* setPortletMode(portletMode)
on the wrapped response object.
*/
public void setPortletMode(PortletMode portletMode)
throws PortletModeException {
response.setPortletMode(portletMode);
}
/**
* The default behavior of this method is to call
* setRenderParameter(key, value)
on the wrapped response object.
*/
public void setRenderParameter(String key, String value) {
response.setRenderParameter(key, value);
}
/**
* The default behavior of this method is to call
* setRenderParameter(key, value)
on the wrapped response object.
*/
public void setRenderParameter(String key, String[] values) {
response.setRenderParameter(key, values);
}
/**
* The default behavior of this method is to call
* setRenderParameters(parameters)
on the wrapped response object.
*/
public void setRenderParameters(MapsetWindowState(windowState)
on the wrapped response object.
*/
public void setWindowState(WindowState windowState)
throws WindowStateException {
response.setWindowState(windowState);
}
/**
* Return the wrapped response object.
*
* @return the wrapped response
*/
public EventResponse getResponse() {
return response;
}
/**
* Sets the response object being wrapped.
*
* @param response the response to set
* @throws java.lang.IllegalArgumentException if the response is null.
*/
public void setResponse(EventResponse response) {
if ( response == null)
throw new java.lang.IllegalArgumentException("Response is null");
this.response = response;
}
/**
* The default behavior of this method is to call
* getPortletMode()
on the wrapped response object.
*/
public PortletMode getPortletMode() {
return response.getPortletMode();
}
/**
* The default behavior of this method is to call
* getRenderParameterMap()
on the wrapped response object.
*/
public MapgetWindowState()
on the wrapped response object.
*/
public WindowState getWindowState() {
return response.getWindowState();
}
/**
* The default behavior of this method is to call
* setRenderParameters()
on the wrapped response object.
*/
public void setRenderParameters(EventRequest request) {
response.setRenderParameters(request);
}
/**
* The default behavior of this method is to call
* setEvent()
on the wrapped response object.
*/
public void setEvent(String name, java.io.Serializable value) {
response.setEvent(name, value);
}
/**
* The default behavior of this method is to call
* removePublicRenderParameter()
on the wrapped response object.
*/
public void removePublicRenderParameter(String name) {
response.removePublicRenderParameter(name);
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ActionResponseWrapper.java 0000644 0001750 0001750 00000014224 11201125563 030615 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.io.IOException;
import java.util.Map;
import javax.portlet.ActionResponse;
import javax.portlet.PortletMode;
import javax.portlet.PortletModeException;
import javax.portlet.WindowState;
import javax.portlet.WindowStateException;
import javax.xml.namespace.QName;
/**
* The ActionResponseWrapper
provides a convenient
* implementation of the ActionResponse
interface
* that can be subclassed by developers wishing to adapt the response.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped response object.
*
* @since 2.0
* @see ActionResponse
*/
public class ActionResponseWrapper extends PortletResponseWrapper implements ActionResponse {
ActionResponse response;
/**
* Creates an ActionResponse
adaptor
* wrapping the given response object.
*
* @param response the action response to wrap
* @throws java.lang.IllegalArgumentException if the response is null
*/
public ActionResponseWrapper(ActionResponse response) {
super(response);
this.response = response;
}
/**
* The default behavior of this method is to call
* sendRedirect(location)
on the wrapped response object.
*/
public void sendRedirect(String location) throws IOException {
response.sendRedirect(location);
}
/**
* The default behavior of this method is to call
* sendRedirect(location, renderUrlParamName)
on the wrapped response object.
*/
public void sendRedirect(String location, String renderUrlParamName) throws IOException {
response.sendRedirect(location, renderUrlParamName);
}
/**
* The default behavior of this method is to call
* setEvent(name, value)
on the wrapped response object.
*/
public void setEvent(QName name, java.io.Serializable value) {
response.setEvent(name, value);
}
/**
* The default behavior of this method is to call
* setPortletMode(portletMode)
on the wrapped response object.
*/
public void setPortletMode(PortletMode portletMode)
throws PortletModeException {
response.setPortletMode(portletMode);
}
/**
* The default behavior of this method is to call
* setRenderParameter(key, value)
on the wrapped response object.
*/
public void setRenderParameter(String key, String value) {
response.setRenderParameter(key, value);
}
/**
* The default behavior of this method is to call
* setRenderParameter(key, value)
on the wrapped response object.
*/
public void setRenderParameter(String key, String[] values) {
response.setRenderParameter(key, values);
}
/**
* The default behavior of this method is to call
* setRenderParameters(parameters)
on the wrapped response object.
*/
public void setRenderParameters(MapsetWindowState(windowState)
on the wrapped response object.
*/
public void setWindowState(WindowState windowState)
throws WindowStateException {
response.setWindowState(windowState);
}
/**
* Return the wrapped response object.
*
* @return the wrapped response
*/
public ActionResponse getResponse() {
return response;
}
/**
* Sets the response object being wrapped.
*
* @param response the response to set
* @throws java.lang.IllegalArgumentException if the response is null.
*/
public void setResponse(ActionResponse response) {
if ( response == null)
throw new java.lang.IllegalArgumentException("Response is null");
this.response = response;
}
/**
* The default behavior of this method is to call
* getPortletMode()
on the wrapped response object.
*/
public PortletMode getPortletMode() {
return response.getPortletMode();
}
/**
* The default behavior of this method is to call
* getRenderParameterMap()
on the wrapped response object.
*/
public MapgetWindowState()
on the wrapped response object.
*/
public WindowState getWindowState() {
return response.getWindowState();
}
/**
* The default behavior of this method is to call
* setEvent()
on the wrapped response object.
*/
public void setEvent(String name, java.io.Serializable value) {
response.setEvent(name, value);
}
/**
* The default behavior of this method is to call
* removePublicRenderParameter()
on the wrapped response object.
*/
public void removePublicRenderParameter(String name) {
response.removePublicRenderParameter(name);
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/PortletResponseWrapper.java 0000644 0001750 0001750 00000010705 11201125563 031031 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import javax.portlet.PortletResponse;
import javax.servlet.http.Cookie;
/**
* The PortletResponseWrapper
provides a convenient
* implementation of the PortletResponse
interface
* and is extended by other response wrappers.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped response object.
*
* @since 2.0
* @see PortletResponse
*/
public class PortletResponseWrapper implements PortletResponse {
PortletResponse response;
/**
* Require having a response for constructing
* the wrapper.
*
*/
private PortletResponseWrapper() {
}
/**
* Creates an ActionResponse
adaptor
* wrapping the given response object.
*
* @param response the action response to wrap
* @throws java.lang.IllegalArgumentException if the response is null
*/
public PortletResponseWrapper(PortletResponse response) {
if ( response == null)
throw new java.lang.IllegalArgumentException("Response is null");
this.response = response;
}
/**
* The default behavior of this method is to call
* addProperty(key, value)
on the wrapped response object.
*/
public void addProperty(String key, String value) {
response.addProperty(key, value);
}
/**
* The default behavior of this method is to call
* encodeURL(path)
on the wrapped response object.
*/
public String encodeURL(String path) {
return response.encodeURL(path);
}
/**
* The default behavior of this method is to call
* getNamespace()
on the wrapped response object.
*/
public String getNamespace() {
return response.getNamespace();
}
/**
* The default behavior of this method is to call
* setProperty(key, value)
on the wrapped response object.
*/
public void setProperty(String key, String value) {
response.setProperty(key, value);
}
/**
* Return the wrapped response object.
*
* @return the wrapped response
*/
public PortletResponse getResponse() {
return response;
}
/**
* Sets the response object being wrapped.
*
* @param response the response to set
* @throws java.lang.IllegalArgumentException if the response is null.
*/
public void setResponse(PortletResponse response) {
if ( response == null)
throw new java.lang.IllegalArgumentException("Response is null");
this.response = response;
}
/**
* The default behavior of this method is to call
* addProperty()
on the wrapped response object.
*/
public void addProperty(String key, org.w3c.dom.Element element) {
response.addProperty(key, element);
}
/**
* The default behavior of this method is to call
* createElement()
on the wrapped response object.
*/
public org.w3c.dom.Element createElement(String tagName) {
return response.createElement(tagName);
}
/**
* The default behavior of this method is to call
* addProperty()
on the wrapped response object.
*/
public void addProperty(Cookie cookie) {
response.addProperty(cookie);
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ActionFilter.java 0000644 0001750 0001750 00000012604 11201141010 026664 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
/**
* The ActionFilter
is an object that performs filtering
* tasks on either the action request to a portlet, or on the action response from
* a portlet, or both.
* doFilter
method. Every Filter has
* access to a FilterConfig
object from which it can obtain
* its initialization parameters, a reference to the PortletContext
* which it can use, for example, to load resources needed for filtering tasks.
* doFilter
method of the Filter is called by the
* portlet container each time a action request/response pair is passed
* through the chain due to a client request for a portlet method
* at the end of the chain.
* FilterChain
passed in to this method allows
* the Filter to pass on the action request and response to the next
* component in the chain.
* doFilter
method of a filter will typically be implemented
* following this or some subset of the following pattern:
*
*
*
* @param request the current action request
* @param response the current action response
* @param chain the remaining filter chain
* @throws IOException if an IO error occurred in the filter processing
* @throws PortletException if a portlet exception occurred in the filter processing
*/
public void doFilter(ActionRequest request, ActionResponse response,
FilterChain chain)
throws IOException, PortletException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/FilterConfig.java 0000644 0001750 0001750 00000005240 11201125563 026671 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.util.Enumeration;
import javax.portlet.PortletContext;
/**
* A filter configuration object used by a portlet container
* to pass information to a filter during initialization.
*
* @since 2.0
*/
public interface FilterConfig {
/**
* Returns the filter-name of this filter as defined in the
* portlet deployment descriptor.
*
* @return the filter name
*/
public String getFilterName();
/**
* Returns a reference to the ActionRequestWrapper
* in order to modify request data.doFilter
method with a customized implementation
* of the response wrapper ActionResponseWrapper
* to modify response data.doFilter
* method on the FilterChain
object, and passing in
* the request and response with which it was called or passing
* in wrapped versions it may have created.
* The filter chain's implementation of the doFilter
* method, provided by the portlet container, must locate the
* next component in the filter chain and invoke its doFilter
* method, passing in the appropriate request and response objects.
* Alternatively, the filter chain can block the request by not
* making the call to invoke the next component, leaving the filter
* responsible for filling out the response object.UnavailableException
during its doFilter
* processing, the portlet container must not attempt continued
* processing down the filter chain. It may choose to retry the
* whole chain at a later time if the exception is not marked permanent.PortletContext
in which the caller is executing.
*
* @return the portlet context
*/
public PortletContext getPortletContext();
/**
* Returns a String containing the value of the named
* initialization parameter, or null
if the parameter does not exist.
* null
if the parameter does not exist.
*/
public String getInitParameter(String name);
/**
* Returns the names of the filter's initialization parameters
* as an Enumeration of String objects, or an empty Enumeration
* if the filter has no initialization parameters.
* ResourceFilter
is an object that performs filtering
* tasks on either the resource request to a portlet, or on the resource response from
* a portlet, or both.
* doFilter
method. Every Filter has
* access to a FilterConfig
object from which it can obtain
* its initialization parameters, a reference to the PortletContext
* which it can use, for example, to load resources needed for filtering tasks.
* doFilter
method of the Filter is called by the
* portlet container each time a resource request/response pair is passed
* through the chain due to a client request for a portlet method
* at the end of the chain.
* FilterChain
passed in to this method allows
* the Filter to pass on the resource request and response to the next
* component in the chain.
* doFilter
method of a filter will typically be implemented
* following this or some subset of the following pattern:
*
*
*
* @param request the current resource request
* @param response the current resource response
* @param chain the remaining filter chain
* @throws IOException if an IO error occurred in the filter processing
* @throws PortletException if a portlet exception occurred in the filter processing
*/
public void doFilter(ResourceRequest request, ResourceResponse response,
FilterChain chain)
throws IOException, PortletException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/PortletRequestWrapper.java 0000644 0001750 0001750 00000027416 11201125563 030672 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.security.Principal;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
import javax.portlet.PortalContext;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequest;
import javax.portlet.PortletSession;
import javax.portlet.WindowState;
import javax.servlet.http.Cookie;
/**
* The ResourceRequestWrapper
* in order to modify request data.doFilter
method with a customized implementation
* of the response wrapper ResourceResponseWrapper
* to modify response data.doFilter
* method on the FilterChain
object, and passing in
* the request and response with which it was called or passing
* in wrapped versions it may have created.
* The filter chain's implementation of the doFilter
* method, provided by the portlet container, must locate the
* next component in the filter chain and invoke its doFilter
* method, passing in the appropriate request and response objects.
* Alternatively, the filter chain can block the request by not
* making the call to invoke the next component, leaving the filter
* responsible for filling out the response object.UnavailableException
during its doFilter
* processing, the portlet container must not attempt continued
* processing down the filter chain. It may choose to retry the
* whole chain at a later time if the exception is not marked permanent.PortletRequestWrapper
provides a convenient
* implementation of the PortletRequest
interface
* and is extended by other request wrappers.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped request object.
*
* @since 2.0
* @see PortletRequest
*/
public class PortletRequestWrapper implements PortletRequest {
PortletRequest request;
/**
* Require having a request for constructing
* the wrapper.
*
*/
private PortletRequestWrapper() {
}
/**
* Creates an PortletRequest
adaptor
* wrapping the given request object.
*
* @param request the portlet request to wrap
* @throws java.lang.IllegalArgumentException if the request is null
*/
public PortletRequestWrapper(PortletRequest request) {
if ( request == null)
throw new java.lang.IllegalArgumentException("Request is null");
this.request = request;
}
/**
* The default behavior of this method is to call
* getAttribute(String name)
on the wrapped request object.
*/
public Object getAttribute(String name) {
return request.getAttribute(name);
}
/**
* The default behavior of this method is to call
* getAttributeNames()
on the wrapped request object.
*/
public EnumerationgetAuthType()
on the wrapped request object.
*/
public String getAuthType() {
return request.getAuthType();
}
/**
* The default behavior of this method is to call
* getContextPath()
on the wrapped request object.
*/
public String getContextPath() {
return request.getContextPath();
}
/**
* The default behavior of this method is to call
* getLocale()
on the wrapped request object.
*/
public Locale getLocale() {
return request.getLocale();
}
/**
* The default behavior of this method is to call
* getLocales()
on the wrapped request object.
*/
public EnumerationgetParameter(String name)
on the wrapped request object.
*/
public String getParameter(String name) {
return request.getParameter(name);
}
/**
* The default behavior of this method is to call
* getParameterMap()
on the wrapped request object.
*/
public MapgetParameterNames()
on the wrapped request object.
*/
public EnumerationgetParameterValues(name)
on the wrapped request object.
*/
public String[] getParameterValues(String name) {
return request.getParameterValues(name);
}
/**
* The default behavior of this method is to call
* getPortalContext()
on the wrapped request object.
*/
public PortalContext getPortalContext() {
return request.getPortalContext();
}
/**
* The default behavior of this method is to call
* getPortletMode()
on the wrapped request object.
*/
public PortletMode getPortletMode() {
return request.getPortletMode();
}
/**
* The default behavior of this method is to call
* getPortletSession()
on the wrapped request object.
*/
public PortletSession getPortletSession() {
return request.getPortletSession();
}
/**
* The default behavior of this method is to call
* getPortletSession(create)
on the wrapped request object.
*/
public PortletSession getPortletSession(boolean create) {
return request.getPortletSession(create);
}
/**
* The default behavior of this method is to call
* getPreferences()
on the wrapped request object.
*/
public PortletPreferences getPreferences() {
return request.getPreferences();
}
/**
* The default behavior of this method is to call
* getProperteis(name)
on the wrapped request object.
*/
public EnumerationgetProperty(name)
on the wrapped request object.
*/
public String getProperty(String name) {
return request.getProperty(name);
}
/**
* The default behavior of this method is to call
* getPropertyNames()
on the wrapped request object.
*/
public EnumerationgetRemoteUser()
on the wrapped request object.
*/
public String getRemoteUser() {
return request.getRemoteUser();
}
/**
* The default behavior of this method is to call
* getRequestedSessionId()
on the wrapped request object.
*/
public String getRequestedSessionId() {
return request.getRequestedSessionId();
}
/**
* The default behavior of this method is to call
* getResponseContentType()
on the wrapped request object.
*/
public String getResponseContentType() {
return request.getResponseContentType();
}
/**
* The default behavior of this method is to call
* getResponseContentTypes()
on the wrapped request object.
*/
public EnumerationgetScheme()
on the wrapped request object.
*/
public String getScheme() {
return request.getScheme();
}
/**
* The default behavior of this method is to call
* getServerName()
on the wrapped request object.
*/
public String getServerName() {
return request.getServerName();
}
/**
* The default behavior of this method is to call
* getServerPort()
on the wrapped request object.
*/
public int getServerPort() {
return request.getServerPort();
}
/**
* The default behavior of this method is to call
* getUserPrincipal()
on the wrapped request object.
*/
public Principal getUserPrincipal() {
return request.getUserPrincipal();
}
/**
* The default behavior of this method is to call
* getWindowId()
on the wrapped request object.
*/
public String getWindowID() {
return request.getWindowID();
}
/**
* The default behavior of this method is to call
* getWindowState()
on the wrapped request object.
*/
public WindowState getWindowState() {
return request.getWindowState();
}
/**
* The default behavior of this method is to call
* isPortletModeAllowed(mode)
on the wrapped request object.
*/
public boolean isPortletModeAllowed(PortletMode mode) {
return request.isPortletModeAllowed(mode);
}
/**
* The default behavior of this method is to call
* isRequestedSessionIdValid()
on the wrapped request object.
*/
public boolean isRequestedSessionIdValid() {
return request.isRequestedSessionIdValid();
}
/**
* The default behavior of this method is to call
* isSecure()
on the wrapped request object.
*/
public boolean isSecure() {
return request.isSecure();
}
/**
* The default behavior of this method is to call
* isUserInRole(role)
on the wrapped request object.
*/
public boolean isUserInRole(String role) {
return request.isUserInRole(role);
}
/**
* The default behavior of this method is to call
* isWindowStateAllowed(state)
on the wrapped request object.
*/
public boolean isWindowStateAllowed(WindowState state) {
return request.isWindowStateAllowed(state);
}
/**
* The default behavior of this method is to call
* removeAttribute(name)
on the wrapped request object.
*/
public void removeAttribute(String name) {
request.removeAttribute(name);
}
/**
* The default behavior of this method is to call
* setAttribute(name, o)
on the wrapped request object.
*/
public void setAttribute(String name, Object o) {
request.setAttribute(name, o);
}
/**
* Return the wrapped request object.
*
* @return the wrapped request
*/
public PortletRequest getRequest() {
return request;
}
/**
* Sets the request object being wrapped.
*
* @param request the request to set
* @throws java.lang.IllegalArgumentException if the request is null.
*/
public void setRequest(PortletRequest request) {
if ( request == null)
throw new java.lang.IllegalArgumentException("Request is null");
this.request = request;
}
/**
* The default behavior of this method is to call
* getCookies()
on the wrapped request object.
*/
public Cookie[] getCookies() {
return request.getCookies();
}
/**
* The default behavior of this method is to call
* getPrivateParameterMap()
on the wrapped request object.
*/
public MapgetPublicParameterMap()
on the wrapped request object.
*/
public MapResourceResponseWrapper
provides a convenient
* implementation of the ResourceResponse
interface
* that can be subclassed by developers wishing to adapt the response.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped response object.
*
* @since 2.0
* @see ResourceResponse
*/
public class ResourceResponseWrapper extends PortletResponseWrapper implements ResourceResponse {
ResourceResponse response;
/**
* Creates an ResourceResponse
adaptor
* wrapping the given response object.
*
* @param response the event response to wrap
* @throws java.lang.IllegalArgumentException if the response is null
*/
public ResourceResponseWrapper(ResourceResponse response) {
super(response);
this.response = response;
}
/**
* The default behavior of this method is to call
* flushBuffer()
on the wrapped response object.
*/
public void flushBuffer() throws IOException {
response.flushBuffer();
}
/**
* The default behavior of this method is to call
* getBufferSize()
on the wrapped response object.
*/
public int getBufferSize() {
return response.getBufferSize();
}
/**
* The default behavior of this method is to call
* getCharacterEncoding()
on the wrapped response object.
*/
public String getCharacterEncoding() {
return response.getCharacterEncoding();
}
/**
* The default behavior of this method is to call
* getContentType()
on the wrapped response object.
*/
public String getContentType() {
return response.getContentType();
}
/**
* The default behavior of this method is to call
* getLocale()
on the wrapped response object.
*/
public Locale getLocale() {
return response.getLocale();
}
/**
* The default behavior of this method is to call
* getPortletOutputStream()
on the wrapped response object.
*/
public OutputStream getPortletOutputStream() throws IOException {
return response.getPortletOutputStream();
}
/**
* The default behavior of this method is to call
* getWriter()
on the wrapped response object.
*/
public PrintWriter getWriter() throws IOException {
return response.getWriter();
}
/**
* The default behavior of this method is to call
* isCommitted()
on the wrapped response object.
*/
public boolean isCommitted() {
return response.isCommitted();
}
/**
* The default behavior of this method is to call
* reset()
on the wrapped response object.
*/
public void reset() {
response.reset();
}
/**
* The default behavior of this method is to call
* resetBuffer()
on the wrapped response object.
*/
public void resetBuffer() {
response.resetBuffer();
}
/**
* The default behavior of this method is to call
* setBufferSize(size)
on the wrapped response object.
*/
public void setBufferSize(int size) {
response.setBufferSize(size);
}
/**
* The default behavior of this method is to call
* setContentType(type)
on the wrapped response object.
*/
public void setContentType(String type) {
response.setContentType(type);
}
/**
* The default behavior of this method is to call
* getCacheControl()
on the wrapped response object.
*/
public CacheControl getCacheControl() {
return response.getCacheControl();
}
/**
* The default behavior of this method is to call
* setCharacterEncoding(String charset)
on the wrapped response object.
*/
public void setCharacterEncoding(String charset) {
response.setCharacterEncoding(charset);
return;
}
/**
* The default behavior of this method is to call
* setLocale(Locale loc)
on the wrapped response object.
*/
public void setLocale(Locale loc) {
response.setLocale(loc);
return;
}
/**
* The default behavior of this method is to call
* setContentLength()
on the wrapped response object.
*/
public void setContentLength(int len) {
response.setContentLength(len);
}
/**
* Return the wrapped response object.
*
* @return the wrapped response
*/
public ResourceResponse getResponse() {
return response;
}
/**
* Sets the response object being wrapped.
*
* @param response the response to set
* @throws java.lang.IllegalArgumentException if the response is null.
*/
public void setResponse(ResourceResponse response) {
if ( response == null)
throw new java.lang.IllegalArgumentException("Response is null");
this.response = response;
}
/**
* The default behavior of this method is to call
* createActionURL()
on the wrapped response object.
*/
public PortletURL createActionURL() throws IllegalStateException {
return response.createActionURL();
}
/**
* The default behavior of this method is to call
* createRenderURL()
on the wrapped response object.
*/
public PortletURL createRenderURL() throws IllegalStateException {
return response.createRenderURL();
}
/**
* The default behavior of this method is to call
* createResourceURL()
on the wrapped response object.
*/
public ResourceURL createResourceURL() throws IllegalStateException {
return response.createResourceURL();
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/ResourceRequestWrapper.java 0000644 0001750 0001750 00000012377 11201125563 031030 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import javax.portlet.ResourceRequest;
/**
* The ResourceRequestWrapper
provides a convenient
* implementation of the ResourceRequest
interface
* that can be subclassed by developers wishing to adapt the request.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped request object.
*
* @since 2.0
* @see ResourceRequest
*/
public class ResourceRequestWrapper extends PortletRequestWrapper implements ResourceRequest {
ResourceRequest request;
/**
* Creates an ResourceRequest
adaptor
* wrapping the given request object.
*
* @param request the resource request to wrap
* @throws java.lang.IllegalArgumentException if the request is null
*/
public ResourceRequestWrapper(ResourceRequest request) {
super(request);
this.request = request;
}
/**
* The default behavior of this method is to call
* getPortletInputStream()
on the wrapped request object.
*/
public InputStream getPortletInputStream() throws IOException {
return request.getPortletInputStream();
}
/**
* The default behavior of this method is to call
* getReader()
on the wrapped request object.
*/
public BufferedReader getReader() throws UnsupportedEncodingException,
IOException {
return request.getReader();
}
/**
* The default behavior of this method is to call
* setCharacterEncoding(String enc)
* on the wrapped request object.
*/
public void setCharacterEncoding(String enc)
throws UnsupportedEncodingException {
request.setCharacterEncoding(enc);
}
/**
* Return the wrapped request object.
*
* @return the wrapped request
*/
public ResourceRequest getRequest() {
return request;
}
/**
* Sets the request object being wrapped.
*
* @param request the request to set
* @throws java.lang.IllegalArgumentException if the request is null.
*/
public void setRequest(ResourceRequest request) {
if ( request == null)
throw new java.lang.IllegalArgumentException("Request is null");
this.request = request;
}
/**
* The default behavior of this method is to call
* getCharacterEncoding()
on the wrapped request object.
*/
public String getCharacterEncoding() {
return request.getCharacterEncoding();
}
/**
* The default behavior of this method is to call
* getContentLength()
on the wrapped request object.
*/
public int getContentLength() {
return request.getContentLength();
}
/**
* The default behavior of this method is to call
* getContentType()
on the wrapped request object.
*/
public String getContentType() {
return request.getContentType();
}
/**
* The default behavior of this method is to call
* getETag()
on the wrapped request object.
*/
public String getETag() {
return request.getETag();
}
/**
* The default behavior of this method is to call
* getMethod()
on the wrapped request object.
*/
public String getMethod() {
return request.getMethod();
}
/**
* The default behavior of this method is to call
* getResourceID()
on the wrapped request object.
*/
public String getResourceID() {
return request.getResourceID();
}
/**
* The default behavior of this method is to call
* getPrivateRenderParameterMap()
on the wrapped request object.
*/
public MapgetCacheability()
on the wrapped response object.
*/
public String getCacheability() {
return request.getCacheability();
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/RenderRequestWrapper.java 0000644 0001750 0001750 00000005233 11201125563 030451 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import javax.portlet.RenderRequest;
/**
* The RenderRequestWrapper
provides a convenient
* implementation of the RenderRequest
interface
* that can be subclassed by developers wishing to adapt the request.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped request object.
*
* @since 2.0
* @see RenderRequest
*/
public class RenderRequestWrapper extends PortletRequestWrapper implements RenderRequest {
RenderRequest request;
/**
* Creates an RenderRequest
adaptor
* wrapping the given request object.
*
* @param request the render request to wrap
* @throws java.lang.IllegalArgumentException if the request is null
*/
public RenderRequestWrapper(RenderRequest request) {
super(request);
this.request = request;
}
/**
* Return the wrapped request object.
*
* @return the wrapped request
*/
public RenderRequest getRequest() {
return request;
}
/**
* Sets the request object being wrapped.
*
* @param request the request to set
* @throws java.lang.IllegalArgumentException if the request is null.
*/
public void setRequest(RenderRequest request) {
if ( request == null)
throw new java.lang.IllegalArgumentException("Request is null");
this.request = request;
}
/**
* The default behavior of this method is to call
* getETag()
on the wrapped request object.
*/
public String getETag() {
return request.getETag();
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/RenderResponseWrapper.java 0000644 0001750 0001750 00000015632 11201125563 030623 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import javax.portlet.CacheControl;
import javax.portlet.PortletMode;
import javax.portlet.PortletURL;
import javax.portlet.RenderResponse;
import javax.portlet.ResourceURL;
/**
* The RenderResponseWrapper
provides a convenient
* implementation of the RenderResponse
interface
* that can be subclassed by developers wishing to adapt the response.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped response object.
*
* @since 2.0
* @see RenderResponse
*/
public class RenderResponseWrapper extends PortletResponseWrapper implements RenderResponse {
RenderResponse response;
/**
* Creates an RenderResponse
adaptor
* wrapping the given response object.
*
* @param response the event response to wrap
* @throws java.lang.IllegalArgumentException if the response is null
*/
public RenderResponseWrapper(RenderResponse response) {
super(response);
this.response = response;
}
/**
* The default behavior of this method is to call
* flushBuffer()
on the wrapped response object.
*/
public void flushBuffer() throws IOException {
response.flushBuffer();
}
/**
* The default behavior of this method is to call
* getBufferSize()
on the wrapped response object.
*/
public int getBufferSize() {
return response.getBufferSize();
}
/**
* The default behavior of this method is to call
* getCharacterEncoding()
on the wrapped response object.
*/
public String getCharacterEncoding() {
return response.getCharacterEncoding();
}
/**
* The default behavior of this method is to call
* getContentType()
on the wrapped response object.
*/
public String getContentType() {
return response.getContentType();
}
/**
* The default behavior of this method is to call
* getLocale()
on the wrapped response object.
*/
public Locale getLocale() {
return response.getLocale();
}
/**
* The default behavior of this method is to call
* getPortletOutputStream()
on the wrapped response object.
*/
public OutputStream getPortletOutputStream() throws IOException {
return response.getPortletOutputStream();
}
/**
* The default behavior of this method is to call
* getWriter()
on the wrapped response object.
*/
public PrintWriter getWriter() throws IOException {
return response.getWriter();
}
/**
* The default behavior of this method is to call
* isCommitted()
on the wrapped response object.
*/
public boolean isCommitted() {
return response.isCommitted();
}
/**
* The default behavior of this method is to call
* reset()
on the wrapped response object.
*/
public void reset() {
response.reset();
}
/**
* The default behavior of this method is to call
* resetBuffer()
on the wrapped response object.
*/
public void resetBuffer() {
response.resetBuffer();
}
/**
* The default behavior of this method is to call
* setBufferSize(size)
on the wrapped response object.
*/
public void setBufferSize(int size) {
response.setBufferSize(size);
}
/**
* The default behavior of this method is to call
* setContentType(type)
on the wrapped response object.
*/
public void setContentType(String type) {
response.setContentType(type);
}
/**
* The default behavior of this method is to call
* setTitle(title)
on the wrapped response object.
*/
public void setTitle(String title) {
response.setTitle(title);
}
/**
* The default behavior of this method is to call
* getCacheControl()
on the wrapped response object.
*/
public CacheControl getCacheControl() {
return response.getCacheControl();
}
/**
* The default behavior of this method is to call
* setNextPossiblePortletModes()
on the wrapped response object.
*/
public void setNextPossiblePortletModes(CollectioncreateActionURL()
on the wrapped response object.
*/
public PortletURL createActionURL() throws IllegalStateException {
return response.createActionURL();
}
/**
* The default behavior of this method is to call
* createRenderURL()
on the wrapped response object.
*/
public PortletURL createRenderURL() throws IllegalStateException {
return response.createRenderURL();
}
/**
* The default behavior of this method is to call
* createResourceURL()
on the wrapped response object.
*/
public ResourceURL createResourceURL() throws IllegalStateException {
return response.createResourceURL();
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/filter/PortletFilter.java 0000644 0001750 0001750 00000005714 11201125563 027123 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet.filter;
import javax.portlet.PortletException;
/**
* The PortletFilter
is the base interface for all portlet filters.
* It provides the lifecycle methods init
and destroy
* for putting a portlet filter into and out of service.
*
* @since 2.0
*/
public interface PortletFilter {
/**
* Called by the portlet container to indicate to a filter
* that it is being placed into service. The portlet container
* calls the init method exactly once after instantiating the filter.
* The init method must complete successfully before the filter
* is asked to do any filtering work.
*
*
*
* @param filterConfig the filter configuration data defined
* in the portlet deployment descriptor
* @throws PortletException if an error occurs in the filter initialization
*/
public void init(FilterConfig filterConfig) throws PortletException;
/**
* Called by the portlet container to indicate to a filter that it is
* being taken out of service. This method is only called once all threads
* within the filter's doFilter
method have exited or
* after a timeout period has passed.
* doFilter
method again on this instance of the filter.
* ResourceServingPortlet
interface allows
* serving resources through the portlet.
* RenderResponse.createResourceURL()
call.
* If the portlet creates resource URLs with RenderResponse.createResourceURL()
* it must implement this lifecycle method.
*
* @since 2.0
*/
public interface ResourceServingPortlet {
/**
* Called by the portlet container to allow the portlet to generate
* the resource content based on its current state.
* The portal / portlet container must not render any output in addition
* to the content returned by the portlet. The portal / portlet container
* should expect that the portlet may return binary content for a
* renderResource
call.
*
* @param request
* the resource request
* @param response
* the resource response
*
* @exception PortletException
* if the portlet has problems fulfilling the
* rendering request
* @exception UnavailableException
* if the portlet is unavailable to perform render at this time
* @exception PortletSecurityException
* if the portlet cannot fullfill this request because of security reasons
* @exception java.io.IOException
* if the streaming causes an I/O problem
*/
public void serveResource(ResourceRequest request, ResourceResponse response)
throws PortletException, java.io.IOException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletSessionUtil.java 0000644 0001750 0001750 00000005433 11201125563 026670 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The PortletSessionUtil
class helps identify and decode
* attributes in the PORTLET_SCOPE
scope of the PortletSession
* when accessed through the HttpSession an from within calls to methods
* of the HttpSessionBindingListener interface.
*/
public class PortletSessionUtil
{
private static final String PORTLET_SCOPE_NAMESPACE = "javax.portlet.p.";
/**
* Returns the attribute name of an attribute in the
* PORTLET_SCOPE
. If the attribute is in the
* APPLICATION_SCOPE
it returns the attribute name unchanged.
*
* @param name a string specifying the name of the
* encoded portlet attribute
*
* @return the decoded attribute name
*/
public static java.lang.String decodeAttributeName(java.lang.String name)
{
if (name.startsWith(PORTLET_SCOPE_NAMESPACE)) {
int index = name.indexOf('?');
if (index>-1) {
name = name.substring(index+1);
}
}
return name;
}
/**
* Returns the portlet attribute scope from an encoded portlet
* attribute.
*
Possible return values are:
*
*
*
* @param name a string specifying the name of the
* encoded portlet attribute
*
* @return the decoded attribute scope
* @see PortletSession
*/
public static int decodeScope(java.lang.String name)
{
int scope = PortletSession.APPLICATION_SCOPE; // APP
if (name.startsWith(PORTLET_SCOPE_NAMESPACE)) {
int index = name.indexOf('?');
if (index>-1) {
scope = PortletSession.PORTLET_SCOPE; // PORTLET
}
}
return scope;
}
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/PortletResponse.java 0000644 0001750 0001750 00000016747 11201125563 026217 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
* The PortletSession.APPLICATION_SCOPE
PortletSession.PORTLET_SCOPE
PortletResponse
defines the base interface to assist a
* portlet in creating and sending a response to the client. The portlet
* container uses specialized versions of this interface when invoking a
* portlet.
* The portlet container creates these objects and passes them as arguments to
* the portlet's processAction, processEvent, serveResource
and render
methods.
*
* @see ActionResponse
* @see RenderResponse
* @see EventResponse
* @see ResourceResponse
*/
public interface PortletResponse {
/**
* Adds a String property to an existing key to be returned to the portal.
* If there are no property values already associated with the key,
* a new key is created.
* null
.
*/
public void addProperty(String key, String value);
/**
* Sets a String property to be returned to the portal.
* null
.
*/
public void setProperty(String key, String value);
/**
* Returns the encoded URL of the resource, like servlets, JSPs, images and
* other static files, at the given path.
* encodeURL
method may include the session ID and other
* portal/portlet-container specific information into the URL. If encoding
* is not needed, it returns the URL unchanged.
* http://my.co/myportal/mywebap/myfolder/myresource.gif
)
* or a full path URI (e.g.
* /myportal/mywebap/myfolder/myresource.gif
).
*
* @exception java.lang.IllegalArgumentException
* if path doesn't have a leading slash or is not an absolute
* URL
*
* @return the encoded resource URL as string, may not be a valid URL
*/
public String encodeURL(String path);
/**
* The value returned by this method should be prefixed or appended to
* elements, such as JavaScript variables or function names, to ensure they
* are unique in the context of the portal page.
*
* The portlet should note that the cookie may not make
* it to the client, but may be stored at the portal.
* null
.
* @since 2.0
*/
public void addProperty(javax.servlet.http.Cookie cookie);
/**
* Adds an XML DOM element property to the response.
* null
the key is removed from
* the response.
* null
.
* @since 2.0
*/
void addProperty(String key, org.w3c.dom.Element element);
/**
* Creates an element of the type specified to be used in the
* {@link #addProperty(String,Element)} method.
*
* @param tagName name of the element type to instantiate
* @return A new Element object with the nodeName attribute set to tagName,
* and localName, prefix, and namespaceURI set to null.
* @throws org.w3c.dom.DOMException
* INVALID_CHARACTER_ERR: Raised if the specified name
* contains an illegal character.
*/
org.w3c.dom.Element createElement(String tagName) throws org.w3c.dom.DOMException;
}
portlet-api-2.0-spec-1.0/src/main/java/javax/portlet/WindowStateException.java 0000644 0001750 0001750 00000005665 11201125563 027173 0 ustar drazzib drazzib /* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
package javax.portlet;
/**
** The WindowStateException
is thrown when a portlet
** tries to use a window state that is not supported by the current
** runtime environment or the portlet.
**/
public class WindowStateException extends PortletException
{
private transient WindowState _state = null;
private static final long serialVersionUID = 1L;
/**
* Constructs a new portlet state exception with the given text. The
* portlet container may use the text write it to a log.
*
* @param text
* the exception text
* @param state
* the state causing the exception
*/
public WindowStateException (String text, WindowState state)
{
super (text);
_state = state;
}
/**
* Constructs a new portlet state exception when the portlet needs to do
* the following:
*
*
*
* @param text
* the exception text
* @param cause
* the root cause
* @param state
* the state causing the exception
*/
public WindowStateException (String text, Throwable cause, WindowState state)
{
super(text, cause);
_state = state;
}
/**
* Constructs a new portlet state exception when the portlet needs to throw an
* exception. The exception message is based on the localized message
* of the underlying exception.
*
* @param cause
* the root cause
* @param state
* the state causing the exception
*/
public WindowStateException (Throwable cause, WindowState state)
{
super(cause);
_state = state;
}
/**
* Returns the portlet state causing this exception.
*
* @return the window state causing this exception
*/
public WindowState getState()
{
return _state;
}
}