You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ap...@apache.org on 2007/10/31 21:35:03 UTC
svn commit: r590812 [46/48] - in /struts/struts2/trunk: apps/blank/
apps/blank/src/main/java/example/ apps/blank/src/main/resources/
apps/blank/src/main/resources/example/ apps/blank/src/main/webapp/
apps/mailreader/ apps/mailreader/src/main/java/ apps...
Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java?rev=590812&r1=590811&r2=590812&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java Wed Oct 31 13:32:54 2007
@@ -1,258 +1,258 @@
-/*
- * $Id: $
- *
- * 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.
- */
-package org.apache.struts2.portlet.result;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.portlet.PortletMode;
-
-import org.apache.struts2.dispatcher.ServletActionRedirectResult;
-import org.apache.struts2.dispatcher.mapper.ActionMapper;
-import org.apache.struts2.dispatcher.mapper.ActionMapping;
-import org.apache.struts2.portlet.PortletActionConstants;
-import org.apache.struts2.views.util.UrlHelper;
-
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.config.entities.ResultConfig;
-import com.opensymphony.xwork2.inject.Inject;
-
-/**
- *
- * Portlet modification of the {@link ServletActionRedirectResult}.
- *
- * <!-- START SNIPPET: description -->
- *
- * This result uses the {@link ActionMapper} provided by the
- * {@link ActionMapperFactory} to instruct the render phase to invoke the
- * specified action and (optional) namespace. This is better than the
- * {@link PortletResult} because it does not require you to encode the URL
- * patterns processed by the {@link ActionMapper} in to your struts.xml
- * configuration files. This means you can change your URL patterns at any point
- * and your application will still work. It is strongly recommended that if you
- * are redirecting to another action, you use this result rather than the
- * standard redirect result.
- *
- * See examples below for an example of how request parameters could be passed
- * in.
- *
- * <!-- END SNIPPET: description -->
- *
- * <b>This result type takes the following parameters:</b>
- *
- * <!-- START SNIPPET: params -->
- *
- * <ul>
- *
- * <li><b>actionName (default)</b> - the name of the action that will be
- * redirect to</li>
- *
- * <li><b>namespace</b> - used to determine which namespace the action is in
- * that we're redirecting to . If namespace is null, this defaults to the
- * current namespace</li>
- *
- * </ul>
- *
- * <!-- END SNIPPET: params -->
- *
- * <b>Example:</b>
- *
- * <pre>
- * <!-- START SNIPPET: example -->
- * <package name="public" extends="struts-default">
- * <action name="login" class="...">
- * <!-- Redirect to another namespace -->
- * <result type="redirect-action">
- * <param name="actionName">dashboard</param>
- * <param name="namespace">/secure</param>
- * </result>
- * </action>
- * </package>
- *
- * <package name="secure" extends="struts-default" namespace="/secure">
- * <-- Redirect to an action in the same namespace -->
- * <action name="dashboard" class="...">
- * <result>dashboard.jsp</result>
- * <result name="error" type="redirect-action">error</result>
- * </action>
- *
- * <action name="error" class="...">
- * <result>error.jsp</result>
- * </action>
- * </package>
- *
- * <package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters">
- * <-- Pass parameters (reportType, width and height) -->
- * <!--
- * The redirect-action url generated will be :
- * /genReport/generateReport.action?reportType=pie&width=100&height=100
- * -->
- * <action name="gatherReportInfo" class="...">
- * <result name="showReportResult" type="redirect-action">
- * <param name="actionName">generateReport</param>
- * <param name="namespace">/genReport</param>
- * <param name="reportType">pie</param>
- * <param name="width">100</param>
- * <param name="height">100</param>
- * </result>
- * </action>
- * </package>
- *
- *
- * <!-- END SNIPPET: example -->
- * </pre>
- *
- * @see ActionMapper
- */
-public class PortletActionRedirectResult extends PortletResult {
-
- private static final long serialVersionUID = -7627388936683562557L;
-
- /** The default parameter */
- public static final String DEFAULT_PARAM = "actionName";
-
- protected String actionName;
-
- protected String namespace;
-
- protected String method;
-
- private Map<String, String> requestParameters = new LinkedHashMap<String, String>();
-
- private ActionMapper actionMapper;
-
- public PortletActionRedirectResult() {
- super();
- }
-
- public PortletActionRedirectResult(String actionName) {
- this(null, actionName, null);
- }
-
- public PortletActionRedirectResult(String actionName, String method) {
- this(null, actionName, method);
- }
-
- public PortletActionRedirectResult(String namespace, String actionName, String method) {
- super(null);
- this.namespace = namespace;
- this.actionName = actionName;
- this.method = method;
- }
-
- protected List<String> prohibitedResultParam = Arrays.asList(new String[] { DEFAULT_PARAM, "namespace", "method",
- "encode", "parse", "location", "prependServletContext" });
-
- @Inject
- public void setActionMapper(ActionMapper actionMapper) {
- this.actionMapper = actionMapper;
- }
-
- /**
- * @see com.opensymphony.xwork2.Result#execute(com.opensymphony.xwork2.ActionInvocation)
- */
- public void execute(ActionInvocation invocation) throws Exception {
- actionName = conditionalParse(actionName, invocation);
- if (portletMode != null) {
- Map<PortletMode, String> namespaceMap = (Map<PortletMode, String>) invocation.getInvocationContext().get(
- PortletActionConstants.MODE_NAMESPACE_MAP);
- namespace = namespaceMap.get(portletMode);
- }
- if (namespace == null) {
- namespace = invocation.getProxy().getNamespace();
- } else {
- namespace = conditionalParse(namespace, invocation);
- }
- if (method == null) {
- method = "";
- } else {
- method = conditionalParse(method, invocation);
- }
-
- String resultCode = invocation.getResultCode();
- if (resultCode != null) {
- ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get(resultCode);
- Map resultConfigParams = resultConfig.getParams();
- for (Iterator i = resultConfigParams.entrySet().iterator(); i.hasNext();) {
- Map.Entry e = (Map.Entry) i.next();
- if (!prohibitedResultParam.contains(e.getKey())) {
- requestParameters.put(e.getKey().toString(), e.getValue() == null ? "" : conditionalParse(e
- .getValue().toString(), invocation));
- }
- }
- }
-
- StringBuffer tmpLocation = new StringBuffer(actionMapper.getUriFromActionMapping(new ActionMapping(actionName,
- namespace, method, null)));
- UrlHelper.buildParametersString(requestParameters, tmpLocation, "&");
-
- setLocation(tmpLocation.toString());
-
- super.execute(invocation);
- }
-
- /**
- * Sets the action name
- *
- * @param actionName
- * The name
- */
- public void setActionName(String actionName) {
- this.actionName = actionName;
- }
-
- /**
- * Sets the namespace
- *
- * @param namespace
- * The namespace
- */
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
- /**
- * Sets the method
- *
- * @param method
- * The method
- */
- public void setMethod(String method) {
- this.method = method;
- }
-
- /**
- * Adds a request parameter to be added to the redirect url
- *
- * @param key
- * The parameter name
- * @param value
- * The parameter value
- */
- public PortletActionRedirectResult addParameter(String key, Object value) {
- requestParameters.put(key, String.valueOf(value));
- return this;
- }
-
-}
+/*
+ * $Id: $
+ *
+ * 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.
+ */
+package org.apache.struts2.portlet.result;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.PortletMode;
+
+import org.apache.struts2.dispatcher.ServletActionRedirectResult;
+import org.apache.struts2.dispatcher.mapper.ActionMapper;
+import org.apache.struts2.dispatcher.mapper.ActionMapping;
+import org.apache.struts2.portlet.PortletActionConstants;
+import org.apache.struts2.views.util.UrlHelper;
+
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.inject.Inject;
+
+/**
+ *
+ * Portlet modification of the {@link ServletActionRedirectResult}.
+ *
+ * <!-- START SNIPPET: description -->
+ *
+ * This result uses the {@link ActionMapper} provided by the
+ * {@link ActionMapperFactory} to instruct the render phase to invoke the
+ * specified action and (optional) namespace. This is better than the
+ * {@link PortletResult} because it does not require you to encode the URL
+ * patterns processed by the {@link ActionMapper} in to your struts.xml
+ * configuration files. This means you can change your URL patterns at any point
+ * and your application will still work. It is strongly recommended that if you
+ * are redirecting to another action, you use this result rather than the
+ * standard redirect result.
+ *
+ * See examples below for an example of how request parameters could be passed
+ * in.
+ *
+ * <!-- END SNIPPET: description -->
+ *
+ * <b>This result type takes the following parameters:</b>
+ *
+ * <!-- START SNIPPET: params -->
+ *
+ * <ul>
+ *
+ * <li><b>actionName (default)</b> - the name of the action that will be
+ * redirect to</li>
+ *
+ * <li><b>namespace</b> - used to determine which namespace the action is in
+ * that we're redirecting to . If namespace is null, this defaults to the
+ * current namespace</li>
+ *
+ * </ul>
+ *
+ * <!-- END SNIPPET: params -->
+ *
+ * <b>Example:</b>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * <package name="public" extends="struts-default">
+ * <action name="login" class="...">
+ * <!-- Redirect to another namespace -->
+ * <result type="redirect-action">
+ * <param name="actionName">dashboard</param>
+ * <param name="namespace">/secure</param>
+ * </result>
+ * </action>
+ * </package>
+ *
+ * <package name="secure" extends="struts-default" namespace="/secure">
+ * <-- Redirect to an action in the same namespace -->
+ * <action name="dashboard" class="...">
+ * <result>dashboard.jsp</result>
+ * <result name="error" type="redirect-action">error</result>
+ * </action>
+ *
+ * <action name="error" class="...">
+ * <result>error.jsp</result>
+ * </action>
+ * </package>
+ *
+ * <package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters">
+ * <-- Pass parameters (reportType, width and height) -->
+ * <!--
+ * The redirect-action url generated will be :
+ * /genReport/generateReport.action?reportType=pie&width=100&height=100
+ * -->
+ * <action name="gatherReportInfo" class="...">
+ * <result name="showReportResult" type="redirect-action">
+ * <param name="actionName">generateReport</param>
+ * <param name="namespace">/genReport</param>
+ * <param name="reportType">pie</param>
+ * <param name="width">100</param>
+ * <param name="height">100</param>
+ * </result>
+ * </action>
+ * </package>
+ *
+ *
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @see ActionMapper
+ */
+public class PortletActionRedirectResult extends PortletResult {
+
+ private static final long serialVersionUID = -7627388936683562557L;
+
+ /** The default parameter */
+ public static final String DEFAULT_PARAM = "actionName";
+
+ protected String actionName;
+
+ protected String namespace;
+
+ protected String method;
+
+ private Map<String, String> requestParameters = new LinkedHashMap<String, String>();
+
+ private ActionMapper actionMapper;
+
+ public PortletActionRedirectResult() {
+ super();
+ }
+
+ public PortletActionRedirectResult(String actionName) {
+ this(null, actionName, null);
+ }
+
+ public PortletActionRedirectResult(String actionName, String method) {
+ this(null, actionName, method);
+ }
+
+ public PortletActionRedirectResult(String namespace, String actionName, String method) {
+ super(null);
+ this.namespace = namespace;
+ this.actionName = actionName;
+ this.method = method;
+ }
+
+ protected List<String> prohibitedResultParam = Arrays.asList(new String[] { DEFAULT_PARAM, "namespace", "method",
+ "encode", "parse", "location", "prependServletContext" });
+
+ @Inject
+ public void setActionMapper(ActionMapper actionMapper) {
+ this.actionMapper = actionMapper;
+ }
+
+ /**
+ * @see com.opensymphony.xwork2.Result#execute(com.opensymphony.xwork2.ActionInvocation)
+ */
+ public void execute(ActionInvocation invocation) throws Exception {
+ actionName = conditionalParse(actionName, invocation);
+ if (portletMode != null) {
+ Map<PortletMode, String> namespaceMap = (Map<PortletMode, String>) invocation.getInvocationContext().get(
+ PortletActionConstants.MODE_NAMESPACE_MAP);
+ namespace = namespaceMap.get(portletMode);
+ }
+ if (namespace == null) {
+ namespace = invocation.getProxy().getNamespace();
+ } else {
+ namespace = conditionalParse(namespace, invocation);
+ }
+ if (method == null) {
+ method = "";
+ } else {
+ method = conditionalParse(method, invocation);
+ }
+
+ String resultCode = invocation.getResultCode();
+ if (resultCode != null) {
+ ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get(resultCode);
+ Map resultConfigParams = resultConfig.getParams();
+ for (Iterator i = resultConfigParams.entrySet().iterator(); i.hasNext();) {
+ Map.Entry e = (Map.Entry) i.next();
+ if (!prohibitedResultParam.contains(e.getKey())) {
+ requestParameters.put(e.getKey().toString(), e.getValue() == null ? "" : conditionalParse(e
+ .getValue().toString(), invocation));
+ }
+ }
+ }
+
+ StringBuffer tmpLocation = new StringBuffer(actionMapper.getUriFromActionMapping(new ActionMapping(actionName,
+ namespace, method, null)));
+ UrlHelper.buildParametersString(requestParameters, tmpLocation, "&");
+
+ setLocation(tmpLocation.toString());
+
+ super.execute(invocation);
+ }
+
+ /**
+ * Sets the action name
+ *
+ * @param actionName
+ * The name
+ */
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
+
+ /**
+ * Sets the namespace
+ *
+ * @param namespace
+ * The namespace
+ */
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ /**
+ * Sets the method
+ *
+ * @param method
+ * The method
+ */
+ public void setMethod(String method) {
+ this.method = method;
+ }
+
+ /**
+ * Adds a request parameter to be added to the redirect url
+ *
+ * @param key
+ * The parameter name
+ * @param value
+ * The parameter value
+ */
+ public PortletActionRedirectResult addParameter(String key, Object value) {
+ requestParameters.put(key, String.valueOf(value));
+ return this;
+ }
+
+}
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java?rev=590812&r1=590811&r2=590812&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java Wed Oct 31 13:32:54 2007
@@ -1,214 +1,214 @@
-/*
- * $Id: $
- *
- * 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.
- */
-package org.apache.struts2.portlet.servlet;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import javax.portlet.PortletSession;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionContext;
-
-/**
- * Wrapper object exposing a {@link PortletSession} as a {@link HttpSession} instance.
- * Clients accessing this session object will in fact operate on the
- * {@link PortletSession} object wrapped by this session object.
- */
-public class PortletHttpSession implements HttpSession {
-
- private PortletSession portletSession;
-
- public PortletHttpSession(PortletSession portletSession) {
- this.portletSession = portletSession;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#getAttribute(java.lang.String)
- */
- public Object getAttribute(String name) {
- return portletSession.getAttribute(name);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#getAttributeNames()
- */
- public Enumeration getAttributeNames() {
- return portletSession.getAttributeNames();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#getCreationTime()
- */
- public long getCreationTime() {
- return portletSession.getCreationTime();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#getId()
- */
- public String getId() {
- return portletSession.getId();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#getLastAccessedTime()
- */
- public long getLastAccessedTime() {
- return portletSession.getLastAccessedTime();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#getMaxInactiveInterval()
- */
- public int getMaxInactiveInterval() {
- return portletSession.getMaxInactiveInterval();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#getServletContext()
- */
- public ServletContext getServletContext() {
- return new PortletServletContext(portletSession.getPortletContext());
- }
-
- /**
- * @see javax.servlet.http.HttpSession#getSessionContext()
- * @throws IllegalStateException
- * Not supported in a portlet.
- */
- public HttpSessionContext getSessionContext() {
- throw new IllegalStateException("Not supported in a portlet");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#getValue(java.lang.String)
- */
- public Object getValue(String name) {
- return getAttribute(name);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#getValueNames()
- */
- public String[] getValueNames() {
- List<String> names = new ArrayList<String>();
- Enumeration attrNames = getAttributeNames();
- while (attrNames.hasMoreElements()) {
- names.add((String) attrNames.nextElement());
- }
- return names.toArray(new String[0]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#invalidate()
- */
- public void invalidate() {
- portletSession.invalidate();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#isNew()
- */
- public boolean isNew() {
- return portletSession.isNew();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#putValue(java.lang.String,
- * java.lang.Object)
- */
- public void putValue(String name, Object value) {
- setAttribute(name, value);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#removeAttribute(java.lang.String)
- */
- public void removeAttribute(String name) {
- portletSession.removeAttribute(name);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#removeValue(java.lang.String)
- */
- public void removeValue(String name) {
- removeAttribute(name);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#setAttribute(java.lang.String,
- * java.lang.Object)
- */
- public void setAttribute(String name, Object value) {
- portletSession.setAttribute(name, value);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.servlet.http.HttpSession#setMaxInactiveInterval(int)
- */
- public void setMaxInactiveInterval(int interval) {
- portletSession.setMaxInactiveInterval(interval);
- }
-
- /**
- * Get the wrapped portlet session.
- *
- * @return The wrapped portlet session.
- */
- public PortletSession getPortletSession() {
- return portletSession;
- }
-
-}
+/*
+ * $Id: $
+ *
+ * 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.
+ */
+package org.apache.struts2.portlet.servlet;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.portlet.PortletSession;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+/**
+ * Wrapper object exposing a {@link PortletSession} as a {@link HttpSession} instance.
+ * Clients accessing this session object will in fact operate on the
+ * {@link PortletSession} object wrapped by this session object.
+ */
+public class PortletHttpSession implements HttpSession {
+
+ private PortletSession portletSession;
+
+ public PortletHttpSession(PortletSession portletSession) {
+ this.portletSession = portletSession;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#getAttribute(java.lang.String)
+ */
+ public Object getAttribute(String name) {
+ return portletSession.getAttribute(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#getAttributeNames()
+ */
+ public Enumeration getAttributeNames() {
+ return portletSession.getAttributeNames();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#getCreationTime()
+ */
+ public long getCreationTime() {
+ return portletSession.getCreationTime();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#getId()
+ */
+ public String getId() {
+ return portletSession.getId();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#getLastAccessedTime()
+ */
+ public long getLastAccessedTime() {
+ return portletSession.getLastAccessedTime();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#getMaxInactiveInterval()
+ */
+ public int getMaxInactiveInterval() {
+ return portletSession.getMaxInactiveInterval();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#getServletContext()
+ */
+ public ServletContext getServletContext() {
+ return new PortletServletContext(portletSession.getPortletContext());
+ }
+
+ /**
+ * @see javax.servlet.http.HttpSession#getSessionContext()
+ * @throws IllegalStateException
+ * Not supported in a portlet.
+ */
+ public HttpSessionContext getSessionContext() {
+ throw new IllegalStateException("Not supported in a portlet");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#getValue(java.lang.String)
+ */
+ public Object getValue(String name) {
+ return getAttribute(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#getValueNames()
+ */
+ public String[] getValueNames() {
+ List<String> names = new ArrayList<String>();
+ Enumeration attrNames = getAttributeNames();
+ while (attrNames.hasMoreElements()) {
+ names.add((String) attrNames.nextElement());
+ }
+ return names.toArray(new String[0]);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#invalidate()
+ */
+ public void invalidate() {
+ portletSession.invalidate();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#isNew()
+ */
+ public boolean isNew() {
+ return portletSession.isNew();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#putValue(java.lang.String,
+ * java.lang.Object)
+ */
+ public void putValue(String name, Object value) {
+ setAttribute(name, value);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#removeAttribute(java.lang.String)
+ */
+ public void removeAttribute(String name) {
+ portletSession.removeAttribute(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#removeValue(java.lang.String)
+ */
+ public void removeValue(String name) {
+ removeAttribute(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#setAttribute(java.lang.String,
+ * java.lang.Object)
+ */
+ public void setAttribute(String name, Object value) {
+ portletSession.setAttribute(name, value);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.servlet.http.HttpSession#setMaxInactiveInterval(int)
+ */
+ public void setMaxInactiveInterval(int interval) {
+ portletSession.setMaxInactiveInterval(interval);
+ }
+
+ /**
+ * Get the wrapped portlet session.
+ *
+ * @return The wrapped portlet session.
+ */
+ public PortletSession getPortletSession() {
+ return portletSession;
+ }
+
+}
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java?rev=590812&r1=590811&r2=590812&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java Wed Oct 31 13:32:54 2007
@@ -1,81 +1,81 @@
-/*
- * $Id: $
- *
- * 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.
- */
-package org.apache.struts2.portlet.servlet;
-
-import java.util.Enumeration;
-
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletContext;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-
-/**
- * Wrapper object exposing a {@link PortletConfig} as a {@link ServletConfig} instance.
- * Clients accessing this config object will in fact operate on the
- * {@link PortletConfig} object wrapped by this config object.
- */
-public class PortletServletConfig implements ServletConfig {
-
- private PortletConfig portletConfig;
-
- public PortletServletConfig(PortletConfig portletConfig) {
- this.portletConfig = portletConfig;
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletConfig#getInitParameter(java.lang.String)
- */
- public String getInitParameter(String name) {
- return portletConfig.getInitParameter(name);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletConfig#getInitParameterNames()
- */
- public Enumeration getInitParameterNames() {
- return portletConfig.getInitParameterNames();
- }
-
- /**
- * Get the {@link PortletContext} as a {@link PortletServletContext} instance.
- * @see javax.servlet.ServletConfig#getServletContext()
- */
- public ServletContext getServletContext() {
- return new PortletServletContext(portletConfig.getPortletContext());
- }
-
- /**
- * Will return the portlet name.
- * @see javax.servlet.ServletConfig#getServletName()
- */
- public String getServletName() {
- return portletConfig.getPortletName();
- }
-
- /**
- * Get the wrapped {@link PortletConfig} instance.
- * @return The wrapped {@link PortletConfig} instance.
- */
- public PortletConfig getPortletConfig() {
- return portletConfig;
- }
-
-}
+/*
+ * $Id: $
+ *
+ * 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.
+ */
+package org.apache.struts2.portlet.servlet;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+
+/**
+ * Wrapper object exposing a {@link PortletConfig} as a {@link ServletConfig} instance.
+ * Clients accessing this config object will in fact operate on the
+ * {@link PortletConfig} object wrapped by this config object.
+ */
+public class PortletServletConfig implements ServletConfig {
+
+ private PortletConfig portletConfig;
+
+ public PortletServletConfig(PortletConfig portletConfig) {
+ this.portletConfig = portletConfig;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletConfig#getInitParameter(java.lang.String)
+ */
+ public String getInitParameter(String name) {
+ return portletConfig.getInitParameter(name);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletConfig#getInitParameterNames()
+ */
+ public Enumeration getInitParameterNames() {
+ return portletConfig.getInitParameterNames();
+ }
+
+ /**
+ * Get the {@link PortletContext} as a {@link PortletServletContext} instance.
+ * @see javax.servlet.ServletConfig#getServletContext()
+ */
+ public ServletContext getServletContext() {
+ return new PortletServletContext(portletConfig.getPortletContext());
+ }
+
+ /**
+ * Will return the portlet name.
+ * @see javax.servlet.ServletConfig#getServletName()
+ */
+ public String getServletName() {
+ return portletConfig.getPortletName();
+ }
+
+ /**
+ * Get the wrapped {@link PortletConfig} instance.
+ * @return The wrapped {@link PortletConfig} instance.
+ */
+ public PortletConfig getPortletConfig() {
+ return portletConfig;
+ }
+
+}
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java?rev=590812&r1=590811&r2=590812&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java Wed Oct 31 13:32:54 2007
@@ -1,235 +1,235 @@
-/*
- * $Id: $
- *
- * 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.
- */
-package org.apache.struts2.portlet.servlet;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Set;
-
-import javax.portlet.PortletContext;
-import javax.portlet.PortletRequestDispatcher;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-/**
- * Wrapper object exposing a {@link PortletContext} as a {@link ServletContext} instance.
- * Clients accessing this context object will in fact operate on the
- * {@link PortletContext} object wrapped by this context object.
- */
-public class PortletServletContext implements ServletContext {
-
- private PortletContext portletContext;
-
- public PortletServletContext(PortletContext portletContext) {
- this.portletContext = portletContext;
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getAttribute(java.lang.String)
- */
- public Object getAttribute(String name) {
- return portletContext.getAttribute(name);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getAttributeNames()
- */
- public Enumeration getAttributeNames() {
- return portletContext.getAttributeNames();
- }
-
- /**
- * @see javax.servlet.ServletContext#getContext(java.lang.String)
- * @throws IllegalStateException Not supported in a portlet.
- */
- public ServletContext getContext(String uripath) {
- throw new IllegalStateException("Not supported in a portlet");
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getInitParameter(java.lang.String)
- */
- public String getInitParameter(String name) {
- return portletContext.getInitParameter(name);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getInitParameterNames()
- */
- public Enumeration getInitParameterNames() {
- return portletContext.getInitParameterNames();
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getMajorVersion()
- */
- public int getMajorVersion() {
- return portletContext.getMajorVersion();
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getMimeType(java.lang.String)
- */
- public String getMimeType(String file) {
- return portletContext.getMimeType(file);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getMinorVersion()
- */
- public int getMinorVersion() {
- return portletContext.getMinorVersion();
- }
-
- /**
- * Returns a {@link PortletServletRequestDispatcher} wrapping the {@link PortletRequestDispatcher}
- * as a {@link RequestDispatcher} instance.
- * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String)
- * @return PortletServletRequestDispatcher
- */
- public RequestDispatcher getNamedDispatcher(String name) {
- return new PortletServletRequestDispatcher(portletContext.getNamedDispatcher(name));
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getRealPath(java.lang.String)
- */
- public String getRealPath(String path) {
- return portletContext.getRealPath(path);
- }
-
- /**
- * Returns a {@link PortletServletRequestDispatcher} wrapping the {@link PortletRequestDispatcher}
- * as a {@link RequestDispatcher} instance.
- * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String)
- * @return PortletServletRequestDispatcher
- */
- public RequestDispatcher getRequestDispatcher(String path) {
- return new PortletServletRequestDispatcher(portletContext.getRequestDispatcher(path));
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getResource(java.lang.String)
- */
- public URL getResource(String path) throws MalformedURLException {
- return portletContext.getResource(path);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getResourceAsStream(java.lang.String)
- */
- public InputStream getResourceAsStream(String path) {
- return portletContext.getResourceAsStream(path);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getResourcePaths(java.lang.String)
- */
- public Set getResourcePaths(String path) {
- return portletContext.getResourcePaths(path);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getServerInfo()
- */
- public String getServerInfo() {
- return portletContext.getServerInfo();
- }
-
- /**
- * @see javax.servlet.ServletContext#getServlet(java.lang.String)
- * @throws IllegalStateException Not supported in a portlet.
- */
- public Servlet getServlet(String name) throws ServletException {
- throw new IllegalStateException("Not allowed in a portlet");
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#getServletContextName()
- */
- public String getServletContextName() {
- return portletContext.getPortletContextName();
- }
-
- /**
- * @see javax.servlet.ServletContext#getServletNames()
- * @throws IllegalStateException Not supported in a portlet.
- */
- public Enumeration getServletNames() {
- throw new IllegalStateException("Not allowed in a portlet");
- }
-
- /**
- * @see javax.servlet.ServletContext#getServlets()
- * @throws IllegalStateException Not supported in a portlet.
- */
- public Enumeration getServlets() {
- throw new IllegalStateException("Not allowed in a portlet");
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#log(java.lang.String)
- */
- public void log(String msg) {
- portletContext.log(msg);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#log(java.lang.Exception, java.lang.String)
- */
- public void log(Exception exception, String msg) {
- log(msg, exception);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#log(java.lang.String, java.lang.Throwable)
- */
- public void log(String message, Throwable throwable) {
- portletContext.log(message, throwable);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#removeAttribute(java.lang.String)
- */
- public void removeAttribute(String name) {
- portletContext.removeAttribute(name);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.ServletContext#setAttribute(java.lang.String, java.lang.Object)
- */
- public void setAttribute(String name, Object object) {
- portletContext.setAttribute(name, object);
- }
-
- /**
- * Get the wrapped {@link PortletContext} instance.
- * @return The wrapped {@link PortletContext} instance.
- */
- public PortletContext getPortletContext() {
- return portletContext;
- }
-
-}
+/*
+ * $Id: $
+ *
+ * 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.
+ */
+package org.apache.struts2.portlet.servlet;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequestDispatcher;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+/**
+ * Wrapper object exposing a {@link PortletContext} as a {@link ServletContext} instance.
+ * Clients accessing this context object will in fact operate on the
+ * {@link PortletContext} object wrapped by this context object.
+ */
+public class PortletServletContext implements ServletContext {
+
+ private PortletContext portletContext;
+
+ public PortletServletContext(PortletContext portletContext) {
+ this.portletContext = portletContext;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getAttribute(java.lang.String)
+ */
+ public Object getAttribute(String name) {
+ return portletContext.getAttribute(name);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getAttributeNames()
+ */
+ public Enumeration getAttributeNames() {
+ return portletContext.getAttributeNames();
+ }
+
+ /**
+ * @see javax.servlet.ServletContext#getContext(java.lang.String)
+ * @throws IllegalStateException Not supported in a portlet.
+ */
+ public ServletContext getContext(String uripath) {
+ throw new IllegalStateException("Not supported in a portlet");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getInitParameter(java.lang.String)
+ */
+ public String getInitParameter(String name) {
+ return portletContext.getInitParameter(name);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getInitParameterNames()
+ */
+ public Enumeration getInitParameterNames() {
+ return portletContext.getInitParameterNames();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getMajorVersion()
+ */
+ public int getMajorVersion() {
+ return portletContext.getMajorVersion();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getMimeType(java.lang.String)
+ */
+ public String getMimeType(String file) {
+ return portletContext.getMimeType(file);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getMinorVersion()
+ */
+ public int getMinorVersion() {
+ return portletContext.getMinorVersion();
+ }
+
+ /**
+ * Returns a {@link PortletServletRequestDispatcher} wrapping the {@link PortletRequestDispatcher}
+ * as a {@link RequestDispatcher} instance.
+ * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String)
+ * @return PortletServletRequestDispatcher
+ */
+ public RequestDispatcher getNamedDispatcher(String name) {
+ return new PortletServletRequestDispatcher(portletContext.getNamedDispatcher(name));
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getRealPath(java.lang.String)
+ */
+ public String getRealPath(String path) {
+ return portletContext.getRealPath(path);
+ }
+
+ /**
+ * Returns a {@link PortletServletRequestDispatcher} wrapping the {@link PortletRequestDispatcher}
+ * as a {@link RequestDispatcher} instance.
+ * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String)
+ * @return PortletServletRequestDispatcher
+ */
+ public RequestDispatcher getRequestDispatcher(String path) {
+ return new PortletServletRequestDispatcher(portletContext.getRequestDispatcher(path));
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getResource(java.lang.String)
+ */
+ public URL getResource(String path) throws MalformedURLException {
+ return portletContext.getResource(path);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getResourceAsStream(java.lang.String)
+ */
+ public InputStream getResourceAsStream(String path) {
+ return portletContext.getResourceAsStream(path);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getResourcePaths(java.lang.String)
+ */
+ public Set getResourcePaths(String path) {
+ return portletContext.getResourcePaths(path);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getServerInfo()
+ */
+ public String getServerInfo() {
+ return portletContext.getServerInfo();
+ }
+
+ /**
+ * @see javax.servlet.ServletContext#getServlet(java.lang.String)
+ * @throws IllegalStateException Not supported in a portlet.
+ */
+ public Servlet getServlet(String name) throws ServletException {
+ throw new IllegalStateException("Not allowed in a portlet");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#getServletContextName()
+ */
+ public String getServletContextName() {
+ return portletContext.getPortletContextName();
+ }
+
+ /**
+ * @see javax.servlet.ServletContext#getServletNames()
+ * @throws IllegalStateException Not supported in a portlet.
+ */
+ public Enumeration getServletNames() {
+ throw new IllegalStateException("Not allowed in a portlet");
+ }
+
+ /**
+ * @see javax.servlet.ServletContext#getServlets()
+ * @throws IllegalStateException Not supported in a portlet.
+ */
+ public Enumeration getServlets() {
+ throw new IllegalStateException("Not allowed in a portlet");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#log(java.lang.String)
+ */
+ public void log(String msg) {
+ portletContext.log(msg);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#log(java.lang.Exception, java.lang.String)
+ */
+ public void log(Exception exception, String msg) {
+ log(msg, exception);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#log(java.lang.String, java.lang.Throwable)
+ */
+ public void log(String message, Throwable throwable) {
+ portletContext.log(message, throwable);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#removeAttribute(java.lang.String)
+ */
+ public void removeAttribute(String name) {
+ portletContext.removeAttribute(name);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.ServletContext#setAttribute(java.lang.String, java.lang.Object)
+ */
+ public void setAttribute(String name, Object object) {
+ portletContext.setAttribute(name, object);
+ }
+
+ /**
+ * Get the wrapped {@link PortletContext} instance.
+ * @return The wrapped {@link PortletContext} instance.
+ */
+ public PortletContext getPortletContext() {
+ return portletContext;
+ }
+
+}
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java?rev=590812&r1=590811&r2=590812&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java Wed Oct 31 13:32:54 2007
@@ -1,121 +1,121 @@
-/*
- * $Id: $
- *
- * 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.
- */
-package org.apache.struts2.portlet.servlet;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.servlet.ServletInputStream;
-
-/**
- * Wrapper object exposing a {@link InputStream} from a portlet as a {@link ServletInputStream} instance.
- * Clients accessing this stream object will in fact operate on the
- * {@link InputStream} object wrapped by this stream object.
- */
-public class PortletServletInputStream extends ServletInputStream {
-
- private InputStream portletInputStream;
-
- public PortletServletInputStream(InputStream portletInputStream) {
- this.portletInputStream = portletInputStream;
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#read()
- */
- @Override
- public int read() throws IOException {
- return portletInputStream.read();
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#available()
- */
- @Override
- public int available() throws IOException {
- return portletInputStream.available();
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#close()
- */
- @Override
- public void close() throws IOException {
- portletInputStream.close();
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#mark(int)
- */
- @Override
- public synchronized void mark(int readlimit) {
- portletInputStream.mark(readlimit);
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#markSupported()
- */
- @Override
- public boolean markSupported() {
- return portletInputStream.markSupported();
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#read(byte[], int, int)
- */
- @Override
- public int read(byte[] b, int off, int len) throws IOException {
- return portletInputStream.read(b, off, len);
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#read(byte[])
- */
- @Override
- public int read(byte[] b) throws IOException {
- return portletInputStream.read(b);
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#reset()
- */
- @Override
- public synchronized void reset() throws IOException {
- portletInputStream.reset();
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#skip(long)
- */
- @Override
- public long skip(long n) throws IOException {
- return portletInputStream.skip(n);
- }
-
- /**
- * Get the wrapped {@link InputStream} instance.
- * @return The wrapped {@link InputStream} instance.
- */
- public InputStream getInputStream() {
- return portletInputStream;
- }
-
-}
+/*
+ * $Id: $
+ *
+ * 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.
+ */
+package org.apache.struts2.portlet.servlet;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletInputStream;
+
+/**
+ * Wrapper object exposing a {@link InputStream} from a portlet as a {@link ServletInputStream} instance.
+ * Clients accessing this stream object will in fact operate on the
+ * {@link InputStream} object wrapped by this stream object.
+ */
+public class PortletServletInputStream extends ServletInputStream {
+
+ private InputStream portletInputStream;
+
+ public PortletServletInputStream(InputStream portletInputStream) {
+ this.portletInputStream = portletInputStream;
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#read()
+ */
+ @Override
+ public int read() throws IOException {
+ return portletInputStream.read();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#available()
+ */
+ @Override
+ public int available() throws IOException {
+ return portletInputStream.available();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#close()
+ */
+ @Override
+ public void close() throws IOException {
+ portletInputStream.close();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#mark(int)
+ */
+ @Override
+ public synchronized void mark(int readlimit) {
+ portletInputStream.mark(readlimit);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#markSupported()
+ */
+ @Override
+ public boolean markSupported() {
+ return portletInputStream.markSupported();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#read(byte[], int, int)
+ */
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ return portletInputStream.read(b, off, len);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#read(byte[])
+ */
+ @Override
+ public int read(byte[] b) throws IOException {
+ return portletInputStream.read(b);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#reset()
+ */
+ @Override
+ public synchronized void reset() throws IOException {
+ portletInputStream.reset();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#skip(long)
+ */
+ @Override
+ public long skip(long n) throws IOException {
+ return portletInputStream.skip(n);
+ }
+
+ /**
+ * Get the wrapped {@link InputStream} instance.
+ * @return The wrapped {@link InputStream} instance.
+ */
+ public InputStream getInputStream() {
+ return portletInputStream;
+ }
+
+}
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java?rev=590812&r1=590811&r2=590812&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java Wed Oct 31 13:32:54 2007
@@ -1,88 +1,88 @@
-/*
- * $Id: $
- *
- * 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.
- */
-package org.apache.struts2.portlet.servlet;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.servlet.ServletOutputStream;
-
-/**
- * Wrapper object exposing a {@link OutputStream} from a portlet as a {@link ServletOutputStream} instance.
- * Clients accessing this stream object will in fact operate on the
- * {@link OutputStream} object wrapped by this stream object.
- */
-public class PortletServletOutputStream extends ServletOutputStream {
-
- private OutputStream portletOutputStream;
-
- public PortletServletOutputStream(OutputStream portletOutputStream) {
- this.portletOutputStream = portletOutputStream;
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(int)
- */
- @Override
- public void write(int ch) throws IOException {
- portletOutputStream.write(ch);
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#close()
- */
- @Override
- public void close() throws IOException {
- portletOutputStream.close();
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#flush()
- */
- @Override
- public void flush() throws IOException {
- portletOutputStream.flush();
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(byte[])
- */
- @Override
- public void write(byte[] b) throws IOException {
- portletOutputStream.write(b);
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- @Override
- public void write(byte[] b, int off, int len) throws IOException {
- portletOutputStream.write(b, off, len);
- }
-
- /**
- * Get the wrapped {@link OutputStream} instance.
- * @return The wrapped {@link OutputStream} instance.
- */
- public OutputStream getOutputStream() {
- return portletOutputStream;
- }
-}
+/*
+ * $Id: $
+ *
+ * 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.
+ */
+package org.apache.struts2.portlet.servlet;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.servlet.ServletOutputStream;
+
+/**
+ * Wrapper object exposing a {@link OutputStream} from a portlet as a {@link ServletOutputStream} instance.
+ * Clients accessing this stream object will in fact operate on the
+ * {@link OutputStream} object wrapped by this stream object.
+ */
+public class PortletServletOutputStream extends ServletOutputStream {
+
+ private OutputStream portletOutputStream;
+
+ public PortletServletOutputStream(OutputStream portletOutputStream) {
+ this.portletOutputStream = portletOutputStream;
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#write(int)
+ */
+ @Override
+ public void write(int ch) throws IOException {
+ portletOutputStream.write(ch);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#close()
+ */
+ @Override
+ public void close() throws IOException {
+ portletOutputStream.close();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#flush()
+ */
+ @Override
+ public void flush() throws IOException {
+ portletOutputStream.flush();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#write(byte[])
+ */
+ @Override
+ public void write(byte[] b) throws IOException {
+ portletOutputStream.write(b);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#write(byte[], int, int)
+ */
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ portletOutputStream.write(b, off, len);
+ }
+
+ /**
+ * Get the wrapped {@link OutputStream} instance.
+ * @return The wrapped {@link OutputStream} instance.
+ */
+ public OutputStream getOutputStream() {
+ return portletOutputStream;
+ }
+}
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL