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/12/31 08:23:49 UTC
svn commit: r607691 - in
/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto:
internal/impl/ util/
Author: dettborn
Date: Sun Dec 30 23:23:47 2007
New Revision: 607691
URL: http://svn.apache.org/viewvc?rev=607691&view=rev
Log:
some small changes for the RequestDispatcher,
for dispachting in an action or event i have added a dummyPrintWriter, because you have do get the writer, but you are not allowed to write anything out.
Added:
portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/util/DummyPrintWriter.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/util/DummyServletOutputStream.java
Modified:
portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionRequestImpl.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionRequestImpl.java?rev=607691&r1=607690&r2=607691&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionRequestImpl.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionRequestImpl.java Sun Dec 30 23:23:47 2007
@@ -114,7 +114,7 @@
public int getContentLength() {
- return (super.isIncluded()) ? 0 : super.getContentLength();
+ return super.getContentLength();
}
public ServletInputStream getInputStream() throws IOException {
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java?rev=607691&r1=607690&r2=607691&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java Sun Dec 30 23:23:47 2007
@@ -885,7 +885,7 @@
public Cookie[] getCookies() {
if (isIncluded() || isForwarded()){
// TODO:return Cookies from properties
- return null;
+ return super.getCookies();
}
else
return super.getCookies();
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java?rev=607691&r1=607690&r2=607691&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderResponseImpl.java Sun Dec 30 23:23:47 2007
@@ -25,7 +25,6 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.pluto.PortletContainer;
-import org.apache.pluto.internal.Configuration;
import org.apache.pluto.internal.InternalPortletWindow;
import org.apache.pluto.internal.InternalRenderResponse;
import org.apache.pluto.spi.PortalCallbackService;
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java?rev=607691&r1=607690&r2=607691&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java Sun Dec 30 23:23:47 2007
@@ -69,11 +69,7 @@
@Override
public int getBufferSize() {
- if (super.isForwarded() || super.isIncluded()){
- return 0;
- }
- else
- return getHttpServletResponse().getBufferSize();
+ return 0;
}
@Override
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java?rev=607691&r1=607690&r2=607691&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java Sun Dec 30 23:23:47 2007
@@ -49,6 +49,8 @@
import org.apache.pluto.spi.EventProvider;
import org.apache.pluto.spi.PortalCallbackService;
import org.apache.pluto.spi.ResourceURLProvider;
+import org.apache.pluto.util.DummyPrintWriter;
+import org.apache.pluto.util.DummyServletOutputStream;
import org.apache.pluto.util.StringUtils;
/**
@@ -151,6 +153,8 @@
}
location =
redirectResponse.encodeRedirectURL(provider.toString());
+ if (location.indexOf("/") == -1)
+ throw new IllegalArgumentException("There is a relative path given, an IllegalArgumentException must be thrown.");
//redirectResponse.sendRedirect(location);
redirectLocation = location;
redirected = true;
@@ -439,7 +443,7 @@
@Override
public ServletOutputStream getOutputStream() throws IllegalStateException, IOException {
if (super.isForwarded() || super.isIncluded()){
- return null;
+ return new DummyServletOutputStream();
}
else
return super.getOutputStream();
@@ -448,7 +452,7 @@
@Override
public PrintWriter getWriter() throws IllegalStateException, IOException {
if (super.isForwarded() || super.isIncluded()){
- return null;
+ return new DummyPrintWriter(super.getWriter());
}
else
return super.getWriter();
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/util/DummyPrintWriter.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/util/DummyPrintWriter.java?rev=607691&view=auto
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/util/DummyPrintWriter.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/util/DummyPrintWriter.java Sun Dec 30 23:23:47 2007
@@ -0,0 +1,178 @@
+/*
+ * 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.util;
+
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Locale;
+
+public class DummyPrintWriter extends PrintWriter{
+
+ public DummyPrintWriter(Writer out) {
+ super(out);
+ }
+
+ @Override
+ public PrintWriter append(char c) {
+ return super.append(null);
+ }
+
+ @Override
+ public PrintWriter append(CharSequence csq, int start, int end) {
+ return super.append(null);
+ }
+
+ @Override
+ public PrintWriter append(CharSequence csq) {
+ return super.append(null);
+ }
+
+ @Override
+ public boolean checkError() {
+ return super.checkError();
+ }
+
+ @Override
+ public void close() {
+ }
+
+ @Override
+ public void flush() {
+ }
+
+ @Override
+ public PrintWriter format(Locale l, String format, Object... args) {
+ return super.format(null, null, null);
+ }
+
+ @Override
+ public PrintWriter format(String format, Object... args) {
+ return super.format(null, null);
+ }
+
+ @Override
+ public void print(boolean b) {
+ }
+
+ @Override
+ public void print(char c) {
+ }
+
+ @Override
+ public void print(char[] s) {
+ }
+
+ @Override
+ public void print(double d) {
+ }
+
+ @Override
+ public void print(float f) {
+ }
+
+ @Override
+ public void print(int i) {
+ }
+
+ @Override
+ public void print(long l) {
+ }
+
+ @Override
+ public void print(Object obj) {
+ }
+
+ @Override
+ public void print(String s) {
+ }
+
+ @Override
+ public PrintWriter printf(Locale l, String format, Object... args) {
+ return super.printf(null, null, null);
+ }
+
+ @Override
+ public PrintWriter printf(String format, Object... args) {
+ return super.printf(null, null);
+ }
+
+ @Override
+ public void println() {
+ }
+
+ @Override
+ public void println(boolean x) {
+ }
+
+ @Override
+ public void println(char x) {
+ }
+
+ @Override
+ public void println(char[] x) {
+ }
+
+ @Override
+ public void println(double x) {
+ }
+
+ @Override
+ public void println(float x) {
+ }
+
+ @Override
+ public void println(int x) {
+ }
+
+ @Override
+ public void println(long x) {
+ }
+
+ @Override
+ public void println(Object x) {
+ }
+
+ @Override
+ public void println(String x) {
+ }
+
+ @Override
+ protected void setError() {
+ super.setError();
+ }
+
+ @Override
+ public void write(char[] buf, int off, int len) {
+ }
+
+ @Override
+ public void write(char[] buf) {
+ }
+
+ @Override
+ public void write(int c) {
+ }
+
+ @Override
+ public void write(String s, int off, int len) {
+ }
+
+ @Override
+ public void write(String s) {
+ }
+
+}
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/util/DummyServletOutputStream.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/util/DummyServletOutputStream.java?rev=607691&view=auto
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/util/DummyServletOutputStream.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/util/DummyServletOutputStream.java Sun Dec 30 23:23:47 2007
@@ -0,0 +1,106 @@
+/*
+ * 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.util;
+
+import java.io.IOException;
+
+import javax.servlet.ServletOutputStream;
+
+public class DummyServletOutputStream extends ServletOutputStream{
+
+ @Override
+ public void write(int b) throws IOException {
+ }
+
+ @Override
+ public void print(boolean arg0) throws IOException {
+ }
+
+ @Override
+ public void print(char arg0) throws IOException {
+ }
+
+ @Override
+ public void print(double arg0) throws IOException {
+ }
+
+ @Override
+ public void print(float arg0) throws IOException {
+ }
+
+ @Override
+ public void print(int arg0) throws IOException {
+ }
+
+ @Override
+ public void print(long arg0) throws IOException {
+ }
+
+ @Override
+ public void print(String arg0) throws IOException {
+ }
+
+ @Override
+ public void println() throws IOException {
+ }
+
+ @Override
+ public void println(boolean arg0) throws IOException {
+ }
+
+ @Override
+ public void println(char arg0) throws IOException {
+ }
+
+ @Override
+ public void println(double arg0) throws IOException {
+ }
+
+ @Override
+ public void println(float arg0) throws IOException {
+ }
+
+ @Override
+ public void println(int arg0) throws IOException {
+ }
+
+ @Override
+ public void println(long arg0) throws IOException {
+ }
+
+ @Override
+ public void println(String arg0) throws IOException {
+ }
+
+ @Override
+ public void close() throws IOException {
+ }
+
+ @Override
+ public void flush() throws IOException {
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException {
+ }
+
+
+}