You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2005/07/29 18:43:41 UTC
svn commit: r226395 [4/14] - in /portals/pluto/branches/pluto-1.1: ./
binding/ binding/src/java/org/apache/pluto/binding/
binding/src/java/org/apache/pluto/binding/impl/digester/
binding/src/java/org/apache/pluto/binding/util/ binding/src/resources/org...
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletURLImpl.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletURLImpl.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletURLImpl.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletURLImpl.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.core.impl;
+
+import java.util.*;
+
+import javax.portlet.PortalContext;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+
+import org.apache.pluto.PortletContainer;
+import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.pluto.descriptors.portlet.SupportsDD;
+import org.apache.pluto.core.InternalPortletWindow;
+import org.apache.pluto.services.PortletURLProvider;
+import org.apache.pluto.util.StringManager;
+import org.apache.pluto.util.StringUtils;
+
+public class PortletURLImpl implements PortletURL {
+
+ private static final StringManager EXCEPTIONS =
+ StringManager.getManager(PortletURLImpl.class.getPackage().getName());
+
+
+ private PortletContainer container;
+ protected PortletMode mode = null;
+
+ protected Map parameters = new HashMap();
+
+ protected InternalPortletWindow internalPortletWindow;
+
+ protected boolean secure;
+ protected javax.servlet.http.HttpServletRequest servletRequest;
+ protected javax.servlet.http.HttpServletResponse servletResponse;
+ protected WindowState state;
+ protected boolean isAction;
+
+ private PortalContext context;
+
+ public PortletURLImpl(PortletContainer container,
+ InternalPortletWindow internalPortletWindow,
+ javax.servlet.http.HttpServletRequest servletRequest,
+ javax.servlet.http.HttpServletResponse servletResponse,
+ boolean isAction) {
+ this.container = container;
+ this.internalPortletWindow = internalPortletWindow;
+ this.servletRequest = servletRequest;
+ this.servletResponse = servletResponse;
+ secure = servletRequest.isSecure();
+ this.isAction = isAction;
+ this.context = container.getContainerServices().getPortalContext();
+ }
+
+ // javax.portlet.PortletURL -------------------------------------------------------------------
+ public void setWindowState(WindowState windowState)
+ throws WindowStateException {
+ if (windowState != null && isWindowStateAllowed(windowState)) {
+ state = windowState;
+ return;
+ }
+
+ throw new WindowStateException(
+ "unsupported Window State used: " + windowState, windowState);
+ }
+
+ public void setPortletMode(PortletMode portletMode)
+ throws PortletModeException {
+ // Test and throw exception if not allowed.
+ isPortletModeAllowed(portletMode);
+ mode = portletMode;
+ }
+
+ public void setParameter(String name, String value) {
+ if (name == null || value == null) {
+ throw new IllegalArgumentException(
+ "name and value must not be null");
+ }
+
+ parameters.put(name, new String[]{value});
+ }
+
+ public void setParameter(String name, String[] values) {
+ if (name == null || values == null || values.length == 0) {
+ throw new IllegalArgumentException(
+ "name and values must not be null or values be an empty array");
+ }
+
+ parameters.put(name, StringUtils.copy(values));
+ }
+
+ /* (non-Javadoc)
+ * @see javax.portlet.PortletURL#setParameters(Map)
+ */
+ public void setParameters(Map parameters) {
+ if (parameters == null) {
+ throw new IllegalArgumentException("Parameters must not be null.");
+ }
+ for (Iterator iter = parameters.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ if (!(entry.getKey() instanceof String)) {
+ throw new IllegalArgumentException(
+ "Key must not be null and of type java.lang.String.");
+ }
+ if (!(entry.getValue() instanceof String[])) {
+ throw new IllegalArgumentException(
+ "Value must not be null and of type java.lang.String[].");
+ }
+ }
+
+ this.parameters = StringUtils.copyParameters(parameters);
+ }
+
+ public void setSecure(boolean secure) throws PortletSecurityException {
+ this.secure = secure;
+ }
+
+ public String toString() {
+ StringBuffer url = new StringBuffer(200);
+
+ PortletURLProvider urlProvider = container.getContainerServices()
+ .getDynamicInformationProvider(servletRequest)
+ .getPortletURLProvider(internalPortletWindow);
+
+ if (mode != null) {
+ urlProvider.setPortletMode(mode);
+ }
+ if (state != null) {
+ urlProvider.setWindowState(state);
+ }
+ if (isAction) {
+ urlProvider.setAction(true);
+ }
+ if (secure) {
+ urlProvider.setSecure();
+ }
+ urlProvider.clearParameters();
+ urlProvider.setParameters(parameters);
+
+ url.append(urlProvider.toString());
+
+ return url.toString();
+ }
+ // --------------------------------------------------------------------------------------------
+
+
+ // additional methods -------------------------------------------------------------------------
+ public String getParameter(String name) {
+ return (String) parameters.get(name);
+ }
+
+ public String[] getParameters(String name) {
+ return (String[]) parameters.get(name);
+ }
+
+ public PortletMode getPortletMode() {
+ return mode;
+ }
+
+ public WindowState getWindowState() {
+ return state;
+ }
+ // --------------------------------------------------------------------------------------------
+
+
+ private boolean isPortletModeAllowed(PortletMode mode)
+ throws PortletModeException {
+ if (mode == null) {
+ throw new PortletModeException(
+ EXCEPTIONS.getString("javax.portlet.PortletModeException.null"),
+ null);
+ }
+
+ return isPortletModeAllowedByPortlet(mode)
+ && isPortletModeAllowedByPortal(mode);
+ }
+
+ private boolean isPortletModeAllowedByPortlet(PortletMode mode)
+ throws PortletModeException {
+ // PLT 8.1: View Portlet Mode should always be
+ // supported by a portlet, even if not defined in the descriptor
+ if (mode.equals(PortletMode.VIEW)) {
+ return true;
+ }
+
+ PortletDD dd = internalPortletWindow.getPortletEntity()
+ .getPortletDefinition();
+ Iterator supports = dd.getSupports().iterator();
+ while(supports.hasNext()) {
+ SupportsDD support = (SupportsDD)supports.next();
+ Iterator modes = support.getPortletModes().iterator();
+ while(modes.hasNext()) {
+ String md = (String)modes.next();
+ if (md.toUpperCase().equals(
+ mode.toString().toUpperCase())) {
+ return true;
+ }
+ }
+ }
+ String message = EXCEPTIONS.getString(
+ "javax.portlet.PortletModeException.portlet", mode.toString());
+
+ throw new PortletModeException(message, mode);
+ }
+
+ private boolean isPortletModeAllowedByPortal(PortletMode mode)
+ throws PortletModeException {
+ Enumeration supportedModes = context.getSupportedPortletModes();
+ while (supportedModes.hasMoreElements()) {
+ if (supportedModes.nextElement().toString().toUpperCase().equals(
+ (mode.toString().toUpperCase()))) {
+ return true;
+ }
+ }
+ String message = EXCEPTIONS.getString(
+ "javax.portlet.PortletModeException.portal", mode.toString());
+
+ throw new PortletModeException(message, mode);
+ }
+
+ private boolean isWindowStateAllowed(WindowState state) {
+ Enumeration supportedStates = context.getSupportedWindowStates();
+ while (supportedStates.hasMoreElements()) {
+ if (supportedStates.nextElement().toString().toUpperCase().equals(
+ (state.toString().toUpperCase()))) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/RenderRequestImpl.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/RenderRequestImpl.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/RenderRequestImpl.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/RenderRequestImpl.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.core.impl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.util.Enumeration;
+
+import javax.portlet.PortletPreferences;
+import javax.portlet.RenderRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.Constants;
+import org.apache.pluto.PortletContainer;
+import org.apache.pluto.core.InternalPortletWindow;
+
+/**
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates. To enable and disable the creation of type
+ * comments go to Window>Preferences>Java>Code Generation.
+ */
+public class RenderRequestImpl extends PortletRequestImpl
+ implements RenderRequest {
+ private static final Log LOG = LogFactory.getLog(RenderRequestImpl.class);
+ /**
+ * Holds the portlet preferences
+ */
+ private PortletPreferences portletPreferences = null;
+
+ public RenderRequestImpl(PortletContainer container,
+ InternalPortletWindow internalPortletWindow,
+ javax.servlet.http.HttpServletRequest servletRequest) {
+ super(container, internalPortletWindow, servletRequest);
+ }
+
+ // additional methods -------------------------------------------------------------------------
+ /**
+ * @see javax.servlet.ServletRequest#getReader()
+ */
+ public BufferedReader getReader() throws IOException {
+ return super.getReader();
+ }
+
+ public PortletPreferences getPreferences() {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Getting Preferences: " + portletPreferences);
+ }
+
+ if (portletPreferences == null) {
+ portletPreferences = new PortletPreferencesImpl(getContainer(),
+ getWindow(), this,
+ Constants.METHOD_ACTION);
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Returning Preferences: " + portletPreferences);
+ Enumeration e = portletPreferences.getNames();
+ while (e.hasMoreElements()) {
+ String name = (String) e.nextElement();
+ LOG.debug(" - Preference: name = " + name);
+ }
+ }
+
+ return portletPreferences;
+ }
+ // --------------------------------------------------------------------------------------------
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/RenderResponseImpl.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/RenderResponseImpl.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/RenderResponseImpl.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/RenderResponseImpl.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.core.impl;
+
+import org.apache.pluto.PortletContainer;
+import org.apache.pluto.core.InternalPortletWindow;
+import org.apache.pluto.core.PortletEntity;
+import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.pluto.descriptors.portlet.SupportsDD;
+import org.apache.pluto.services.PortalCallbackProvider;
+import org.apache.pluto.util.NamespaceMapper;
+import org.apache.pluto.util.StringManager;
+import org.apache.pluto.util.StringUtils;
+import org.apache.pluto.util.impl.NamespaceMapperImpl;
+
+import javax.portlet.PortletURL;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.List;
+
+public class RenderResponseImpl extends PortletResponseImpl
+ implements RenderResponse {
+
+ private static final StringManager EXCEPTIONS =
+ StringManager.getManager(RenderResponseImpl.class.getPackage().getName());
+
+ /**
+ * The current content type.
+ * @todo This should be made dynamic
+ */
+ private String currentContentType = null;
+
+ private NamespaceMapper mapper = new NamespaceMapperImpl();
+
+ public RenderResponseImpl(PortletContainer container,
+ InternalPortletWindow internalPortletWindow,
+ javax.servlet.http.HttpServletRequest servletRequest,
+ javax.servlet.http.HttpServletResponse servletResponse) {
+ super(container, internalPortletWindow, servletRequest,
+ servletResponse);
+ }
+
+ public String getContentType() {
+ // in servlet 2.4 we could simply use this:
+ // return this._getHttpServletResponse().getContentType();
+ return currentContentType;
+ }
+
+ public PortletURL createRenderURL() {
+ PortletURL url = createURL(false);
+ return url;
+ }
+
+ public PortletURL createActionURL() {
+ PortletURL url = createURL(true);
+ return url;
+ }
+
+ public String getNamespace() {
+ return mapper.encode(getInternalPortletWindow().getId(), "");
+ }
+
+ public void setTitle(String title) {
+ PortalCallbackProvider callback =
+ container.getContainerServices().getPortalCallbackProvider();
+
+ callback.setTitle(this.getHttpServletRequest(),
+ getInternalPortletWindow(),
+ title);
+ }
+
+ public void setContentType(String type) {
+ String mimeType = StringUtils.stringCharacterEncoding(type);
+ if (!isValidContentType(mimeType)) {
+ throw new IllegalArgumentException(mimeType);
+ }
+ this._getHttpServletResponse().setContentType(mimeType);
+ currentContentType = mimeType;
+ }
+
+ public String getCharacterEncoding() {
+ return this._getHttpServletResponse().getCharacterEncoding();
+ }
+
+ /**
+ * @todo is it appropriate to throw an illegal state if content type is not set. how do we set automatically
+ */
+ public PrintWriter getWriter() throws IOException, IllegalStateException {
+ if (currentContentType == null) {
+ String msg = EXCEPTIONS.getString("error.contenttype.null");
+ //throw new java.lang.IllegalStateException(msg);
+ }
+
+ return super.getWriter();
+ }
+
+ public java.util.Locale getLocale() {
+ return this.getHttpServletRequest().getLocale();
+ }
+
+ //@todo port 1.0.1 setBufferSize fix to 1.1
+ public void setBufferSize(int size) {
+ throw new IllegalStateException(
+ "portlet container does not support buffering");
+ }
+
+ public int getBufferSize() {
+ //return this._getHttpServletResponse().getBufferSize();
+ return 0;
+ }
+
+ public void flushBuffer() throws java.io.IOException {
+ this._getHttpServletResponse().flushBuffer();
+ }
+
+ public void resetBuffer() {
+ this._getHttpServletResponse().resetBuffer();
+ }
+
+ public boolean isCommitted() {
+ return this._getHttpServletResponse().isCommitted();
+ }
+
+ public void reset() {
+ this._getHttpServletResponse().reset();
+ }
+
+ /**
+ * @todo is it appropriate to throw an illegal state if content type is not set. how do we set automatically
+ * @return
+ * @throws java.io.IOException
+ * @throws java.lang.IllegalStateException
+ */
+ public OutputStream getPortletOutputStream() throws java.io.IOException,
+ java.lang.IllegalStateException {
+ if (currentContentType == null) {
+ String msg = EXCEPTIONS.getString("error.contenttype.null");
+
+ //throw new java.lang.IllegalStateException(msg);
+ }
+ return getOutputStream();
+ }
+ // --------------------------------------------------------------------------------------------
+
+ // internal methods ---------------------------------------------------------------------------
+ /**
+ * @param isAction
+ * @return
+ * @todo make dynamic? as service?
+ */
+ private PortletURL createURL(boolean isAction) {
+ return new PortletURLImpl(container,
+ getInternalPortletWindow(),
+ getHttpServletRequest(),
+ _getHttpServletResponse(),
+ isAction);
+
+ }
+
+ private boolean isValidContentType(String type)
+ {
+ type = StringUtils.stringCharacterEncoding(type);
+ PortletEntity entity = getInternalPortletWindow().getPortletEntity();
+ PortletDD def = entity.getPortletDefinition();
+ List contentTypes = def.getSupports();
+ Iterator it = contentTypes.iterator();
+ while(it.hasNext()) {
+ SupportsDD ct = (SupportsDD)it.next();
+ String supportedType = ct.getMimeType();
+ if (supportedType.equals(type)) {
+ return true;
+ } else if (supportedType.indexOf("*") >= 0) {
+ // the supported type contains a wildcard
+ int index = supportedType.indexOf("/");
+ String supportedPrefix = supportedType.substring(0, index);
+ String supportedSuffix = supportedType.substring(index + 1, supportedType.length());
+
+ index = type.indexOf("/");
+ String typePrefix = type.substring(0, index);
+ String typeSuffix = type.substring(index + 1, type.length());
+
+ if (supportedPrefix.equals("*") || supportedPrefix.equals(typePrefix)) {
+ // the prefixes match
+ if (supportedSuffix.equals("*") || supportedSuffix.equals(typeSuffix)) {
+ // the suffixes match
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/ResourceBundleFactory.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/ResourceBundleFactory.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/ResourceBundleFactory.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/ResourceBundleFactory.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.pluto.core.impl;
+
+import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.pluto.descriptors.portlet.PortletInfoDD;
+
+import java.util.*;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+class ResourceBundleFactory {
+
+ private static final ResourceBundle EMPTY_BUNDLE =
+ new ListResourceBundle() {
+ private String[][] contents = new String[][] {};
+ public Object[][] getContents() {
+ return contents;
+ }
+ };
+
+ private ResourceBundle defaultBundle;
+ private Map bundles = new java.util.HashMap();
+ private String bundleName;
+
+ public ResourceBundleFactory(PortletDD dd) {
+ PortletInfoDD info = dd.getPortletInfo();
+ if(info != null) {
+ final String[] title = new String[]{"javax.portlet.title",
+ info.getTitle()};
+ final String[] shrtt = new String[]{"javax.portlet.short-title",
+ info.getShortTitle()};
+ final String[] keys = new String[]{"javax.portlet.keywords",
+ info.getKeywords()};
+ defaultBundle = new ListResourceBundle() {
+ Object[][] contents = new String[][]{title, shrtt, keys};
+ public Object[][] getContents() {
+ return contents;
+ }
+ };
+ }
+ else {
+ defaultBundle = EMPTY_BUNDLE;
+ }
+
+ bundleName = dd.getResourceBundle();
+ }
+
+ public ResourceBundle getResourceBundle(Locale locale) {
+ if (bundles.containsKey(locale)) {
+ return (ResourceBundle) bundles.get(locale);
+ }
+
+ try {
+ if (bundleName != null) {
+ ClassLoader loader = Thread.currentThread()
+ .getContextClassLoader();
+ ResourceBundle bundle = ResourceBundle.getBundle(bundleName,
+ locale,
+ loader);
+ if (bundle != null) {
+ bundles.put(locale, bundle);
+ return bundle;
+ }
+ }
+ } catch (MissingResourceException mre) {
+ // intentionally swallow. Allow the default Bundle.
+ }
+
+ bundles.put(locale, defaultBundle);
+ return defaultBundle;
+ }
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/om/ObjectID.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/om/ObjectID.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/om/ObjectID.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/om/ObjectID.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.om;
+
+
+/**
+ * * Wraps around the Object IDs.
+ */
+
+public interface ObjectID {
+
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/package.html
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/package.html?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/package.html (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/package.html Fri Jul 29 09:40:51 2005
@@ -0,0 +1,42 @@
+<HTML>
+<HEAD><TITLE>Apache Pluto</TITLE></HEAD>
+<BODY>
+<P>The root package of the Pluto Portlet Container.</P>
+
+<P>Portals embedding Pluto must implement the
+ {@link org.apache.pluto.services.PortletContainerServices}
+ interfac and then retrieve an instance of the container from
+ the {@link org.apache.pluto.PortletContainerFactory}.</P>
+<H3>Initialization of the container</H3>
+<P>
+<xmp>
+PortletContainerServices services = // your implementation!
+PortletContainer container =
+ PortletContainerFactory.createContainer("MyContainer", services);
+
+ServletContext context = // the servlet context within which the portal is executing
+container.init(servletContext);
+</xmp>
+</P>
+
+<H3>Processing of Requests</H3>
+<P>
+<xmp>
+if(isActionRequest) {
+ container.doAction(request, response);
+}
+else if(isRenderRequest) {
+ container.doRender(request, response);
+}
+</xmp>
+</P>
+
+<H3>Shutting Down the Container</H3>
+<P>
+<xmp>
+container.destroy();
+</xmp>
+</P>
+
+</BODY>
+</HTML>
\ No newline at end of file
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/ActionRequestWrapper.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/ActionRequestWrapper.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/ActionRequestWrapper.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/ActionRequestWrapper.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.portlet;
+
+import javax.portlet.ActionRequest;
+
+public class ActionRequestWrapper extends PortletRequestWrapper
+ implements ActionRequest {
+
+ /**
+ * Creates a ServletRequest adaptor wrapping the given request object.
+ * @throws java.lang.IllegalArgumentException
+ * if the request is null.
+ */
+ public ActionRequestWrapper(ActionRequest actionRequest) {
+ super(actionRequest);
+
+ if (actionRequest == null) {
+ throw new IllegalArgumentException("Request cannot be null");
+ }
+ }
+
+ // javax.portlet.ActionRequest implementation -------------------------------------------------
+ public java.io.InputStream getPortletInputStream()
+ throws java.io.IOException {
+ return this.getActionRequest().getPortletInputStream();
+ }
+
+ public void setCharacterEncoding(String enc)
+ throws java.io.UnsupportedEncodingException {
+ this.getActionRequest().setCharacterEncoding(enc);
+ }
+
+ public java.io.BufferedReader getReader()
+ throws java.io.UnsupportedEncodingException, java.io.IOException {
+ return this.getActionRequest().getReader();
+ }
+
+ public java.lang.String getCharacterEncoding() {
+ return this.getActionRequest().getCharacterEncoding();
+ }
+
+ public java.lang.String getContentType() {
+ return this.getActionRequest().getContentType();
+ }
+
+ public int getContentLength() {
+ return this.getActionRequest().getContentLength();
+ }
+
+ // --------------------------------------------------------------------------------------------
+
+ // additional methods -------------------------------------------------------------------------
+ /**
+ * Return the wrapped ServletRequest object.
+ */
+ public ActionRequest getActionRequest() {
+ return (ActionRequest) getPortletRequest();
+ }
+
+ // --------------------------------------------------------------------------------------------
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/ActionResponseWrapper.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/ActionResponseWrapper.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/ActionResponseWrapper.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/ActionResponseWrapper.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.portlet;
+
+import java.util.Map;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+
+public class ActionResponseWrapper extends PortletResponseWrapper
+ implements ActionResponse {
+
+ /**
+ * Creates a ServletResponse adaptor wrapping the given response object.
+ * @throws java.lang.IllegalArgumentException
+ * if the response is null.
+ */
+ public ActionResponseWrapper(ActionResponse actionResponse) {
+ super(actionResponse);
+
+ if (actionResponse == null) {
+ throw new IllegalArgumentException("Response cannot be null");
+ }
+ }
+
+ // javax.portlet.ActionResponse implementation ------------------------------------------------
+ public void setWindowState(WindowState windowState)
+ throws WindowStateException {
+ this.getActionResponse().setWindowState(windowState);
+ }
+
+ public void setPortletMode(PortletMode portletMode)
+ throws PortletModeException {
+ this.getActionResponse().setPortletMode(portletMode);
+ }
+
+ public void sendRedirect(String location) throws java.io.IOException {
+ this.getActionResponse().sendRedirect(location);
+ }
+
+ public void setRenderParameters(Map parameters) {
+ this.getActionResponse().setRenderParameters(parameters);
+ }
+
+ public void setRenderParameter(String key, String value) {
+ this.getActionResponse().setRenderParameter(key, value);
+ }
+
+ public void setRenderParameter(String key, String[] values) {
+ this.getActionResponse().setRenderParameter(key, values);
+ }
+
+ // --------------------------------------------------------------------------------------------
+
+ // additional methods -------------------------------------------------------------------------
+ /**
+ * Return the wrapped ServletResponse object.
+ */
+ public ActionResponse getActionResponse() {
+ return (ActionResponse) getPortletResponse();
+ }
+
+ // --------------------------------------------------------------------------------------------
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/PortletRequestWrapper.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/PortletRequestWrapper.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/PortletRequestWrapper.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/PortletRequestWrapper.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.portlet;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortalContext;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+import javax.portlet.WindowState;
+
+public class PortletRequestWrapper
+ extends javax.servlet.http.HttpServletRequestWrapper
+ implements PortletRequest {
+
+ /**
+ * Creates a ServletRequest adaptor wrapping the given request object.
+ * @throws java.lang.IllegalArgumentException
+ * if the request is null.
+ */
+ public PortletRequestWrapper(PortletRequest portletRequest) {
+ super((javax.servlet.http.HttpServletRequest) portletRequest);
+
+ if (portletRequest == null) {
+ throw new IllegalArgumentException("Request cannot be null");
+ }
+ }
+
+ // javax.portlet.PortletRequest implementation -------------------------------------------------
+ public boolean isWindowStateAllowed(WindowState state) {
+ return this.getPortletRequest().isWindowStateAllowed(state);
+ }
+
+ public boolean isPortletModeAllowed(PortletMode mode) {
+ return this.getPortletRequest().isPortletModeAllowed(mode);
+ }
+
+ public PortletMode getPortletMode() {
+ return this.getPortletRequest().getPortletMode();
+ }
+
+ public WindowState getWindowState() {
+ return this.getPortletRequest().getWindowState();
+ }
+
+ public PortletPreferences getPreferences() {
+ return this.getPortletRequest().getPreferences();
+ }
+
+ public PortletSession getPortletSession() {
+ return this.getPortletRequest().getPortletSession();
+ }
+
+ public PortletSession getPortletSession(boolean create) {
+ return this.getPortletRequest().getPortletSession(create);
+ }
+
+ public String getProperty(String name) {
+ return this.getPortletRequest().getProperty(name);
+ }
+
+ public Enumeration getProperties(String name) {
+ return this.getPortletRequest().getProperties(name);
+ }
+
+ public Enumeration getPropertyNames() {
+ return this.getPortletRequest().getPropertyNames();
+ }
+
+ public PortalContext getPortalContext() {
+ return this.getPortletRequest().getPortalContext();
+ }
+
+ public java.lang.String getAuthType() {
+ return this.getPortletRequest().getAuthType();
+ }
+
+ public String getContextPath() {
+ return this.getPortletRequest().getContextPath();
+ }
+
+ public java.lang.String getRemoteUser() {
+ return this.getPortletRequest().getRemoteUser();
+ }
+
+ public java.security.Principal getUserPrincipal() {
+ return this.getPortletRequest().getUserPrincipal();
+ }
+
+ public boolean isUserInRole(java.lang.String role) {
+ return this.getPortletRequest().isUserInRole(role);
+ }
+
+ public Object getAttribute(String name) {
+ return this.getPortletRequest().getAttribute(name);
+ }
+
+ public java.util.Enumeration getAttributeNames() {
+ return this.getPortletRequest().getAttributeNames();
+ }
+
+ public String getParameter(String name) {
+ return this.getPortletRequest().getParameter(name);
+ }
+
+ public java.util.Enumeration getParameterNames() {
+ return this.getPortletRequest().getParameterNames();
+ }
+
+ public String[] getParameterValues(String name) {
+ return this.getPortletRequest().getParameterValues(name);
+ }
+
+ public java.util.Map getParameterMap() {
+ return this.getPortletRequest().getParameterMap();
+ }
+
+ public boolean isSecure() {
+ return this.getPortletRequest().isSecure();
+ }
+
+ public void setAttribute(String name, Object o) {
+ this.getPortletRequest().setAttribute(name, o);
+ }
+
+ public void removeAttribute(String name) {
+ this.getPortletRequest().removeAttribute(name);
+ }
+
+ public String getRequestedSessionId() {
+ return this.getPortletRequest().getRequestedSessionId();
+ }
+
+ public boolean isRequestedSessionIdValid() {
+ return this.getPortletRequest().isRequestedSessionIdValid();
+ }
+
+ public String getResponseContentType() {
+ return this.getPortletRequest().getResponseContentType();
+ }
+
+ public java.util.Enumeration getResponseContentTypes() {
+ return this.getPortletRequest().getResponseContentTypes();
+ }
+
+ public java.util.Locale getLocale() {
+ return this.getPortletRequest().getLocale();
+ }
+
+ public java.util.Enumeration getLocales() {
+ return this.getPortletRequest().getLocales();
+ }
+
+ public String getScheme() {
+ return this.getPortletRequest().getScheme();
+ }
+
+ public String getServerName() {
+ return this.getPortletRequest().getServerName();
+ }
+
+ public int getServerPort() {
+ return this.getPortletRequest().getServerPort();
+ }
+
+ // --------------------------------------------------------------------------------------------
+
+ // additional methods -------------------------------------------------------------------------
+ /**
+ * Return the wrapped ServletRequest object.
+ */
+ public PortletRequest getPortletRequest() {
+ return (PortletRequest) super.getRequest();
+ }
+
+ /**
+ * Sets the request being wrapped.
+ * @throws java.lang.IllegalArgumentException
+ * if the request is null.
+ */
+ public void setRequest(PortletRequest request) {
+ if (request == null) {
+ throw new IllegalArgumentException("Request cannot be null");
+ }
+ setRequest((javax.servlet.http.HttpServletRequest) request);
+ }
+ // --------------------------------------------------------------------------------------------
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/PortletResponseWrapper.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/PortletResponseWrapper.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/PortletResponseWrapper.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/PortletResponseWrapper.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.portlet;
+
+import javax.portlet.PortletResponse;
+
+public class PortletResponseWrapper
+ extends javax.servlet.http.HttpServletResponseWrapper
+ implements PortletResponse {
+
+ /**
+ * Creates a ServletResponse adaptor wrapping the given response object.
+ * @throws java.lang.IllegalArgumentException
+ * if the response is null.
+ */
+ public PortletResponseWrapper(PortletResponse portletResponse) {
+ super((javax.servlet.http.HttpServletResponse) portletResponse);
+
+ if (portletResponse == null) {
+ throw new IllegalArgumentException("Response cannot be null");
+ }
+ }
+
+ // javax.portlet.PortletResponse implementation ------------------------------------------------
+ public void addProperty(String key, String value) {
+ this.getPortletResponse().addProperty(key, value);
+ }
+
+ public void setProperty(String key, String value) {
+ this.getPortletResponse().setProperty(key, value);
+ }
+
+ public String encodeURL(String path) {
+ return this.getPortletResponse().encodeURL(path);
+ }
+ // --------------------------------------------------------------------------------------------
+
+ // additional methods -------------------------------------------------------------------------
+ /**
+ * Return the wrapped ServletResponse object.
+ */
+ public PortletResponse getPortletResponse() {
+ return (PortletResponse) super.getResponse();
+ }
+
+ /**
+ * Sets the response being wrapped.
+ * @throws java.lang.IllegalArgumentException
+ * if the response is null.
+ */
+ public void setResponse(PortletResponse response) {
+ if (response == null) {
+ throw new IllegalArgumentException("Response cannot be null");
+ }
+ setResponse((javax.servlet.http.HttpServletResponse) response);
+ }
+ // --------------------------------------------------------------------------------------------
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/RenderRequestWrapper.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/RenderRequestWrapper.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/RenderRequestWrapper.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/RenderRequestWrapper.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.portlet;
+
+import javax.portlet.RenderRequest;
+
+public class RenderRequestWrapper extends PortletRequestWrapper
+ implements RenderRequest {
+
+ /**
+ * Creates a ServletRequest adaptor wrapping the given request object.
+ * @throws java.lang.IllegalArgumentException
+ * if the request is null.
+ */
+ public RenderRequestWrapper(RenderRequest renderRequest) {
+ super(renderRequest);
+
+ if (renderRequest == null) {
+ throw new IllegalArgumentException("Request cannot be null");
+ }
+ }
+
+ // javax.portlet.RenderRequest implementation -------------------------------------------------
+
+ // --------------------------------------------------------------------------------------------
+
+ // additional methods -------------------------------------------------------------------------
+ /**
+ * Return the wrapped ServletRequest object.
+ */
+ public RenderRequest getRenderRequest() {
+ return (RenderRequest) getPortletRequest();
+ }
+
+ // --------------------------------------------------------------------------------------------
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/RenderResponseWrapper.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/RenderResponseWrapper.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/RenderResponseWrapper.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/portlet/RenderResponseWrapper.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.portlet;
+
+import javax.portlet.PortletURL;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+
+public class RenderResponseWrapper extends PortletResponseWrapper
+ implements RenderResponse {
+ /**
+ * Creates a ServletResponse adaptor wrapping the given response object.
+ * @throws java.lang.IllegalArgumentException
+ * if the response is null.
+ */
+ public RenderResponseWrapper(RenderResponse renderResponse) {
+ super(renderResponse);
+
+ if (renderResponse == null) {
+ throw new IllegalArgumentException("Response cannot be null");
+ }
+ }
+
+ // javax.portlet.RenderResponse implementation ------------------------------------------------
+ public String getContentType() {
+ return this.getRenderResponse().getContentType();
+ }
+
+ public PortletURL createRenderURL() {
+ return this.getRenderResponse().createRenderURL();
+ }
+
+ public PortletURL createActionURL() {
+ return this.getRenderResponse().createActionURL();
+ }
+
+ public String getNamespace() {
+ return this.getRenderResponse().getNamespace();
+ }
+
+ public void setTitle(String title) {
+ this.getRenderResponse().setTitle(title);
+ }
+
+ public void setContentType(String type) {
+ this.getRenderResponse().setContentType(type);
+ }
+
+ public String getCharacterEncoding() {
+ return this.getRenderResponse().getCharacterEncoding();
+ }
+
+ public java.io.PrintWriter getWriter() throws java.io.IOException {
+ return this.getRenderResponse().getWriter();
+ }
+
+ public java.util.Locale getLocale() {
+ return this.getRenderResponse().getLocale();
+ }
+
+ public void setBufferSize(int size) {
+ this.getRenderResponse().setBufferSize(size);
+ }
+
+ public int getBufferSize() {
+ return this.getRenderResponse().getBufferSize();
+ }
+
+ public void flushBuffer() throws java.io.IOException {
+ this.getRenderResponse().flushBuffer();
+ }
+
+ public void resetBuffer() {
+ this.getRenderResponse().resetBuffer();
+ }
+
+ public boolean isCommitted() {
+ return this.getRenderResponse().isCommitted();
+ }
+
+ public void reset() {
+ this.getRenderResponse().reset();
+ }
+
+ public OutputStream getPortletOutputStream() throws IOException {
+ return this.getRenderResponse().getPortletOutputStream();
+ }
+ // --------------------------------------------------------------------------------------------
+
+ // additional methods -------------------------------------------------------------------------
+ /**
+ * Return the wrapped ServletResponse object.
+ */
+ public RenderResponse getRenderResponse() {
+ return (RenderResponse) getPortletResponse();
+ }
+ // --------------------------------------------------------------------------------------------
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/ContainerService.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/ContainerService.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/ContainerService.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/ContainerService.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.pluto.services;
+
+/**
+ * Defines a service and needs to be implemented by all
+ * PortletContainerServices
+ */
+public interface ContainerService {
+
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/DynamicInformationProvider.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/DynamicInformationProvider.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/DynamicInformationProvider.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/DynamicInformationProvider.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.services;
+
+import org.apache.pluto.PortletWindow;
+
+/**
+ * Provide information from the portal to portlet container that are request
+ * dependend.
+ */
+public interface DynamicInformationProvider {
+
+ /**
+ * Returns an URL pointing to the given portlet window
+ * @param portletWindow the portlet Window
+ * @return the URL to the given portlet
+ */
+ public PortletURLProvider getPortletURLProvider(
+ PortletWindow portletWindow);
+
+ /**
+ * Returns the ResourceURLProvider to create URLs pointing to a resource in
+ * a web application.
+ * @param portletWindow the portlet Window
+ * @return the URL to a resource
+ */
+ public ResourceURLProvider getResourceURLProvider(
+ PortletWindow portletWindow);
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortalCallbackProvider.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortalCallbackProvider.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortalCallbackProvider.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortalCallbackProvider.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.pluto.services;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.pluto.PortletWindow;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Sep 21, 2004
+ */
+public interface PortalCallbackProvider {
+
+ public void setTitle(HttpServletRequest request,
+ PortletWindow window,
+ String title);
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletContainerServices.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletContainerServices.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletContainerServices.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletContainerServices.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,43 @@
+package org.apache.pluto.services;
+
+import javax.portlet.PortalContext;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Defines the services necessary for integration between the Pluto Container
+ * and a Portal.
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public interface PortletContainerServices {
+
+ /**
+ * Provider used to retrieve request-time services.
+ * @param req
+ * @return a DynamicInformationProvider implementation.
+ */
+ DynamicInformationProvider getDynamicInformationProvider(
+ HttpServletRequest req);
+
+ /**
+ * Return the PortletPreferencesFactory implementation.
+ * @return a PortletPreferencesFactory implementation.
+ */
+ PortletPreferencesFactory getPortletPreferencesFactory();
+
+ /**
+ * Retrieve the PortalContext associated with this group of container
+ * services.
+ * @return a PortalContext implementation.
+ */
+ PortalContext getPortalContext();
+
+ /**
+ * @return a PortalCallbackProvider implementation.
+ */
+ PortalCallbackProvider getPortalCallbackProvider();
+
+ /**
+ * @return a PropertyManagerService implementation.
+ */
+ PropertyManagerService getPropertyManagerService();
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletPreferencesFactory.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletPreferencesFactory.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletPreferencesFactory.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletPreferencesFactory.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.services;
+
+import javax.portlet.PortletRequest;
+
+import org.apache.pluto.PortletWindow;
+import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.core.PortletPreference;
+
+public interface PortletPreferencesFactory {
+
+ PortletPreference[] getStoredPreferences(PortletWindow window,
+ PortletRequest req)
+ throws PortletContainerException;
+
+ void store(PortletWindow window,
+ PortletRequest req,
+ PortletPreference[] preferences)
+ throws PortletContainerException;
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletURLProvider.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletURLProvider.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletURLProvider.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PortletURLProvider.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.services;
+
+import java.util.Map;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
+/**
+ * Defines the interface used by the portlet container to create Portal URLs.
+ * This provider must be implemented by the Portal and provided via the
+ * container services upon initialization of the container.
+ */
+public interface PortletURLProvider {
+
+
+ /**
+ * Sets the new portlet mode at the URL. If no mode is set at the URL the
+ * currently active mode is used.
+ * @param mode the new portlet mode
+ */
+ public void setPortletMode(PortletMode mode);
+
+ /**
+ * Sets the new window state at the URL. If no state is set at the URL the
+ * currently active state is used.
+ * @param state the new window state
+ */
+ public void setWindowState(WindowState state);
+
+ /**
+ * Specifies whether or not this request should be considered an action
+ * request. If the value specified is false, a render request will be
+ * assumed.
+ */
+ public void setAction(boolean action);
+
+ /**
+ * By calling this method the URL is defined as a secure URL.
+ */
+ public void setSecure();
+
+ /**
+ * Removes all pre-existing parameters in this URL
+ */
+ public void clearParameters();
+
+ /**
+ * Sets the given parameters as parameters into the URL, Removes all
+ * previously set parameters.
+ * @param parameters a map containing the name [java.lang.String] and value
+ * [java.lang.String[]] of the parameters.
+ */
+ public void setParameters(Map parameters);
+
+
+ /**
+ * Returns the URL in string format. This method should only be called
+ * once.
+ * @return the URL
+ */
+ public String toString();
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PropertyManagerService.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PropertyManagerService.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PropertyManagerService.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/PropertyManagerService.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.pluto.services;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.pluto.PortletWindow;
+
+/**
+ * The <code>PropertyManagerService</code> interface is a container service
+ * providing the portlet container with external defined properties. This
+ * interface allows to associate properties with the portlet request and portlet
+ * response. <br> This service represents an abstract layer to make the property
+ * management independent of the portlet container and to allow diverse special
+ * implementations.
+ * <p/>
+ * <p>This SPI interface can be implemented by the portal.</p>
+ */
+public interface PropertyManagerService extends ContainerService {
+
+ /**
+ * Sets the given property map defined by the portlet window in its
+ * response. <br> The purpose of this method is to provide the portal
+ * framework with a new map of properties set by the portlet. The map can be
+ * empty, but not NULL <br> This method can be called multiple times during
+ * one request by the portlet container
+ * @param window the portlet window of this property
+ * @param request the servlet request
+ * @param response the servlet response
+ * @param properties the String/String array map containing the properties
+ * to be set.
+ */
+ public void setResponseProperties(PortletWindow window,
+ HttpServletRequest request,
+ HttpServletResponse response,
+ Map properties);
+
+ /**
+ * Returns all properties for the given portlet window defined in the portal
+ * as String/String array map. They will be made available to the portlet
+ * through the portlet request. <br> The purpose of this method is to allow
+ * the portal framework to create a map of properties and make it available
+ * to the portlet container. <br> This method can be called multiple times
+ * during one request by the portlet container <br> The return value cannot
+ * be null.
+ * @param window the portlet window of this property
+ * @param request the servlet request
+ * @return a <code>Map</code> containing all properties. If there are no
+ * properties of that name returns an empty <code>Map</code>.
+ */
+ public Map getRequestProperties(PortletWindow window,
+ HttpServletRequest request);
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/ResourceURLProvider.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/ResourceURLProvider.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/ResourceURLProvider.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/services/ResourceURLProvider.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.pluto.services;
+
+public interface ResourceURLProvider {
+
+
+ /**
+ * Sets the absolute URL to be returned by the provider. E.g.
+ * http://host/wps/portal/hello.gif
+ * @param path the new absolute url
+ */
+ public void setAbsoluteURL(String path);
+
+ /**
+ * Sets a full path URI including the context root. E.g.
+ * /wps/portal/hello.gif
+ * @param path the new absolute url
+ */
+ public void setFullPath(String path);
+
+ /**
+ * Returns a url to a resource as absolute URL starting with protocol so
+ * that it can be accessed by a browser.
+ * @return the URL as string
+ */
+ public String toString();
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/ActionURLTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/ActionURLTag.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/ActionURLTag.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/ActionURLTag.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+/*
+ * Created on Feb 21, 2003
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code Template
+ */
+package org.apache.pluto.tags;
+
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+/**
+ * Supporting class for the <CODE>actionURL</CODE> tag. Creates a url that
+ * points to the current Portlet and triggers an action request with the
+ * supplied parameters.
+ */
+public class ActionURLTag extends BasicURLTag {
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.Tag#doStartTag()
+ */
+ public int doStartTag() throws JspException {
+ if (var != null) {
+ pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
+ }
+ RenderResponse renderResponse = (RenderResponse) pageContext.getRequest()
+ .getAttribute("javax.portlet.response");
+
+ if (renderResponse != null) {
+ setUrl(renderResponse.createActionURL());
+ if (portletMode != null) {
+ try {
+ url.setPortletMode(
+ (PortletMode) TEI.portletModes.get(
+ portletMode.toUpperCase()));
+ } catch (PortletModeException e) {
+ throw new JspException(e);
+ }
+ }
+ if (windowState != null) {
+ try {
+ url.setWindowState(
+ (WindowState) TEI.definedWindowStates.get(
+ windowState.toUpperCase()));
+ } catch (WindowStateException e) {
+ throw new JspException(e);
+ }
+ }
+ if (secure != null) {
+ try {
+ url.setSecure(getSecureBoolean());
+ } catch (PortletSecurityException e) {
+ throw new JspException(e);
+ }
+ }
+ }
+ return EVAL_PAGE;
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/BasicURLTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/BasicURLTag.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/BasicURLTag.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/BasicURLTag.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.tags;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+import javax.portlet.PortletMode;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowState;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.tagext.VariableInfo;
+
+/**
+ * Supporting class for the <CODE>actionURL</CODE> and <CODE>renderURL</CODE>
+ * tag. Creates a url that points to the current Portlet and triggers an action
+ * request with the supplied parameters.
+ */
+public abstract class BasicURLTag extends TagSupport {
+
+ public static class TEI extends TagExtraInfo {
+ public final static Hashtable definedWindowStates = getDefinedWindowStates();
+ public final static Hashtable portletModes = getDefinedPortletModes();
+
+ /**
+ * Provides a list of all static PortletMode available in the
+ * specifications by using introspection
+ * @return Hashtable
+ */
+ private static Hashtable getDefinedPortletModes() {
+ Hashtable portletModes = new Hashtable();
+ Field[] f = PortletMode.class.getDeclaredFields();
+
+ for (int i = 0; i < f.length; i++) {
+ if (f[i].getType().isAssignableFrom(
+ javax.portlet.PortletMode.class)) {
+ try {
+ portletModes.put(
+ f[i].get(f[i]).toString().toUpperCase(),
+ f[i].get(f[i]));
+ } catch (IllegalAccessException e) {
+ }
+ }
+ }
+
+ return portletModes;
+ }
+
+ /**
+ * Provides a list of all static WindowsStates available in the
+ * specifications by using introspection
+ * @return Hashtable
+ */
+ private static Hashtable getDefinedWindowStates() {
+ Hashtable definedWindowStates = new Hashtable();
+ Field[] f = WindowState.class.getDeclaredFields();
+
+ for (int i = 0; i < f.length; i++) {
+ if (f[i].getType().isAssignableFrom(
+ javax.portlet.WindowState.class)) {
+ try {
+ definedWindowStates.put(
+ f[i].get(f[i]).toString().toUpperCase(),
+ f[i].get(f[i]));
+ } catch (IllegalAccessException e) {
+
+ }
+ }
+ }
+ return definedWindowStates;
+ }
+
+ public VariableInfo[] getVariableInfo(TagData tagData) {
+ VariableInfo vi[] = null;
+ String var = tagData.getAttributeString("var");
+ if (var != null) {
+ vi = new VariableInfo[1];
+ vi[0] =
+ new VariableInfo(var, "java.lang.String", true,
+ VariableInfo.AT_BEGIN);
+ }
+ return vi;
+ }
+
+ }
+
+ protected String portletMode;
+ protected String secure;
+ protected Boolean secureBoolean;
+ protected String windowState;
+ protected PortletURL url;
+ protected String var;
+
+ /**
+ * Processes the <CODE>actionURL</CODE> or <CODE>renderURL</CODE> tag.
+ * @return int
+ */
+ public abstract int doStartTag() throws JspException;
+
+ /**
+ * @return int
+ */
+ public int doEndTag() throws JspException {
+ if (var == null) {
+ try {
+ JspWriter writer = pageContext.getOut();
+ writer.print(url);
+ writer.flush();
+ } catch (IOException ioe) {
+ throw new JspException(
+ "actionURL/renderURL Tag Exception: cannot write to the output writer.");
+ }
+ } else {
+ pageContext.setAttribute(var, url.toString(),
+ PageContext.PAGE_SCOPE);
+ }
+ return EVAL_PAGE;
+ }
+
+ /**
+ * Returns the portletMode.
+ * @return String
+ */
+ public String getPortletMode() {
+ return portletMode;
+ }
+
+ /**
+ * @return secure as String
+ */
+ public String getSecure() {
+ return secure;
+ }
+
+ /**
+ * @return secure as Boolean
+ */
+ public boolean getSecureBoolean() {
+ return this.secureBoolean.booleanValue();
+ }
+
+ /**
+ * Returns the windowState.
+ * @return String
+ */
+ public String getWindowState() {
+ return windowState;
+ }
+
+ /**
+ * @return PortletURL
+ */
+ public PortletURL getUrl() {
+ return url;
+ }
+
+ /**
+ * Returns the var.
+ * @return String
+ */
+ public String getVar() {
+ return var;
+ }
+
+ /**
+ * Sets the portletMode.
+ * @param portletMode The portletMode to set
+ */
+ public void setPortletMode(String portletMode) {
+ this.portletMode = portletMode;
+ }
+
+ /**
+ * Sets secure to boolean value of the string
+ * @param secure
+ */
+ public void setSecure(String secure) {
+ this.secure = secure;
+ this.secureBoolean = new Boolean(secure);
+ }
+
+ /**
+ * Sets the windowState.
+ * @param windowState The windowState to set
+ */
+ public void setWindowState(String windowState) {
+ this.windowState = windowState;
+ }
+
+ /**
+ * Sets the url.
+ * @param url The url to set
+ */
+ public void setUrl(PortletURL url) {
+ this.url = url;
+ }
+
+ /**
+ * Sets the var.
+ * @param var The var to set
+ */
+ public void setVar(String var) {
+ this.var = var;
+ }
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+/*
+
+ */
+
+package org.apache.pluto.tags;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletRequest;
+import javax.portlet.RenderResponse;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.tagext.VariableInfo;
+
+import org.apache.pluto.Constants;
+
+
+/**
+ * Supporting class for the <CODE>defineObjects</CODE> tag. Creates the
+ * following variables to be used in the JSP: <UL> <LI><CODE>renderRequest</CODE>
+ * <LI><CODE>renderResponse</CODE> <LI><CODE>portletConfig</CODE> </UL>
+ * @see javax.portlet.PortletRequest
+ * @see javax.portlet.RenderResponse
+ * @see javax.portlet.PortletConfig
+ */
+public class DefineObjectsTag extends TagSupport {
+
+ /**
+ * Processes the <CODE>defineObjects</CODE> tag.
+ * @return <CODE>SKIP_BODY</CODE>
+ */
+ public int doStartTag() throws JspException {
+ PortletRequest renderRequest = (PortletRequest) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_REQUEST);
+ RenderResponse renderResponse = (RenderResponse) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_RESPONSE);
+ PortletConfig portletConfig = (PortletConfig) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_CONFIG);
+
+ if (pageContext.getAttribute("renderRequest") == null) //Set attributes only once
+ {
+ pageContext.setAttribute("renderRequest",
+ renderRequest,
+ PageContext.PAGE_SCOPE);
+ }
+
+ if (pageContext.getAttribute("renderResponse") == null) {
+ pageContext.setAttribute("renderResponse",
+ renderResponse,
+ PageContext.PAGE_SCOPE);
+ }
+
+ if (pageContext.getAttribute("portletConfig") == null) {
+ pageContext.setAttribute("portletConfig",
+ portletConfig,
+ PageContext.PAGE_SCOPE);
+ }
+
+ return SKIP_BODY;
+ }
+
+ public static class TEI extends TagExtraInfo {
+
+ public VariableInfo[] getVariableInfo(TagData tagData) {
+ VariableInfo[] info = new VariableInfo[]{
+ new VariableInfo("renderRequest",
+ "javax.portlet.PortletRequest",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("renderResponse",
+ "javax.portlet.RenderResponse",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletConfig",
+ "javax.portlet.PortletConfig",
+ true,
+ VariableInfo.AT_BEGIN)
+ };
+
+ return info;
+ }
+ }
+}