Author: agilliland
Date: Tue Jun 5 15:56:14 2007
New Revision: 544667
URL: http://svn.apache.org/viewvc?view=rev&rev=544667
Log:
code reformatting.
Modified:
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/ByteArrayOutputStreamWrapper.java
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/ByteArrayResponseWrapper.java
Modified:
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/ByteArrayOutputStreamWrapper.java
URL:
http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/ByteArrayOutputStreamWrapper.java?view=diff&rev=544667&r1=544666&r2=544667
==============================================================================
---
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/ByteArrayOutputStreamWrapper.java
(original)
+++
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/ByteArrayOutputStreamWrapper.java
Tue Jun 5 15:56:14 2007
@@ -1,83 +1,76 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. 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. For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. 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. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
package org.apache.roller.weblogger.ui.core.util;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
-
import javax.servlet.ServletOutputStream;
-/*
- * @author llavandowska
- *
+
+/**
* Implementation of ServletOutputStream that allows the filter to hold the
* Response content for insertion into the cache.
*/
-public class ByteArrayOutputStreamWrapper extends ServletOutputStream
-{
+public class ByteArrayOutputStreamWrapper extends ServletOutputStream {
+
protected OutputStream intStream;
protected ByteArrayOutputStream baStream;
protected boolean finallized = false;
protected boolean flushOnFinalizeOnly = true;
-
- public ByteArrayOutputStreamWrapper(OutputStream outStream)
- {
+
+
+ public ByteArrayOutputStreamWrapper(OutputStream outStream) {
intStream = outStream;
baStream = new ByteArrayOutputStream();
}
-
- public ByteArrayOutputStreamWrapper()
- {
+
+ public ByteArrayOutputStreamWrapper() {
intStream = System.out;
baStream = new ByteArrayOutputStream();
}
-
- public ByteArrayOutputStream getByteArrayStream()
- {
+
+
+ public ByteArrayOutputStream getByteArrayStream() {
return baStream;
}
-
- public void setFinallized()
- {
+
+ public void setFinallized() {
finallized = true;
}
-
- public boolean isFinallized()
- {
+
+ public boolean isFinallized() {
return finallized;
}
-
-
- public void write(int i) throws java.io.IOException
- {
+
+
+ public void write(int i) throws java.io.IOException {
baStream.write(i);
}
-
- public void close() throws java.io.IOException
- {
+
+ public void close() throws java.io.IOException {
if (finallized) {
processStream();
intStream.close();
}
}
-
- public void flush() throws java.io.IOException
- {
+
+ public void flush() throws java.io.IOException {
if (baStream.size() != 0) {
if (!flushOnFinalizeOnly || finallized) {
processStream();
@@ -85,15 +78,14 @@
}
}
}
-
- protected void processStream() throws java.io.IOException
- {
+
+ protected void processStream() throws java.io.IOException {
intStream.write(baStream.toByteArray());
intStream.flush();
}
- public void clear()
- {
+ public void clear() {
baStream = new ByteArrayOutputStream();
}
+
}
Modified:
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/ByteArrayResponseWrapper.java
URL:
http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/ByteArrayResponseWrapper.java?view=diff&rev=544667&r1=544666&r2=544667
==============================================================================
---
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/ByteArrayResponseWrapper.java
(original)
+++
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/ByteArrayResponseWrapper.java
Tue Jun 5 15:56:14 2007
@@ -1,70 +1,66 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. 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. For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. 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. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
package org.apache.roller.weblogger.ui.core.util;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
-
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
-/*
- * @author llavandowska
- *
+
+/**
* Implementation of HttpServletResponseWrapper.
*/
-public class ByteArrayResponseWrapper extends HttpServletResponseWrapper
-{
+public class ByteArrayResponseWrapper extends HttpServletResponseWrapper {
+
private PrintWriter tpWriter;
private ByteArrayOutputStreamWrapper tpStream;
-
- public ByteArrayResponseWrapper(ServletResponse inResp)
- throws java.io.IOException
- {
+
+
+ public ByteArrayResponseWrapper(ServletResponse inResp) throws IOException
{
super((HttpServletResponse) inResp);
tpStream = new ByteArrayOutputStreamWrapper(inResp.getOutputStream());
tpWriter = new PrintWriter(new OutputStreamWriter(tpStream,"UTF-8"));
}
-
- public ServletOutputStream getOutputStream()
- throws java.io.IOException
- {
+
+
+ public ServletOutputStream getOutputStream() throws IOException {
return tpStream;
}
-
- public PrintWriter getWriter() throws java.io.IOException
- {
+
+ public PrintWriter getWriter() throws IOException {
return tpWriter;
}
-
- /** Get a String representation of the entire buffer.
- */
- public String toString()
- {
+
+ /**
+ * Get a String representation of the entire buffer.
+ */
+ public String toString() {
return tpStream.getByteArrayStream().toString();
}
- public ByteArrayOutputStream getByteArrayOutputStream()
- throws java.io.IOException
- {
+ public ByteArrayOutputStream getByteArrayOutputStream() throws IOException
{
return tpStream.getByteArrayStream();
}
+
}