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 de...@apache.org on 2007/09/04 10:38:43 UTC
svn commit: r572581 -
/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/
Author: dettborn
Date: Tue Sep 4 01:38:42 2007
New Revision: 572581
URL: http://svn.apache.org/viewvc?rev=572581&view=rev
Log:
Committed patch: refactor_ResponseImpl-04.09.07.txt from JIRA 429 (http://issues.apache.org/jira/browse/PLUTO-429).
Thanks Kay!
Added:
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/MimeResponseImpl.java
Modified:
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionResponseImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventResponseImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionResponseImpl.java?rev=572581&r1=572580&r2=572581&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionResponseImpl.java Tue Sep 4 01:38:42 2007
@@ -17,12 +17,8 @@
package org.apache.pluto.internal.impl;
import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Locale;
import javax.portlet.ActionResponse;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -33,11 +29,6 @@
public class ActionResponseImpl extends StateAwareResponseImpl
implements ActionResponse, InternalActionResponse {
- /**
- * Is it still allowed to invoke the method sendRedirect() ?
- */
-
-
public ActionResponseImpl(PortletContainer container,
InternalPortletWindow internalPortletWindow,
@@ -52,241 +43,11 @@
}
@Override
- public void reset() {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.reset();
- }
-
- @Override
- public void resetBuffer() {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.resetBuffer();
- }
-
- @Override
- public void setBufferSize(int arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setBufferSize(arg0);
- }
-
- @Override
- public void setCharacterEncoding(String arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setCharacterEncoding(arg0);
- }
-
- @Override
- public void setContentLength(int arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setContentLength(arg0);
- }
-
- @Override
- public void setContentType(String arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setContentType(arg0);
- }
-
- @Override
- public void setLocale(Locale arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setLocale(arg0);
- }
-
- @Override
- public ServletOutputStream getOutputStream() throws IllegalStateException, IOException {
- if (super.isForwarded() || super.isIncluded()){
- return null;
- }
- else
- return super.getOutputStream();
- }
-
- @Override
- public PrintWriter getWriter() throws IllegalStateException, IOException {
- if (super.isForwarded() || super.isIncluded()){
- return null;
- }
- else
- return super.getWriter();
- }
-
- @Override
- public void addCookie(Cookie arg0) {
- if (super.isForwarded()){
- addProperty(arg0);
- }
- else if (super.isIncluded()){
- //no operation
- }
- else
- super.addCookie(arg0);
- }
-
- @Override
- public void addDateHeader(String arg0, long arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.addDateHeader(arg0, arg1);
- }
-
- @Override
- public void addHeader(String arg0, String arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.addHeader(arg0, arg1);
- }
-
- @Override
- public void addIntHeader(String arg0, int arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.addIntHeader(arg0, arg1);
- }
-
- @Override
- public boolean containsHeader(String arg0) {
- if (super.isForwarded() || super.isIncluded()){
- return false;
- }
- else
- return super.containsHeader(arg0);
- }
-
- @Override
- public void setStatus(int arg0, String arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setStatus(arg0, arg1);
- }
-
- @Override
public void sendRedirect(String location) throws IOException {
if (super.isIncluded()){
// no operation
}
super.sendRedirect(location);
}
-
- @Override
- public void setDateHeader(String arg0, long arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setDateHeader(arg0, arg1);
- }
-
- @Override
- public void setHeader(String arg0, String arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setHeader(arg0, arg1);
- }
-
- @Override
- public void setIntHeader(String arg0, int arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setIntHeader(arg0, arg1);
- }
-
- @Override
- public void setStatus(int arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setStatus(arg0);
- }
-
- @Override
- public void flushBuffer() throws IOException {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.flushBuffer();
- }
-
- @Override
- public int getBufferSize() {
- if (super.isForwarded() || super.isIncluded()){
- return 0;
- }
- else
- return super.getBufferSize();
- }
-
- @Override
- public String getCharacterEncoding() {
- if (super.isForwarded() || super.isIncluded()){
- return null;
- }
- else
- return super.getCharacterEncoding();
- }
-
- @Override
- public String getContentType() {
- if (super.isForwarded() || super.isIncluded()){
- return null;
- }
- else
- return super.getContentType();
- }
-
- @Override
- public Locale getLocale() {
- if (super.isForwarded() || super.isIncluded()){
- return null;
- }
- else
- return super.getLocale();
- }
-
- @Override
- public boolean isCommitted() {
- if (super.isForwarded() || super.isIncluded()){
- return true;
- }
- else
- return super.isCommitted();
- }
-
-
-
+
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventResponseImpl.java?rev=572581&r1=572580&r2=572581&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventResponseImpl.java Tue Sep 4 01:38:42 2007
@@ -17,13 +17,9 @@
package org.apache.pluto.internal.impl;
import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Locale;
import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -54,238 +50,10 @@
}
@Override
- public void reset() {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.reset();
- }
-
- @Override
- public void resetBuffer() {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.resetBuffer();
- }
-
- @Override
- public void setBufferSize(int arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setBufferSize(arg0);
- }
-
- @Override
- public void setCharacterEncoding(String arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setCharacterEncoding(arg0);
- }
-
- @Override
- public void setContentLength(int arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setContentLength(arg0);
- }
-
- @Override
- public void setContentType(String arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setContentType(arg0);
- }
-
- @Override
- public void setLocale(Locale arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setLocale(arg0);
- }
-
- @Override
- public ServletOutputStream getOutputStream() throws IllegalStateException, IOException {
- if (super.isForwarded() || super.isIncluded()){
- return null;
- }
- else
- return super.getOutputStream();
- }
-
- @Override
- public PrintWriter getWriter() throws IllegalStateException, IOException {
- if (super.isForwarded() || super.isIncluded()){
- return null;
- }
- else
- return super.getWriter();
- }
-
- @Override
- public void addCookie(Cookie arg0) {
- if (super.isForwarded()){
- addProperty(arg0);
- }
- else if (super.isIncluded()){
- //no operation
- }
- else
- super.addCookie(arg0);
- }
-
- @Override
- public void addDateHeader(String arg0, long arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.addDateHeader(arg0, arg1);
- }
-
- @Override
- public void addHeader(String arg0, String arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.addHeader(arg0, arg1);
- }
-
- @Override
- public void addIntHeader(String arg0, int arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.addIntHeader(arg0, arg1);
- }
-
- @Override
- public boolean containsHeader(String arg0) {
- if (super.isForwarded() || super.isIncluded()){
- return false;
- }
- else
- return super.containsHeader(arg0);
- }
-
- @Override
- public void setStatus(int arg0, String arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setStatus(arg0, arg1);
- }
-
- @Override
public void sendRedirect(String location) throws IOException {
if (super.isForwarded() || super.isIncluded()){
// no operation
}
super.sendRedirect(location);
- }
-
- @Override
- public void setDateHeader(String arg0, long arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setDateHeader(arg0, arg1);
- }
-
- @Override
- public void setHeader(String arg0, String arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setHeader(arg0, arg1);
- }
-
- @Override
- public void setIntHeader(String arg0, int arg1) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setIntHeader(arg0, arg1);
- }
-
- @Override
- public void setStatus(int arg0) {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.setStatus(arg0);
- }
-
- @Override
- public void flushBuffer() throws IOException {
- if (super.isForwarded() || super.isIncluded()){
- // no operation
- }
- else
- super.flushBuffer();
- }
-
- @Override
- public int getBufferSize() {
- if (super.isForwarded() || super.isIncluded()){
- return 0;
- }
- else
- return super.getBufferSize();
- }
-
- @Override
- public String getCharacterEncoding() {
- if (super.isForwarded() || super.isIncluded()){
- return null;
- }
- else
- return super.getCharacterEncoding();
- }
-
- @Override
- public String getContentType() {
- if (super.isForwarded() || super.isIncluded()){
- return null;
- }
- else
- return super.getContentType();
- }
-
- @Override
- public Locale getLocale() {
- if (super.isForwarded() || super.isIncluded()){
- return null;
- }
- else
- return super.getLocale();
- }
-
- @Override
- public boolean isCommitted() {
- if (super.isForwarded() || super.isIncluded()){
- return true;
- }
- else
- return super.isCommitted();
}
}
Added: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/MimeResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/MimeResponseImpl.java?rev=572581&view=auto
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/MimeResponseImpl.java (added)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/MimeResponseImpl.java Tue Sep 4 01:38:42 2007
@@ -0,0 +1,327 @@
+/*
+ * 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.pluto.internal.impl;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Locale;
+
+import javax.portlet.CacheControl;
+import javax.portlet.MimeResponse;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.PortletContainer;
+import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.pluto.descriptors.portlet.SupportsDD;
+import org.apache.pluto.internal.InternalPortletWindow;
+import org.apache.pluto.util.ArgumentUtility;
+import org.apache.pluto.util.StringManager;
+import org.apache.pluto.util.StringUtils;
+
+public class MimeResponseImpl extends PortletResponseImpl implements
+ MimeResponse {
+
+ /** Logger. */
+ private static final Log LOG = LogFactory.getLog(MimeResponseImpl.class);
+
+ private static final StringManager EXCEPTIONS = StringManager.getManager(
+ MimeResponseImpl.class.getPackage().getName());
+
+ /** The current content type. */
+ private String currentContentType = null;
+
+
+ public MimeResponseImpl(PortletContainer container,
+ InternalPortletWindow internalPortletWindow,
+ HttpServletRequest servletRequest,
+ HttpServletResponse servletResponse) {
+
+ super(container, internalPortletWindow, servletRequest,
+ servletResponse);
+ }
+
+ @Override
+ public void flushBuffer() throws IOException {
+ getHttpServletResponse().flushBuffer();
+ }
+
+ @Override
+ public int getBufferSize() {
+ return getHttpServletResponse().getBufferSize();
+ }
+
+ public CacheControl getCacheControl() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("This method needs to be implemented.");
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ return getHttpServletResponse().getCharacterEncoding();
+ }
+
+ @Override
+ public String getContentType() {
+ return getHttpServletResponse().getContentType();
+ }
+
+ @Override
+ public Locale getLocale() {
+ return getHttpServletResponse().getLocale();
+ }
+
+ /**
+ * @see PortletResponseImpl#getOutputStream()
+ * @see #getWriter()
+ */
+ public OutputStream getPortletOutputStream() throws IOException {
+ if (currentContentType == null) {
+ String message = EXCEPTIONS.getString("error.contenttype.null");
+ if (LOG.isWarnEnabled()) {
+ LOG.warn("Current content type is not set.");
+ }
+ throw new IllegalStateException(message);
+ }
+ return super.getOutputStream();
+ }
+
+ /**
+ * @see PortletResponseImpl#getWriter()
+ * @see #getPortletOutputStream()
+ */
+ @Override
+ public PrintWriter getWriter() throws IOException, IllegalStateException {
+ if (currentContentType == null) {
+ String message = EXCEPTIONS.getString("error.contenttype.null");
+ if (LOG.isWarnEnabled()) {
+ LOG.warn("Current content type is not set.");
+ }
+ throw new IllegalStateException(message);
+ }
+ return super.getWriter();
+ }
+
+ @Override
+ public boolean isCommitted() {
+ return getHttpServletResponse().isCommitted();
+ }
+
+ @Override
+ public void reset() {
+ getHttpServletResponse().reset();
+ }
+
+ @Override
+ public void resetBuffer() {
+ getHttpServletResponse().resetBuffer();
+ }
+
+ @Override
+ public void setBufferSize(int size) {
+ getHttpServletResponse().setBufferSize(size);
+ }
+
+ @Override
+ public void setContentType(String contentType)
+ throws IllegalArgumentException {
+
+ if (super.isIncluded()){
+ //no operation
+ }
+ else{
+ ArgumentUtility.validateNotNull("contentType", contentType);
+ String mimeType = StringUtils.getMimeTypeWithoutEncoding(contentType);
+ if (!isValidContentType(mimeType)) {
+ throw new IllegalArgumentException("Specified content type '"
+ + mimeType + "' is not supported.");
+ }
+ getHttpServletResponse().setContentType(mimeType);
+ this.currentContentType = mimeType;
+ }
+ }
+
+ // access to a limited set of HttpServletResponse methods ------------------
+
+ @Override
+ public void addDateHeader(String arg0, long arg1) {
+ if (super.isIncluded()){
+ //no operation
+ }
+ else if (super.isForwarded()){
+ super.addProperty(arg0, Long.toString(arg1));
+ }
+ else
+ super.addDateHeader(arg0, arg1);
+ }
+
+ @Override
+ public void addHeader(String arg0, String arg1) {
+ if (super.isIncluded()){
+ //no operation
+ }
+ else if (super.isForwarded()){
+ super.addProperty(arg0, arg1);
+ }
+ else
+ super.addHeader(arg0, arg1);
+ }
+
+ @Override
+ public void addIntHeader(String arg0, int arg1) {
+ if (super.isIncluded()){
+ //no operation
+ }
+ else if (super.isForwarded()){
+ super.addProperty(arg0, Integer.toString(arg1));
+ }
+ else
+ super.addIntHeader(arg0, arg1);
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IllegalStateException, IOException {
+ if (super.isIncluded() || super.isForwarded()){
+ return (ServletOutputStream)getPortletOutputStream();
+ }
+ else
+ return super.getOutputStream();
+ }
+
+ @Override
+ public void sendRedirect(String arg0) throws IOException {
+ if (super.isIncluded() || super.isForwarded()){
+ // no operation
+ }
+ else
+ super.sendRedirect(arg0);
+ }
+
+ @Override
+ public void setDateHeader(String arg0, long arg1) {
+ if (super.isIncluded()){
+ //no operation
+ }
+ else if (super.isForwarded()){
+ super.setProperty(arg0, Long.toString(arg1));
+ }
+ else
+ super.setDateHeader(arg0, arg1);
+ }
+
+ @Override
+ public void setHeader(String arg0, String arg1) {
+ if (super.isIncluded()){
+ //no operation
+ }
+ else if (super.isForwarded()){
+ super.setProperty(arg0, arg1);
+ }
+ else
+ super.setHeader(arg0, arg1);
+ }
+
+ @Override
+ public void setIntHeader(String arg0, int arg1) {
+ if (super.isIncluded()){
+ //no operation
+ }
+ else if (super.isForwarded()){
+ super.setProperty(arg0, Integer.toString(arg1));
+ }
+ else
+ super.setIntHeader(arg0, arg1);
+ }
+
+ @Override
+ public void setStatus(int arg0, String arg1) {
+ if (super.isIncluded()){
+ //no operation
+ }
+ else if (super.isForwarded()){
+ super.setProperty(arg1, Integer.toString(arg0));
+ }
+ else
+ super.setStatus(arg0, arg1);
+ }
+
+ @Override
+ public void setStatus(int arg0) {
+ if (super.isIncluded()){
+ //no operation
+ }
+ else if (super.isForwarded()){
+ super.setProperty("STATUS", Integer.toString(arg0));
+ }
+ else
+ super.setStatus(arg0);
+ }
+
+
+ // Private Methods ---------------------------------------------------------
+
+ /**
+ * Checks if the specified content type is valid (supported by the portlet).
+ * The specified content type should be a tripped mime type without any
+ * character encoding suffix.
+ * @param contentType the content type to check.
+ * @return true if the content type is valid, false otherwise.
+ */
+ private boolean isValidContentType(String contentType) {
+ boolean valid = false;
+
+ PortletDD portletDD = getInternalPortletWindow().getPortletEntity()
+ .getPortletDefinition();
+ for (Iterator it = portletDD.getSupports().iterator();
+ !valid && it.hasNext(); ) {
+
+ SupportsDD supportsDD = (SupportsDD) it.next();
+ String supportedType = supportsDD.getMimeType();
+
+ // Content type is supported by an exact match.
+ if (supportedType.equals(contentType)) {
+ valid = true;
+ }
+ // The supported type contains a wildcard.
+ else if (supportedType.indexOf("*") >= 0) {
+
+ int index = supportedType.indexOf("/");
+ String supportedPrefix = supportedType.substring(0, index);
+ String supportedSuffix = supportedType.substring(index + 1);
+
+ index = contentType.indexOf("/");
+ String typePrefix = contentType.substring(0, index);
+ String typeSuffix = contentType.substring(index + 1);
+
+ // Check if the prefixes match AND the suffixes match.
+ if (supportedPrefix.equals("*") || supportedPrefix.equals(typePrefix)) {
+ if (supportedSuffix.equals("*") || supportedSuffix.equals(typeSuffix)) {
+ valid = true;
+ }
+ }
+ }
+ }
+ // Return the check result.
+ return valid;
+ }
+}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java?rev=572581&r1=572580&r2=572581&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java Tue Sep 4 01:38:42 2007
@@ -282,6 +282,27 @@
return validNamespace.toString();
}
+ @Override
+ public void addCookie(Cookie arg0) {
+ if (isIncluded()){
+ //no operation
+ }
+ else if (isForwarded()){
+ addProperty(arg0);
+ }
+ else
+ super.addCookie(arg0);
+ }
+
+ @Override
+ public boolean containsHeader(String arg0) {
+ if (isForwarded() || isIncluded()){
+ return false;
+ }
+ else
+ return super.containsHeader(arg0);
+ }
+
@Override
public String encodeRedirectUrl(String arg0) {
if (isForwarded() || isIncluded()){
@@ -338,12 +359,5 @@
this.forwarded = forwared;
}
-
- public int getBufferSize() {
- // TODO: return this.getHttpServletResponse().getBufferSize();
- return 0;
- }
-
-
-
+
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java?rev=572581&r1=572580&r2=572581&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java Tue Sep 4 01:38:42 2007
@@ -16,34 +16,18 @@
*/
package org.apache.pluto.internal.impl;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
import java.util.Collection;
-import java.util.Enumeration;
-import java.util.Iterator;
import java.util.Locale;
-import javax.portlet.CacheControl;
import javax.portlet.PortletMode;
import javax.portlet.RenderResponse;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.pluto.PortletContainer;
-import org.apache.pluto.descriptors.portlet.PortletDD;
-import org.apache.pluto.descriptors.portlet.SupportsDD;
import org.apache.pluto.internal.InternalPortletWindow;
import org.apache.pluto.internal.InternalRenderResponse;
import org.apache.pluto.spi.PortalCallbackService;
-import org.apache.pluto.util.ArgumentUtility;
-import org.apache.pluto.util.StringManager;
-import org.apache.pluto.util.StringUtils;
-import org.w3c.dom.Element;
/**
* Implementation of the <code>javax.portlet.RenderResponse</code> interface.
@@ -51,25 +35,9 @@
* @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
* @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
*/
-public class RenderResponseImpl extends PortletResponseImpl
+public class RenderResponseImpl extends MimeResponseImpl
implements RenderResponse, InternalRenderResponse {
- /** Logger. */
- private static final Log LOG = LogFactory.getLog(RenderResponseImpl.class);
-
- private static final StringManager EXCEPTIONS = StringManager.getManager(
- RenderResponseImpl.class.getPackage().getName());
-
-
- // Private Member Variables ------------------------------------------------
-
-
-
- /** The current content type. */
- private String currentContentType = null;
-
- // Constructor -------------------------------------------------------------
-
public RenderResponseImpl(PortletContainer container,
InternalPortletWindow internalPortletWindow,
HttpServletRequest servletRequest,
@@ -77,10 +45,6 @@
super(container, internalPortletWindow, servletRequest, servletResponse);
}
-
- // RenderResponse Impl -----------------------------------------------------
-
-
public void setTitle(String title) {
PortalCallbackService callback = getContainer()
@@ -91,315 +55,13 @@
title);
}
- public void setContentType(String contentType)
- throws IllegalArgumentException {
- if (super.isIncluded()){
- //no operation
- }
- else{
- ArgumentUtility.validateNotNull("contentType", contentType);
- String mimeType = StringUtils.getMimeTypeWithoutEncoding(contentType);
- if (!isValidContentType(mimeType)) {
- throw new IllegalArgumentException("Specified content type '"
- + mimeType + "' is not supported.");
- }
- getHttpServletResponse().setContentType(mimeType);
- this.currentContentType = mimeType;
- }
- }
-
-
-
- /**
- * @see PortletResponseImpl#getOutputStream()
- * @see #getWriter()
- */
- public OutputStream getPortletOutputStream()
- throws IOException, IllegalStateException {
- if (currentContentType == null) {
- String message = EXCEPTIONS.getString("error.contenttype.null");
- if (LOG.isWarnEnabled()) {
- LOG.warn("Current content type is not set.");
- }
- throw new IllegalStateException(message);
- }
- return super.getOutputStream();
- }
-
-
- // Private Methods ---------------------------------------------------------
-
- /**
- * Checks if the specified content type is valid (supported by the portlet).
- * The specified content type should be a tripped mime type without any
- * character encoding suffix.
- * @param contentType the content type to check.
- * @return true if the content type is valid, false otherwise.
- */
- private boolean isValidContentType(String contentType) {
- boolean valid = false;
-
- PortletDD portletDD = getInternalPortletWindow().getPortletEntity()
- .getPortletDefinition();
- for (Iterator it = portletDD.getSupports().iterator();
- !valid && it.hasNext(); ) {
-
- SupportsDD supportsDD = (SupportsDD) it.next();
- String supportedType = supportsDD.getMimeType();
-
- // Content type is supported by an exact match.
- if (supportedType.equals(contentType)) {
- valid = true;
- }
- // The supported type contains a wildcard.
- else if (supportedType.indexOf("*") >= 0) {
-
- int index = supportedType.indexOf("/");
- String supportedPrefix = supportedType.substring(0, index);
- String supportedSuffix = supportedType.substring(index + 1);
-
- index = contentType.indexOf("/");
- String typePrefix = contentType.substring(0, index);
- String typeSuffix = contentType.substring(index + 1);
-
- // Check if the prefixes match AND the suffixes match.
- if (supportedPrefix.equals("*") || supportedPrefix.equals(typePrefix)) {
- if (supportedSuffix.equals("*") || supportedSuffix.equals(typeSuffix)) {
- valid = true;
- }
- }
- }
- }
- // Return the check result.
- return valid;
- }
-
- /**
- * Gets implementation of JSR-286 <code>CacheControl</code>.
- *
- * @since 2.0
- */
- public CacheControl getCacheControl() {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException("This method needs to be implemented.");
- }
-
-
public void setNextPossiblePortletModes(Collection<PortletMode> portletModes) {
//TODO Auto-generated method stub
throw new UnsupportedOperationException("This method needs to be implemented.");
}
- /////////////////////////////////////////////////////////////////////////
- //////neu
- /////////////////////////////////////////////////////////////////////////
-
- public String getContentType() {
- return super.getHttpServletResponse().getContentType();
- }
-
- public String getCharacterEncoding() {
- return getHttpServletResponse().getCharacterEncoding();
- }
-
- /**
- * @see PortletResponseImpl#getWriter()
- * @see #getPortletOutputStream()
- */
- @Override
- public PrintWriter getWriter() throws IOException, IllegalStateException {
- if (currentContentType == null) {
- String message = EXCEPTIONS.getString("error.contenttype.null");
- if (LOG.isWarnEnabled()) {
- LOG.warn("Current content type is not set.");
- }
- throw new IllegalStateException(message);
- }
- return super.getWriter();
- }
-
- public Locale getLocale() {
- return getHttpServletRequest().getLocale();
- }
-
- @Override
- public void setBufferSize(int size) {
- super.getHttpServletResponse().setBufferSize(size);
- }
-
- @Override
- public int getBufferSize() {
- return this.getHttpServletResponse().getBufferSize();
- }
-
- @Override
- public void flushBuffer() throws IOException {
- getHttpServletResponse().flushBuffer();
- }
-
- @Override
- public void resetBuffer() {
- getHttpServletResponse().resetBuffer();
- }
-
- @Override
- public boolean isCommitted() {
- return getHttpServletResponse().isCommitted();
- }
-
- @Override
- public void reset() {
- getHttpServletResponse().reset();
- }
@Override
- public ServletOutputStream getOutputStream() throws IllegalStateException, IOException {
- if (super.isIncluded() || super.isForwarded()){
- return (ServletOutputStream)getPortletOutputStream();
- }
- else
- return super.getOutputStream();
- }
-
-
- @Override
- public void addCookie(Cookie arg0) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.addProperty(arg0);
- }
- else
- super.addCookie(arg0);
- }
-
-
- @Override
- public void addDateHeader(String arg0, long arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.addProperty(arg0, Long.toString(arg1));
- }
- else
- super.addDateHeader(arg0, arg1);
- }
-
-
- @Override
- public void addHeader(String arg0, String arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.addProperty(arg0, arg1);
- }
- else
- super.addHeader(arg0, arg1);
- }
-
-
- @Override
- public void addIntHeader(String arg0, int arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.addProperty(arg0, Integer.toString(arg1));
- }
- else
- super.addIntHeader(arg0, arg1);
- }
-
-
- @Override
- public boolean containsHeader(String arg0) {
- if (super.isIncluded() || super.isForwarded()){
- return false;
- }
- return super.containsHeader(arg0);
- }
-
- // Included HttpServletResponse (Limited) Impl -----------------------------
-
- @Override
- public void sendRedirect(String arg0) throws IOException {
- if (super.isIncluded() || super.isForwarded()){
- // no operation
- }
- else
- super.sendRedirect(arg0);
- }
-
-
- @Override
- public void setDateHeader(String arg0, long arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.setProperty(arg0, Long.toString(arg1));
- }
- else
- super.setDateHeader(arg0, arg1);
- }
-
-
- @Override
- public void setHeader(String arg0, String arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.setProperty(arg0, arg1);
- }
- else
- super.setHeader(arg0, arg1);
- }
-
-
- @Override
- public void setIntHeader(String arg0, int arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.setProperty(arg0, Integer.toString(arg1));
- }
- else
- super.setIntHeader(arg0, arg1);
- }
-
-
- @Override
- public void setStatus(int arg0, String arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.setProperty(arg1, Integer.toString(arg0));
- }
- else
- super.setStatus(arg0, arg1);
- }
-
-
- @Override
- public void setStatus(int arg0) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.setProperty("STATUS", Integer.toString(arg0));
- }
- else
- super.setStatus(arg0);
- }
-
-
- @Override
public void setCharacterEncoding(String arg0) {
if (super.isIncluded() || super.isForwarded()){
//no operation
@@ -408,7 +70,6 @@
super.setCharacterEncoding(arg0);
}
-
@Override
public void setContentLength(int arg0) {
if (super.isIncluded() || super.isForwarded()){
@@ -418,7 +79,6 @@
super.setContentLength(arg0);
}
-
@Override
public void setLocale(Locale arg0) {
if (super.isIncluded() || super.isForwarded()){
@@ -427,7 +87,5 @@
else
super.setLocale(arg0);
}
-
-
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java?rev=572581&r1=572580&r2=572581&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java Tue Sep 4 01:38:42 2007
@@ -16,46 +16,19 @@
*/
package org.apache.pluto.internal.impl;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.Iterator;
import java.util.Locale;
-import javax.portlet.CacheControl;
-import javax.portlet.PortalContext;
import javax.portlet.ResourceResponse;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.pluto.PortletContainer;
-import org.apache.pluto.descriptors.portlet.PortletDD;
-import org.apache.pluto.descriptors.portlet.SupportsDD;
import org.apache.pluto.internal.InternalPortletWindow;
import org.apache.pluto.internal.InternalResourceResponse;
-import org.apache.pluto.spi.PortalCallbackService;
-import org.apache.pluto.util.ArgumentUtility;
-import org.apache.pluto.util.StringManager;
-import org.apache.pluto.util.StringUtils;
-public class ResourceResponseImpl extends StateAwareResponseImpl
+public class ResourceResponseImpl extends MimeResponseImpl
implements ResourceResponse, InternalResourceResponse {
- /** Logger. */
- private static final Log LOG = LogFactory.getLog(ResourceResponseImpl.class);
-
- private static final StringManager EXCEPTIONS = StringManager.getManager(
- ResourceResponseImpl.class.getPackage().getName());
-
- private PortalCallbackService callback;
- private PortalContext context;
-
- /** The current content type. */
- private String currentContentType = null;
public ResourceResponseImpl(PortletContainer container,
InternalPortletWindow internalPortletWindow,
@@ -63,306 +36,9 @@
HttpServletResponse servletResponse) {
super(container, internalPortletWindow, servletRequest,
servletResponse);
- context = container.getRequiredContainerServices().getPortalContext();
- callback = container.getRequiredContainerServices().getPortalCallbackService();
- }
-
-
- public CacheControl getCacheControl() {
- // TODO Auto-generated method stub
-// return null;
- throw new UnsupportedOperationException("This method needs to be implemented");
- }
-
- public OutputStream getPortletOutputStream() throws IOException {
- if (currentContentType == null) {
- String message = EXCEPTIONS.getString("error.contenttype.null");
- if (LOG.isWarnEnabled()) {
- LOG.warn("Current content type is not set.");
- }
- throw new IllegalStateException(message);
- }
- return super.getOutputStream();
- }
-
-
- public void setTitle(String arg0) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException("This method needs to be implemented");
- }
-
- /////////////////////////////////////////////////////////////////////////
- //////neu
- /////////////////////////////////////////////////////////////////////////
-
- public String getContentType() {
- return super.getHttpServletResponse().getContentType();
- }
-
- public String getCharacterEncoding() {
- return getHttpServletResponse().getCharacterEncoding();
- }
-
- /**
- * @see PortletResponseImpl#getWriter()
- * @see #getPortletOutputStream()
- */
- @Override
- public PrintWriter getWriter() throws IOException, IllegalStateException {
- if (currentContentType == null) {
- String message = EXCEPTIONS.getString("error.contenttype.null");
- if (LOG.isWarnEnabled()) {
- LOG.warn("Current content type is not set.");
- }
- throw new IllegalStateException(message);
- }
- return super.getWriter();
- }
-
- public void setContentType(String contentType)
- throws IllegalArgumentException {
- if (super.isIncluded()){
- //no operation
- }
- else{
- ArgumentUtility.validateNotNull("contentType", contentType);
- String mimeType = StringUtils.getMimeTypeWithoutEncoding(contentType);
- if (!isValidContentType(mimeType)) {
- throw new IllegalArgumentException("Specified content type '"
- + mimeType + "' is not supported.");
- }
- getHttpServletResponse().setContentType(mimeType);
- this.currentContentType = mimeType;
- }
- }
-
- /**
- * Checks if the specified content type is valid (supported by the portlet).
- * The specified content type should be a tripped mime type without any
- * character encoding suffix.
- * @param contentType the content type to check.
- * @return true if the content type is valid, false otherwise.
- */
- private boolean isValidContentType(String contentType) {
- boolean valid = false;
-
- PortletDD portletDD = getInternalPortletWindow().getPortletEntity()
- .getPortletDefinition();
- for (Iterator it = portletDD.getSupports().iterator();
- !valid && it.hasNext(); ) {
-
- SupportsDD supportsDD = (SupportsDD) it.next();
- String supportedType = supportsDD.getMimeType();
-
- // Content type is supported by an exact match.
- if (supportedType.equals(contentType)) {
- valid = true;
- }
- // The supported type contains a wildcard.
- else if (supportedType.indexOf("*") >= 0) {
-
- int index = supportedType.indexOf("/");
- String supportedPrefix = supportedType.substring(0, index);
- String supportedSuffix = supportedType.substring(index + 1);
-
- index = contentType.indexOf("/");
- String typePrefix = contentType.substring(0, index);
- String typeSuffix = contentType.substring(index + 1);
-
- // Check if the prefixes match AND the suffixes match.
- if (supportedPrefix.equals("*") || supportedPrefix.equals(typePrefix)) {
- if (supportedSuffix.equals("*") || supportedSuffix.equals(typeSuffix)) {
- valid = true;
- }
- }
- }
- }
- // Return the check result.
- return valid;
- }
-
- public Locale getLocale() {
- return getHttpServletRequest().getLocale();
- }
-
- @Override
- public void setBufferSize(int size) {
- super.getHttpServletResponse().setBufferSize(size);
- }
-
- @Override
- public int getBufferSize() {
- return this.getHttpServletResponse().getBufferSize();
- }
-
- @Override
- public void flushBuffer() throws IOException {
- getHttpServletResponse().flushBuffer();
- }
-
- @Override
- public void resetBuffer() {
- getHttpServletResponse().resetBuffer();
- }
-
- @Override
- public boolean isCommitted() {
- return getHttpServletResponse().isCommitted();
- }
-
- @Override
- public void reset() {
- getHttpServletResponse().reset();
}
@Override
- public ServletOutputStream getOutputStream() throws IllegalStateException, IOException {
- if (super.isIncluded() || super.isForwarded()){
- return (ServletOutputStream)getPortletOutputStream();
- }
- else
- return super.getOutputStream();
- }
-
-
- @Override
- public void addCookie(Cookie arg0) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.addProperty(arg0);
- }
- else
- super.addCookie(arg0);
- }
-
-
- @Override
- public void addDateHeader(String arg0, long arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.addProperty(arg0, Long.toString(arg1));
- }
- else
- super.addDateHeader(arg0, arg1);
- }
-
-
- @Override
- public void addHeader(String arg0, String arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.addProperty(arg0, arg1);
- }
- else
- super.addHeader(arg0, arg1);
- }
-
-
- @Override
- public void addIntHeader(String arg0, int arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.addProperty(arg0, Integer.toString(arg1));
- }
- else
- super.addIntHeader(arg0, arg1);
- }
-
-
- @Override
- public boolean containsHeader(String arg0) {
- if (super.isIncluded() || super.isForwarded()){
- return false;
- }
- return super.containsHeader(arg0);
- }
-
- // Included HttpServletResponse (Limited) Impl -----------------------------
-
- @Override
- public void sendRedirect(String arg0) throws IOException {
- if (super.isIncluded() || super.isForwarded()){
- // no operation
- }
- else
- super.sendRedirect(arg0);
- }
-
-
- @Override
- public void setDateHeader(String arg0, long arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.setProperty(arg0, Long.toString(arg1));
- }
- else
- super.setDateHeader(arg0, arg1);
- }
-
-
- @Override
- public void setHeader(String arg0, String arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.setProperty(arg0, arg1);
- }
- else
- super.setHeader(arg0, arg1);
- }
-
-
- @Override
- public void setIntHeader(String arg0, int arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.setProperty(arg0, Integer.toString(arg1));
- }
- else
- super.setIntHeader(arg0, arg1);
- }
-
-
- @Override
- public void setStatus(int arg0, String arg1) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.setProperty(arg1, Integer.toString(arg0));
- }
- else
- super.setStatus(arg0, arg1);
- }
-
-
- @Override
- public void setStatus(int arg0) {
- if (super.isIncluded()){
- //no operation
- }
- else if (super.isForwarded()){
- super.setProperty("STATUS", Integer.toString(arg0));
- }
- else
- super.setStatus(arg0);
- }
-
-
- @Override
public void setCharacterEncoding(String arg0) {
if (super.isIncluded()){
//no operation
@@ -371,7 +47,6 @@
super.setCharacterEncoding(arg0);
}
-
@Override
public void setContentLength(int arg0) {
if (super.isIncluded()){
@@ -381,7 +56,6 @@
super.setContentLength(arg0);
}
-
@Override
public void setLocale(Locale arg0) {
if (super.isIncluded()){
@@ -390,4 +64,5 @@
else
super.setLocale(arg0);
}
+
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java?rev=572581&r1=572580&r2=572581&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java Tue Sep 4 01:38:42 2007
@@ -17,6 +17,7 @@
package org.apache.pluto.internal.impl;
import java.io.IOException;
+import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.io.Writer;
@@ -25,6 +26,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.ArrayList;
@@ -36,6 +38,7 @@
import javax.portlet.WindowState;
import javax.portlet.WindowStateException;
import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@@ -461,6 +464,216 @@
// TODO Auto-generated method stub
throw new UnsupportedOperationException("This method needs to be implemented.");
}
+
+ // access to a limited set of HttpServletResponse methods ------------------
+
+ @Override
+ public void reset() {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.reset();
+ }
+
+ @Override
+ public void resetBuffer() {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.resetBuffer();
+ }
+
+ @Override
+ public void setBufferSize(int arg0) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.setBufferSize(arg0);
+ }
+
+ @Override
+ public void setCharacterEncoding(String arg0) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.setCharacterEncoding(arg0);
+ }
+
+ @Override
+ public void setContentLength(int arg0) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.setContentLength(arg0);
+ }
+
+ @Override
+ public void setContentType(String arg0) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.setContentType(arg0);
+ }
+
+ @Override
+ public void setLocale(Locale arg0) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.setLocale(arg0);
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IllegalStateException, IOException {
+ if (super.isForwarded() || super.isIncluded()){
+ return null;
+ }
+ else
+ return super.getOutputStream();
+ }
+
+ @Override
+ public PrintWriter getWriter() throws IllegalStateException, IOException {
+ if (super.isForwarded() || super.isIncluded()){
+ return null;
+ }
+ else
+ return super.getWriter();
+ }
+
+ @Override
+ public void addDateHeader(String arg0, long arg1) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.addDateHeader(arg0, arg1);
+ }
+
+ @Override
+ public void addHeader(String arg0, String arg1) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.addHeader(arg0, arg1);
+ }
+
+ @Override
+ public void addIntHeader(String arg0, int arg1) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.addIntHeader(arg0, arg1);
+ }
+
+ @Override
+ public void setStatus(int arg0, String arg1) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.setStatus(arg0, arg1);
+ }
+
+ @Override
+ public void setDateHeader(String arg0, long arg1) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.setDateHeader(arg0, arg1);
+ }
+
+ @Override
+ public void setHeader(String arg0, String arg1) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.setHeader(arg0, arg1);
+ }
+
+ @Override
+ public void setIntHeader(String arg0, int arg1) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.setIntHeader(arg0, arg1);
+ }
+
+ @Override
+ public void setStatus(int arg0) {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.setStatus(arg0);
+ }
+
+ @Override
+ public void flushBuffer() throws IOException {
+ if (super.isForwarded() || super.isIncluded()){
+ // no operation
+ }
+ else
+ super.flushBuffer();
+ }
+
+ @Override
+ public int getBufferSize() {
+ if (super.isForwarded() || super.isIncluded()){
+ return 0;
+ }
+ else
+ return super.getBufferSize();
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ if (super.isForwarded() || super.isIncluded()){
+ return null;
+ }
+ else
+ return super.getCharacterEncoding();
+ }
+
+ @Override
+ public String getContentType() {
+ if (super.isForwarded() || super.isIncluded()){
+ return null;
+ }
+ else
+ return super.getContentType();
+ }
+
+ @Override
+ public Locale getLocale() {
+ if (super.isForwarded() || super.isIncluded()){
+ return null;
+ }
+ else
+ return super.getLocale();
+ }
+
+ @Override
+ public boolean isCommitted() {
+ if (super.isForwarded() || super.isIncluded()){
+ return true;
+ }
+ else
+ return super.isCommitted();
+ }
+
// Not in API anymore
// public void setDefaultNamspacedEvents(Map<String, Object> events) {