You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@portals.apache.org by ta...@apache.org on 2015/07/13 18:40:01 UTC
svn commit: r1690750 [2/6] - in
/portals/portlet-spec/trunk/portlet-api_2.1.0_spec: ./ src/ src/main/
src/main/appended-resources/ src/main/appended-resources/META-INF/
src/main/java/ src/main/java/META-INF/ src/main/java/javax/
src/main/java/javax/por...
Added: portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/GenericPortlet.java
URL: http://svn.apache.org/viewvc/portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/GenericPortlet.java?rev=1690750&view=auto
==============================================================================
--- portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/GenericPortlet.java (added)
+++ portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/GenericPortlet.java Mon Jul 13 16:39:59 2015
@@ -0,0 +1,791 @@
+/* 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 <CODE>GenericPortlet</CODE> class provides a default implementation for
+ * the <CODE>Portlet</CODE> interface.
+ * <p>
+ * It provides an abstract class to be subclassed to create portlets. A subclass
+ * of <CODE>GenericPortlet</CODE> should either use one of the following annotations:
+ * <ul>
+ * <li><code>@ProcessAction</code></li>
+ * <li><code>@ProcessEvent</code></li>
+ * <li><code>@RenderMode</code></li>
+ * </ul>
+ * or override at least one method, usually
+ * one of the following:
+ * <ul>
+ * <li>processAction, to handle action requests</li>
+ * <li>doView, to handle render requests when in VIEW mode</li>
+ * <li>doEdit, to handle render requests when in EDIT mode</li>
+ * <li>doHelp, to handle render request when in HELP mode</li>
+ * <li>init and destroy, to manage resources that are held for the life of the
+ * servlet</li>
+ * </ul>
+ * <p>
+ * 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.
+ * <p>
+ * 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 {
+
+ /**
+ * 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 <code>getProperty</code> method.
+ * <P>
+ * The value is <code>"javax.portlet.automaticResourceDispatching"</code>.
+ */
+ public static final String AUTOMATIC_RESOURCE_DISPATCH = "javax.portlet.automaticResourceDispatching";
+
+ private transient PortletConfig config;
+
+ private transient Map<String, Method> processActionHandlingMethodsMap = new HashMap<String, Method>();
+ private transient Map<String, Method> processEventHandlingMethodsMap = new HashMap<String, Method>();
+ private transient Map<String, Method> renderModeHandlingMethodsMap = new HashMap<String, Method>();
+
+ /**
+ * Does nothing.
+ */
+
+ public GenericPortlet() {
+ }
+
+ /**
+ * Called by the portlet container to indicate to a portlet that the portlet
+ * is being placed into service.
+ * <p>
+ * The default implementation stores the <code>PortletConfig</code> object
+ * and checks for annotated methods with the annotations
+ * <ul>
+ * <li>@ProcessAction</li>
+ * <li>@ProcessEvent</li>
+ * <li>@RenderMode</li>
+ * </ul>
+ * and stores these in a hashmap for later dispatching.
+ * <p>
+ * The portlet container calls the <code>init</code> method exactly once
+ * after instantiating the portlet. The <code>init</code> method must
+ * complete successfully before the portlet can receive any requests.
+ *
+ * <p>
+ * The portlet container cannot place the portlet into service if the
+ * <code>init</code> method does one of the following:
+ * <ol>
+ * <li>it throws a <code>PortletException</code>
+ * <li>it does not return within a time period defined by the Web server
+ * </ol>
+ *
+ *
+ * @param config
+ * a <code>PortletConfig</code> 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 <code>super.init(config)</code>.
+ *
+ * <p>
+ * Instead of overriding {@link #init(PortletConfig)}, simply override this
+ * method and it will be called by
+ * <code>GenericPortlet.init(PortletConfig config)</code>. The
+ * <code>PortletConfig</code> 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
+ * <code>RenderResponse.createActionURL()</code> method.
+ * <p>
+ * The default implementation tries to dispatch to a method
+ * annotated with <code>@ProcessAction</code> that matches the action parameter
+ * value <code>ActionRequest.ACTION_NAME</code> or, if no
+ * such method is found throws a <code>PortletException</code>.<br>
+ * Note that the annotated methods needs to be public in order
+ * to be allowed to be called by <code>GenericPortlet</code>.
+
+ *
+ * @param request
+ * the action request
+ * @param response
+ * the action response
+ * @exception PortletException
+ * if the portlet cannot fulfill the request
+ * @exception UnavailableException
+ * if the portlet is unavailable to process the action at
+ * this time
+ * @exception PortletSecurityException
+ * if the portlet cannot fulfill this request due to
+ * 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
+ * <code>doHeaders</code> method, sets the title using the
+ * <code>getTitle</code> method and invokes the <code>doDispatch</code>
+ * method.
+ * <p>
+ * It also evaluates the <code>RENDER_PART</code> request attribute and if
+ * set calls the <code>doHeaders, getNextPossiblePortletModes</code> and
+ * <code>getTitle</code> methods for the <code>RENDER_HEADERS</code>
+ * part and the <code>doDispatch</code> method for the
+ * <code>RENDER_MARKUP</code> part.<br>
+ * If the <code>RENDER_PART</code> 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 fulfill the request
+ * @exception UnavailableException
+ * if the portlet is unavailable to perform render at this
+ * time
+ * @exception PortletSecurityException
+ * if the portlet cannot fulfill this request due to
+ * 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<PortletMode> nextModes = getNextPossiblePortletModes(request);
+ if (nextModes != null)
+ response.setNextPossiblePortletModes(nextModes);
+ response.setTitle(getTitle(request));
+ } else if (renderPartAttrValue.equals(RenderRequest.RENDER_MARKUP)) {
+ doDispatch(request, response);
+ } else {
+ throw new PortletException("Unknown value of the 'javax.portlet.render_part' request attribute");
+ }
+ } else {
+ // buffered portal calling
+ doHeaders(request, response);
+ Collection<PortletMode> nextModes = getNextPossiblePortletModes(request);
+ if (nextModes != null)
+ response.setNextPossiblePortletModes(nextModes);
+ response.setTitle(getTitle(request));
+ doDispatch(request, response);
+ }
+ }
+
+ /**
+ * Used by the render method to get the title.
+ * <p>
+ * 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.
+ * <p>
+ * Portlets can overwrite this method to provide dynamic titles (e.g. based
+ * on locale, client, and session information). Examples are:
+ * <UL>
+ * <LI>language-dependent titles for multi-lingual portals</li>
+ * <LI>shorter titles for WAP phones</li>
+ * <LI>the number of messages in a mailbox portlet</li>
+ * </UL>
+ *
+ * @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:
+ * <ol>
+ * <li>
+ * method annotated with <code>@RenderMode</code> and the name of the portlet mode
+ * </li>
+ * <li>
+ * a set of helper methods depending on the current portlet mode the portlet
+ * is currently in. These methods are:
+ * <ul>
+ * <li><code>doView</code> for handling <code>view</code> requests</li>
+ * <li><code>doEdit</code> for handling <code>edit</code> requests</li>
+ * <li><code>doHelp</code> for handling <code>help</code> requests</li>
+ * </ul>
+ * </li>
+ * </ol>
+ * <p>
+ * If the window state of this portlet is <code>minimized</code>, this
+ * method does not invoke any of the portlet mode rendering methods.
+ * <p>
+ * For handling custom portlet modes the portlet should either use the
+ * <code>@RenderMode</code> annotation or override this
+ * method. Note that the annotated methods needs to be public in order
+ * to be allowed to be called by <code>GenericPortlet</code>.
+ *
+ * @param request
+ * the render request
+ * @param response
+ * the render response
+ *
+ * @exception PortletException
+ * if the portlet cannot fulfill the request
+ * @exception UnavailableException
+ * if the portlet is unavailable to perform render at this
+ * time
+ * @exception PortletSecurityException
+ * if the portlet cannot fulfill this request due to
+ * 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 <code>view</code> mode.
+ * <p>
+ * The default implementation throws an exception.
+ *
+ * @param request
+ * the portlet request
+ * @param response
+ * the render response
+ *
+ * @exception PortletException
+ * if the portlet cannot fulfill the request
+ * @exception UnavailableException
+ * if the portlet is unavailable to perform render at this
+ * time
+ * @exception PortletSecurityException
+ * if the portlet cannot fulfill this request due to
+ * 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 <code>edit</code> mode.
+ * <p>
+ * The default implementation throws an exception.
+ *
+ * @param request
+ * the portlet request
+ * @param response
+ * the render response
+ *
+ * @exception PortletException
+ * if the portlet cannot fulfill the request
+ * @exception UnavailableException
+ * if the portlet is unavailable to perform render at this
+ * time
+ * @exception PortletSecurityException
+ * if the portlet cannot fulfill this request due to
+ * 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 <code>help</code> mode.
+ * <p>
+ * The default implementation throws an exception.
+ *
+ * @param request
+ * the portlet request
+ * @param response
+ * the render response
+ *
+ * @exception PortletException
+ * if the portlet cannot fulfill the request
+ * @exception UnavailableException
+ * if the portlet is unavailable to perform render at this
+ * time
+ * @exception PortletSecurityException
+ * if the portlet cannot fulfill this request due to
+ * 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.
+ * <p>
+ * 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 <code>PortletContext</code> 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
+ * <code>resource-bundle</code> 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 <code>String</code> specifying the name of the
+ * initialization parameter
+ *
+ * @return a <code>String</code> containing the value of the
+ * initialization parameter
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if name is <code>null</code>.
+ */
+ 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 <code>Enumeration</code> of <code>String</code> objects
+ * containing the names of the portlet initialization parameters, or
+ * an empty Enumeration if the portlet has no initialization
+ * parameters.
+ */
+ public java.util.Enumeration<String> getInitParameterNames() {
+ if (config == null)
+ throw new java.lang.IllegalStateException(
+ "Config is null, please ensure that your init(config) method calls super.init(config)");
+
+ return config.getInitParameterNames();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.portlet.PortletConfig#getProcessingEventQNames()
+ */
+ public Enumeration<QName> getProcessingEventQNames() {
+ if (config == null)
+ throw new java.lang.IllegalStateException(
+ "Config is null, please ensure that your init(config) method calls super.init(config)");
+
+ return config.getProcessingEventQNames();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.portlet.PortletConfig#getPublishingEventQNames()
+ */
+ public Enumeration<QName> getPublishingEventQNames() {
+ if (config == null)
+ throw new java.lang.IllegalStateException(
+ "Config is null, please ensure that your init(config) method calls super.init(config)");
+
+ return config.getPublishingEventQNames();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.portlet.PortletConfig#getSupportedLocales()
+ */
+ public Enumeration<Locale> getSupportedLocales() {
+ if (config == null)
+ throw new java.lang.IllegalStateException(
+ "Config is null, please ensure that your init(config) method calls super.init(config)");
+
+ return config.getSupportedLocales();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.PortletConfig#getContainerRuntimeOptions()
+ */
+ public Map<String, String[]> getContainerRuntimeOptions() {
+ return config.getContainerRuntimeOptions();
+ }
+
+ // -------------------------------------------------------------------------
+ // V 2.0 additions
+ // -------------------------------------------------------------------------
+
+ /**
+ * Default resource serving.
+ * <p>
+ * The default implementation of this method does nothing.
+ * <p>
+ * However, if the reserved portlet initialization parameter
+ * {@link #AUTOMATIC_RESOURCE_DISPATCH}
+ * (= "javax.portlet.automaticResourceDispatching")
+ * is set to <code>true</code>, the default
+ * implementation will perform a
+ * <code>PortletRequestDispatcher.forward</code> to the location designated by
+ * 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 {
+ String autofwd = getInitParameter(AUTOMATIC_RESOURCE_DISPATCH);
+ if (autofwd != null && autofwd.equalsIgnoreCase("true")) {
+ 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 <code>@ProcessEvent</code> that matches the
+ * event name or, if no
+ * such method is found just sets the current render parameters on
+ * the response.<br>
+ * Note that the annotated methods needs to be public in order
+ * to be allowed to be called by <code>GenericPortlet</code>.
+ *
+ * @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.
+ * <p>
+ * 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.
+ * <p>
+ * 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.
+ * <p>
+ * 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.
+ * <p>
+ * The default implemention of this method returns <code>null</code>.
+ *
+ * @since 2.0
+ */
+ protected java.util.Collection<PortletMode> getNextPossiblePortletModes(RenderRequest request) {
+ return null;
+ }
+
+ /**
+ * Returns the names of the public render parameters supported by the
+ * portlet as an <code>Enumeration</code> of String objects, or an empty
+ * <code>Enumeration</code> if the portlet has no public render
+ * parameters.
+ *
+ * @return an <code>Enumeration</code> of <code>String</code> objects
+ * containing the names of the public render parameters, or an empty
+ * <code>Enumeration</code> if the portlet does not define any
+ * public render parameters.
+ *
+ * @see javax.portlet.PortletConfig#getPublicRenderParameterNames()
+ */
+ public Enumeration<String> getPublicRenderParameterNames() {
+ if (config == null)
+ throw new java.lang.IllegalStateException(
+ "Config is null, please ensure that your init(config) method calls super.init(config)");
+
+ return config.getPublicRenderParameterNames();
+ }
+
+ /**
+ * Returns the default namespace for events and public parameters. This
+ * namespace is defined in the portlet deployment descriptor with the
+ * <code>default-namespace</code> element.
+ * <p>
+ * If no default namespace is defined in the portlet deployment descriptor
+ * this methods returns the XML default namespace
+ * <code>XMLConstants.NULL_NS_URI</code>.
+ *
+ * @return the default namespace defined in the portlet deployment
+ * descriptor, or <code>XMLConstants.NULL_NS_URI</code> 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);
+ }
+ }
+ }
+ }
+ }
+}
Added: portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/MimeResponse.java
URL: http://svn.apache.org/viewvc/portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/MimeResponse.java?rev=1690750&view=auto
==============================================================================
--- portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/MimeResponse.java (added)
+++ portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/MimeResponse.java Mon Jul 13 16:39:59 2015
@@ -0,0 +1,423 @@
+/* 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 <CODE>MimeResponse</CODE> 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 <code>setProperty</code> method intended to be used in
+ * forwarded or included servlets/JSPs.
+ * <P>
+ * If the expiration value is set to <code>0</code>, caching is disabled for this
+ * portlet; if the value is set to <code>-1</code>, the cache does not expire.
+ * <p>
+ * A default can be defined in the portlet deployment descriptor
+ * with the <code>expiration-cache<code> tag, otherwise it is <code>0</code>.
+ * <p>
+ * Non-integer values are treated as <code>0</code>.
+ * <p>
+ * The value is <code>"portlet.expiration-cache"</code>.
+ *
+ * @see CacheControl
+ */
+ public static final String EXPIRATION_CACHE = "portlet.expiration-cache";
+
+ /**
+ * Property to set the cache scope for this response using the
+ * <code>setProperty</code> method intended to be used in
+ * forwarded or included servlets/JSPs.
+ * <P>
+ * Predefined cache scopes are: <code>PUBLIC_SCOPE</code> and <code>PRIVATE_SCOPE</code>.
+ * <p>
+ * A default can be defined in the portlet deployment descriptor
+ * with the <code>cache-scope<code> tag, otherwise it is <code>PRIVATE_SCOPE</code>.
+ * <p>
+ * Values that are not either <code>PUBLIC_SCOPE</code> or <code>PRIVATE_SCOPE</code>
+ * are treated as <code>PRIVATE_SCOPE</code>.
+ * <p>
+ * The value is <code>"portlet.cache-scope"</code>.
+ *
+ * @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 <code>"portlet.public-scope"</code>.
+ *
+ * @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 <code>"portlet.private-scope"</code>.
+ *
+ * @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.
+ * <p>
+ * This property needs to be set using the <code>setProperty</code> method.
+ * <P>
+ * The value is <code>"portlet.ETag "</code>.
+ *
+ * @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 <code>setProperty</code> method with a non-null
+ * value and is intended to be used in forwarded or included servlets/JSPs.
+ * The value itself is not evaluated.
+ * <P>
+ * The value is <code>"portlet.use-cached-content "</code>.
+ *
+ * @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.
+ * <p>
+ * This property needs to be set using the <code>setProperty</code> method with a non-null
+ * value. The value itself is not evaluated.
+ * <p>
+ * The value is <code>"X-JAVAX-PORTLET-NAMESPACED-RESPONSE"</code>.
+ *
+ * @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.
+ * <p>
+ * Support for this property is optional and the portlet can verify if the
+ * calling portal supports this property via the <code>MARKUP_HEAD_ELEMENT_SUPPORT</code>
+ * property on the <code>PortalContext</code>.
+ * <p>
+ * 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.
+ * <p>
+ * This property needs to be set using the
+ * <code>setProperty(String key,org.w3c.dom.Element element)</code>
+ * method.
+ * <p>
+ * The value is <code>"javax.portlet.markup.head.element"</code>.
+ *
+ * @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.
+ * <p>
+ * If no content type was set previously using the {@link #setContentType}
+ * method this method returns <code>null</code>.
+ *
+ * @see #setContentType
+ *
+ * @return the MIME type of the response, or <code>null</code> 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.
+ * <p>
+ * Calling <code>setContentType</code> after <code>getWriter</code> or
+ * <code>getOutputStream</code> does not change the content type.
+ * <p>
+ *
+ * @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.
+ *
+ * <p>
+ * See <a href="http://ds.internic.net/rfc/rfc2045.txt">RFC 2047</a> for
+ * more information about character encoding and MIME.
+ *
+ * @return a <code>String</code> specifying the name of the charset, for
+ * example, <code>ISO-8859-1</code>
+ *
+ */
+ public String getCharacterEncoding();
+
+ /**
+ * Returns a PrintWriter object that can send character text to the portal.
+ * <p>
+ * Before calling this method the content type of the render response should
+ * be set using the {@link #setContentType} method.
+ * <p>
+ * Either this method or {@link #getPortletOutputStream} may be called to
+ * write the body, not both.
+ *
+ * @return a <code>PrintWriter</code> 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 <code>getPortletOutputStream</code> 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.
+ * <p>
+ * 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 <code>IllegalStateException</code>.
+ *
+ * @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 <code>IllegalStateException</code>.
+ *
+ * @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
+ * <code>IllegalStateException</code>.
+ *
+ * @exception java.lang.IllegalStateException
+ * if the response has already been committed
+ *
+ * @see #setBufferSize
+ * @see #getBufferSize
+ * @see #flushBuffer
+ * @see #isCommitted
+ */
+ public void reset();
+
+ /**
+ * Returns a <code>OutputStream</code> suitable for writing binary data in
+ * the response. The portlet container does not encode the binary data.
+ * <p>
+ * Before calling this method the content type of the render response must
+ * be set using the {@link #setContentType} method.
+ * <p>
+ * Calling <code>flush()</code> on the OutputStream commits the response.
+ * <p>
+ * Either this method or {@link #getWriter} may be called to write the body,
+ * not both.
+ *
+ * @return a <code>OutputStream</code> for writing binary data
+ *
+ * @exception java.lang.IllegalStateException
+ * if the <code>getWriter</code> 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.
+ * <p>
+ * The returned URL can be further extended by adding portlet-specific
+ * parameters and portlet modes and window states.
+ * <p>
+ * 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.
+ * <p>
+ * The returned URL can be further extended by adding portlet-specific
+ * parameters and portlet modes and window states.
+ * <p>
+ * 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.
+ * <p>
+ * If a request is triggered by the PortletURL, it results in a serve
+ * resource request of the <code>ResourceServingPortlet</code> interface.
+ * <p>
+ * The returned URL can be further extended by adding portlet-specific
+ * parameters .
+ * <p>
+ * The created URL will per default contain the current
+ * cacheability setting of the parent resource.
+ * If no parent resource is available, <code>PAGE</code> 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();
+
+
+
+
+}
Added: portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortalContext.java
URL: http://svn.apache.org/viewvc/portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortalContext.java?rev=1690750&view=auto
==============================================================================
--- portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortalContext.java (added)
+++ portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortalContext.java Mon Jul 13 16:39:59 2015
@@ -0,0 +1,120 @@
+/* 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 <CODE>PortalContext</CODE> interface gives the portlet
+ * the ability to retrieve information about the portal calling this portlet.
+ * <p>
+ * The portlet can only read the <CODE>PortalContext</CODE> data.
+ */
+public interface PortalContext
+{
+ /**
+ * Property indicating if the portal application supports the
+ * <code>MimeResponse</code> property <code>MARKUP_HEAD_ELEMENT</code>.
+ * <p>
+ * A non-null value indicates that the portal application supports
+ * the <code>MARKUP_HEAD_ELEMENT</code> property.
+ * <p>
+ * The value is <code>"javax.portlet.markup.head.element.support"</code>.
+ *
+ * @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 <code>null</code> if there is
+ * no property by that name.
+ *
+ * @param name property name
+ *
+ * @return portal property with key <code>name</code>
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if name is <code>null</code>.
+ */
+
+ public java.lang.String getProperty(java.lang.String name);
+
+
+ /**
+ * Returns all portal property names, or an empty
+ * <code>Enumeration</code> if there are no property names.
+ *
+ * @return All portal property names as an
+ * <code>Enumeration</code> of <code>String</code> objects
+ */
+ public java.util.Enumeration<String> getPropertyNames();
+
+
+ /**
+ * Returns all supported portlet modes by the portal
+ * as an enumeration of <code>PortletMode</code> objects.
+ * <p>
+ * The portlet modes must at least include the
+ * standard portlet modes <code>EDIT, HELP, VIEW</code>.
+ *
+ * @return All supported portal modes by the portal
+ * as an enumeration of <code>PortletMode</code> objects.
+ */
+
+ public java.util.Enumeration<PortletMode> getSupportedPortletModes();
+
+
+ /**
+ * Returns all supported window states by the portal
+ * as an enumeration of <code>WindowState</code> objects.
+ * <p>
+ * The window states must at least include the
+ * standard window states <code> MINIMIZED, NORMAL, MAXIMIZED</code>.
+ *
+ * @return All supported window states by the portal
+ * as an enumeration of <code>WindowState</code> objects.
+ */
+
+ public java.util.Enumeration<WindowState> getSupportedWindowStates();
+
+
+ /**
+ * Returns information about the portal like vendor, version, etc.
+ * <p>
+ * The form of the returned string is <I>servername/versionnumber</I>. For
+ * example, the reference implementation Pluto may return the string
+ * <CODE>Pluto/1.0</CODE>.
+ * <p>
+ * The portlet container may return other optional information after the
+ * primary string in parentheses, for example, <CODE>Pluto/1.0
+ * (JDK 1.3.1; Windows NT 4.0 x86)</CODE>.
+ *
+ * @return a <CODE>String</CODE> containing at least the portal name and version number
+ */
+
+ public java.lang.String getPortalInfo();
+}
Added: portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/Portlet.java
URL: http://svn.apache.org/viewvc/portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/Portlet.java?rev=1690750&view=auto
==============================================================================
--- portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/Portlet.java (added)
+++ portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/Portlet.java Mon Jul 13 16:39:59 2015
@@ -0,0 +1,186 @@
+/* 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 <CODE>Portlet</CODE> 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.
+ * <P>
+ * 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.
+ * <p>
+ * 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.
+ * <P>
+ * The portlet container instantiates portlets, manages their lifecycle
+ * and invoking them to process requests. The lifecycle consists of:
+ * <ul>
+ * <li>initializing the portlet using using the <code>init</code> method
+ * <li>request processsing
+ * <li>taking the portlet out of service using the <code>destroy</code> method
+ * </ul>
+ * <p>
+ * Request processing is divided into two types:
+ * <ul>
+ * <li>action requests handled through the <code>processAction</code> method,
+ * to perform actions targeted to the portlet
+ * <li>render requests handled through the <code>render</code> method,
+ * to perform the render operation
+ * </ul>
+ */
+public interface Portlet
+{
+
+
+ /**
+ * Called by the portlet container to indicate to a portlet that the
+ * portlet is being placed into service.
+ *
+ * <p>The portlet container calls the <code>init</code>
+ * method exactly once after instantiating the portlet.
+ * The <code>init</code> method must complete successfully
+ * before the portlet can receive any requests.
+ *
+ * <p>The portlet container cannot place the portlet into service
+ * if the <code>init</code> method
+ * <ol>
+ * <li>Throws a <code>PortletException</code>
+ * <li>Does not return within a time period defined by the portlet container.
+ * </ol>
+ *
+ *
+ * @param config a <code>PortletConfig</code> 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
+ * <code>RenderResponse.createActionURL()</code> method.
+ * <p>
+ * 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:
+ * <ul>
+ * <li>issue a redirect
+ * <li>change its window state
+ * <li>change its portlet mode
+ * <li>modify its persistent state
+ * <li>set render parameters
+ * </ul>
+ * <p>
+ * 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.
+ * <p>
+ * 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.
+ *
+ * <p>This method enables the portlet to do the following:
+ * <ul>
+ * <li>clean up any resources that it holds (for example, memory,
+ * file handles, threads)
+ * <li>make sure that any persistent state is
+ * synchronized with the portlet current state in memory.
+ * </ul>
+ */
+
+ public void destroy();
+}
+
Added: portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortletConfig.java
URL: http://svn.apache.org/viewvc/portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortletConfig.java?rev=1690750&view=auto
==============================================================================
--- portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortletConfig.java (added)
+++ portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortletConfig.java Mon Jul 13 16:39:59 2015
@@ -0,0 +1,256 @@
+/* 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 <CODE>PortletConfig</CODE> 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.
+ * <p>
+ * 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.
+ * <P>
+ * The name may be provided via server administration, assigned in the
+ * portlet application deployment descriptor with the <code>portlet-name</code>
+ * tag.
+ *
+ * @return the portlet name
+ */
+
+ public String getPortletName ();
+
+
+ /**
+ * Returns the <code>PortletContext</code> of the portlet application
+ * the portlet is in.
+ *
+ * @return a <code>PortletContext</code> 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 <code>resource-bundle</code> 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 <code>String</code> specifying the name
+ * of the initialization parameter
+ *
+ * @return a <code>String</code> containing the value
+ * of the initialization parameter
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if name is <code>null</code>.
+ */
+
+ public String getInitParameter(java.lang.String name);
+
+
+ /**
+ * Returns the names of the portlet initialization parameters as an
+ * <code>Enumeration</code> of String objects, or an empty <code>Enumeration</code> if the
+ * portlet has no initialization parameters.
+ *
+ * @return an <code>Enumeration</code> of <code>String</code>
+ * objects containing the names of the portlet
+ * initialization parameters, or an empty <code>Enumeration</code> if the
+ * portlet has no initialization parameters.
+ */
+
+ public java.util.Enumeration<String> getInitParameterNames();
+
+
+ /**
+ * Returns the names of the public render parameters supported by the portlet
+ * as an <code>Enumeration</code> of <code>String</code> objects,
+ * or an empty <code>Enumeration</code> if the
+ * portlet has not defined public render parameters.
+ * <p>
+ * Public render parameters are defined in the portlet deployment descriptor
+ * with the <code>supported-public-render-parameter</code> element.
+ *
+ * @return an <code>Enumeration</code> of <code>String</code>
+ * objects containing the names of the public
+ * render parameters, or an empty <code>Enumeration</code> if the
+ * portlet has not defined support for any public render parameters
+ * in the portlet deployment descriptor.
+ * @since 2.0
+ */
+
+ public java.util.Enumeration<String> getPublicRenderParameterNames();
+
+
+ /**
+ * Returns the default namespace for events and public render parameters.
+ * This namespace is defined in the portlet deployment descriptor
+ * with the <code>default-namespace</code> element.
+ * <p>
+ * If no default namespace is defined in the portlet deployment
+ * descriptor this methods returns the XML default namespace
+ * <code>XMLConstants.NULL_NS_URI</code>.
+ *
+ * @return the default namespace defined in the portlet deployment
+ * descriptor, or <code>XMLConstants.NULL_NS_URI</code> 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 <code>Enumeration</code> of <code>QName</code> objects,
+ * or an empty <code>Enumeration</code> if the
+ * portlet has not defined any publishing events.
+ * <p>
+ * Publishing events are defined in the portlet deployment descriptor
+ * with the <code>supported-publishing-event</code> element.
+ * <p>
+ * Note that this call does not return any events published that have not been
+ * declared in the deployment descriptor as supported.
+ * <p>
+ * If the event was defined using the <code>name</code> element instead of
+ * the <code>qname</code> element the defined default namespace
+ * is added as namespace for the returned QName.
+ *
+ * @return an <code>Enumeration</code> of <code>QName</code>
+ * objects containing the names of the publishing events,
+ * or an empty <code>Enumeration</code> if the
+ * portlet has not defined any support for publishing events in
+ * the deployment descriptor.
+ * @since 2.0
+ */
+ public java.util.Enumeration<javax.xml.namespace.QName> getPublishingEventQNames();
+
+
+ /**
+ * Returns the QNames of the processing events supported by the portlet
+ * as an <code>Enumeration</code> of <code>QName</code> objects,
+ * or an empty <code>Enumeration</code> if the
+ * portlet has not defined any processing events.
+ * <p>
+ * Processing events are defined in the portlet deployment descriptor
+ * with the <code>supported-processing-event</code> element.
+ * <p>
+ * If the event was defined using the <code>name</code> element instead of
+ * the <code>qname</code> element the defined default namespace
+ * is added as namespace for the returned QName.
+ *
+ * @return an <code>Enumeration</code> of <code>QName</code>
+ * objects containing the names of the processing events,
+ * or an empty <code>Enumeration</code> if the
+ * portlet has not defined any support for processing events in
+ * the deployment descriptor.
+ * @since 2.0
+ */
+ public java.util.Enumeration<javax.xml.namespace.QName> getProcessingEventQNames();
+
+ /**
+ * Returns the locales supported by the portlet
+ * as an <code>Enumeration</code> of <code>Locale</code> objects,
+ * or an empty <code>Enumeration</code> if the
+ * portlet has not defined any supported locales.
+ * <p>
+ * Supported locales are defined in the portlet deployment descriptor
+ * with the <code>supported-locale</code> element.
+ *
+ * @return an <code>Enumeration</code> of <code>Locale</code>
+ * objects containing the supported locales,
+ * or an empty <code>Enumeration</code> if the
+ * portlet has not defined any supported locales in
+ * the deployment descriptor.
+ * @since 2.0
+ */
+ public java.util.Enumeration<java.util.Locale> getSupportedLocales();
+
+ /**
+ * Returns the container runtime options
+ * and values for this portlet.
+ * <p>
+ * The portlet can set container runtime
+ * options in the <code>portlet.xml</code> via the
+ * <code>container-runtime-option</code> element with a name and a
+ * value on the application and portlet level.<br>
+ * 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.
+ * <p>
+ * The map returned from this method will provide the subset the
+ * portlet container supports of the options the portlet has specified
+ * in the <code>portlet.xml</code>. Options that the portlet container
+ * does not support will not be returned in this map.
+ * <p>
+ * The map will contain name of the runtime option as key of type String
+ * and the runtime options as values of type String array (<code>String[]</code>)
+ * with the values specified in the <code>portlet.xml</code> deployment descriptor.
+ *
+ * @since 2.0
+ *
+ * @return an immutable <code>Map</code> containing portlet
+ * container runtime options names as keys and the
+ * container runtime values as map values, or an empty <code>Map</code>
+ * if no portlet container runtime options are set
+ * in the <code>portlet.xml</code> 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 (<code>String[]</code>).
+ */
+ public java.util.Map<String, String[]> getContainerRuntimeOptions();
+}
+
Added: portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortletContext.java
URL: http://svn.apache.org/viewvc/portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortletContext.java?rev=1690750&view=auto
==============================================================================
--- portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortletContext.java (added)
+++ portals/portlet-spec/trunk/portlet-api_2.1.0_spec/src/main/java/javax/portlet/PortletContext.java Mon Jul 13 16:39:59 2015
@@ -0,0 +1,469 @@
+/* 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 <CODE>PortletContext</CODE> interface defines a portlet view
+ * of the portlet container.
+ * The <CODE>PortletContext</CODE> also makes resources available
+ * to the portlet. Using the context, a portlet can access
+ * the portlet log, and obtain URL references to resources.
+ *
+ * <p>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 <code>/catalog</code>.
+ * They are possibly installed via a <code>.war</code> 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.
+ * <p>
+ * Attributes stored in the context are global for <I>all</I> users and <I>all</I>
+ * components in the portlet application.
+ * <p>
+ * 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.
+ *
+ * <P>
+ * The form of the returned string is <code>containername/versionnumber</code>.
+ *
+ *
+ * @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 <code>PortletRequestDispatcher</code> object can be used include the
+ * resource in a response. The resource can be dynamic or static.
+ *
+ * <p>The pathname must begin with a slash (<code> / </code>) and is interpreted as relative
+ * to the current context root.
+ *
+ * <p>This method returns <code>null</code> if the <code>PortletContext</code>
+ * cannot return a <code>PortletRequestDispatcher</code>
+ * for any reason.
+ *
+ *
+ * @param path a <code>String</code> specifying the pathname
+ * to the resource
+ * @return a <code>PortletRequestDispatcher</code> 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.
+ *
+ * <p>Servlets (and also JSP pages) may be given names via server
+ * administration or via a web application deployment descriptor.
+ *
+ * <p>This method returns <code>null</code> if the
+ * <code>PortletContext</code> cannot return a
+ * <code>PortletRequestDispatcher</code> for any reason.
+ *
+ *
+ * @param name a <code>String</code> specifying the name
+ * of a servlet to be wrapped
+ *
+ * @return a <code>PortletRequestDispatcher</code> 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.
+ * <p>
+ * In order to access protected resources the path has to be prefixed with
+ * <code>/WEB-INF/</code> (for example <code>/WEB-INF/myportlet/myportlet.jsp</code>).
+ * Otherwise, the direct path is used
+ * (for example <code>/myportlet/myportlet.jsp</code>).
+ *
+ * @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 <code>null</code> 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 <code>text/html</code> and <code>image/gif</code>.
+ *
+ *
+ * @param file a <code>String</code> specifying the name
+ * of a file
+ *
+ * @return a <code>String</code> specifying the MIME type of the file
+ *
+ */
+
+ public String getMimeType(String file);
+
+
+ /**
+ * Returns a <code>String</code> containing the real path
+ * for a given virtual path. For example, the path <code>/index.html</code>
+ * returns the absolute file path of the portlet container file system.
+ *
+ * <p>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 <code>null</code>
+ * 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 <code>.war</code> archive).
+ *
+ * @param path a <code>String</code> specifying a virtual path
+ *
+ * @return a <code>String</code> 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 (<code>/</code>). 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<br><br>
+ * <code>
+ * /welcome.html<br>
+ * /catalog/index.html<br>
+ * /catalog/products.html<br>
+ * /catalog/offers/books.html<br>
+ * /catalog/offers/music.html<br>
+ * /customer/login.jsp<br>
+ * /WEB-INF/web.xml<br>
+ * /WEB-INF/classes/com.acme.OrderPortlet.class,<br><br>
+ * </code>
+ *
+ * <code>getResourcePaths("/")</code> returns
+ * <code>{"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}</code><br>
+ * <code>getResourcePaths("/catalog/")</code> returns
+ * <code>{"/catalog/index.html", "/catalog/products.html", "/catalog/offers/"}</code>.<br>
+ *
+ * @param path
+ * the partial path used to match the resources, which must start with a slash
+ * @return a Set containing the directory listing, or <code>null</code> if there
+ * are no resources in the web application of which the path
+ * begins with the supplied path.
+ */
+
+ public java.util.Set<String> getResourcePaths(String path);
+
+
+
+ /**
+ * Returns a URL to the resource that is mapped to a specified
+ * path. The path must begin with a slash (<code>/</code>) and is interpreted
+ * as relative to the current context root.
+ *
+ * <p>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 <code>.war</code> file.
+ *
+ * <p>The portlet container must implement the URL handlers
+ * and <code>URLConnection</code> objects that are necessary
+ * to access the resource.
+ *
+ * <p>This method returns <code>null</code>
+ * if no resource is mapped to the pathname.
+ *
+ * <p>Some containers may allow writing to the URL returned by
+ * this method using the methods of the URL class.
+ *
+ * <p>The resource content is returned directly, so be aware that
+ * requesting a <code>.jsp</code> page returns the JSP source code.
+ * Use a <code>RequestDispatcher</code> instead to include results of
+ * an execution.
+ *
+ * <p>This method has a different purpose than
+ * <code>java.lang.Class.getResource</code>,
+ * which looks up resources based on a class loader. This
+ * method does not use class loaders.
+ *
+ * @param path a <code>String</code> specifying
+ * the path to the resource
+ *
+ * @return the resource located at the named path,
+ * or <code>null</code> 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
+ * <code>getAttributeNames</code>.
+ *
+ * <p>The attribute is returned as a <code>java.lang.Object</code>
+ * or some subclass.
+ * Attribute names should follow the same convention as package
+ * names. The Java Portlet API specification reserves names
+ * matching <code>java.*</code>, <code>javax.*</code>,
+ * and <code>sun.*</code>.
+ *
+ *
+ * @param name a <code>String</code> specifying the name
+ * of the attribute
+ *
+ * @return an <code>Object</code> containing the value
+ * of the attribute, or <code>null</code>
+ * if no attribute exists matching the given
+ * name
+ *
+ * @see #getAttributeNames
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if name is <code>null</code>.
+ */
+
+ public java.lang.Object getAttribute(java.lang.String name);
+
+
+ /**
+ * Returns an <code>Enumeration</code> containing the attribute names
+ * available within this portlet context, or an empty
+ * <code>Enumeration</code> if no attributes are available. Use the
+ * {@link #getAttribute} method with an attribute name
+ * to get the value of an attribute.
+ *
+ * @return an <code>Enumeration</code> of attribute names
+ *
+ * @see #getAttribute
+ */
+
+ public java.util.Enumeration<String> getAttributeNames();
+
+
+ /**
+ * Returns a String containing the value of the named context-wide
+ * initialization parameter, or <code>null</code> if the parameter does not exist.
+ * This method provides configuration information which may be useful for
+ * an entire "portlet application".
+ *
+ * @param name a <code>String</code> containing the name of the
+ * requested parameter
+ *
+ * @return a <code>String</code> containing the value
+ * of the initialization parameter, or
+ * <code>null</code> if the parameter does not exist.
+ *
+ * @see #getInitParameterNames
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if name is <code>null</code>.
+ */
+
+ public java.lang.String getInitParameter(java.lang.String name);
+
+
+ /**
+ * Returns the names of the context initialization parameters as an
+ * <code>Enumeration</code> of String objects, or an empty Enumeration if the context
+ * has no initialization parameters.
+ *
+ * @return an <code>Enumeration</code> of <code>String</code>
+ * objects containing the names of the context
+ * initialization parameters
+ *
+ * @see #getInitParameter
+ */
+
+ public java.util.Enumeration<String> getInitParameterNames();
+
+
+ /**
+ * Writes the specified message to a portlet log file, usually an event log.
+ * The name and type of the portlet log file is specific to the portlet container.
+ * <p>
+ * This method mapps to the <code>ServletContext.log</code> method.
+ * The portlet container may in addition log this message in a
+ * portlet container specific log file.
+ *
+ * @param msg a <code>String</code> 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.
+ * <p>
+ * This method is mapped to the <code>ServletContext.log</code> method.
+ * The portlet container may in addition log this message in a
+ * portlet container specific log file.
+ *
+ * @param message a <code>String</code> that
+ * describes the error or exception
+ * @param throwable the <code>Throwable</code> 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 <code>null</code>.
+ *
+ * @param name a <code>String</code> specifying the name
+ * of the attribute to be removed
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if name is <code>null</code>.
+ */
+
+ 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.
+ * <p>
+ * If a null value is passed, the effect is the same as calling
+ * <code>removeAttribute()</code>.
+ *
+ * <p>Attribute names should follow the same convention as package
+ * names. The Java Portlet API specification reserves names
+ * matching <code>java.*</code>, <code>javax.*</code>, and
+ * <code>sun.*</code>.
+ *
+ * @param name a <code>String</code> specifying the name
+ * of the attribute
+ * @param object an <code>Object</code> representing the
+ * attribute to be bound
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if name is <code>null</code>.
+ */
+
+ 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 <code>web.xml</code> deployment descriptor for this web application by the
+ * <code>display-name</code> 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.Enumeration<String> getContainerRuntimeOptions();
+}