You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2008/01/22 02:07:10 UTC
svn commit: r614079 - in
/incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context:
EmptyResponseContext.java MediaResponseContext.java
Author: jmsnell
Date: Mon Jan 21 17:07:10 2008
New Revision: 614079
URL: http://svn.apache.org/viewvc?rev=614079&view=rev
Log:
more logical organization and reuse
Modified:
incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context/EmptyResponseContext.java
incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context/MediaResponseContext.java
Modified: incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context/EmptyResponseContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context/EmptyResponseContext.java?rev=614079&r1=614078&r2=614079&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context/EmptyResponseContext.java (original)
+++ incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context/EmptyResponseContext.java Mon Jan 21 17:07:10 2008
@@ -18,12 +18,9 @@
package org.apache.abdera.protocol.server.context;
import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.abdera.writer.Writer;
public final class EmptyResponseContext
- extends AbstractResponseContext {
+ extends SimpleResponseContext {
public EmptyResponseContext(int status) {
setStatus(status);
@@ -33,18 +30,13 @@
setStatus(status);
setStatusText(text);
}
-
+
+ protected void writeEntity(
+ java.io.Writer writer)
+ throws IOException {}
+
public boolean hasEntity() {
return false;
}
-
- public void writeTo(OutputStream out)
- throws IOException {}
-
- public void writeTo(OutputStream out, Writer writer) throws IOException {}
-
- public void writeTo(java.io.Writer javaWriter, Writer abderaWriter) throws IOException {}
-
- public void writeTo(java.io.Writer javaWriter) throws IOException {}
-
+
}
Modified: incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context/MediaResponseContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context/MediaResponseContext.java?rev=614079&r1=614078&r2=614079&view=diff
==============================================================================
--- incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context/MediaResponseContext.java (original)
+++ incubator/abdera/java/branches/server_refactor/src/main/java/org/apache/abdera/protocol/server/context/MediaResponseContext.java Mon Jan 21 17:07:10 2008
@@ -34,7 +34,7 @@
* ResponseContext implementation for arbitrary media resources
*/
public class MediaResponseContext
- extends AbstractResponseContext {
+ extends SimpleResponseContext {
private InputStream in;
@@ -110,17 +110,19 @@
public void writeTo(
OutputStream out)
throws IOException {
- if (in != null) {
- byte[] buf = new byte[500];
- int r = -1;
- while ((r = in.read(buf)) != -1) {
- out.write(buf,0,r);
- buf = new byte[100];
+ if (hasEntity()) {
+ if (in != null) {
+ byte[] buf = new byte[500];
+ int r = -1;
+ while ((r = in.read(buf)) != -1) {
+ out.write(buf,0,r);
+ buf = new byte[100];
+ }
}
}
}
- public void writeTo(
+ protected void writeEntity(
Writer out)
throws IOException {
if (in != null) {
@@ -132,20 +134,6 @@
buf = new char[100];
}
}
- }
-
- public void writeTo(
- OutputStream out,
- org.apache.abdera.writer.Writer writer)
- throws IOException {
- throw new UnsupportedOperationException();
- }
-
- public void writeTo(
- Writer javaWriter,
- org.apache.abdera.writer.Writer abderaWriter)
- throws IOException {
- throw new UnsupportedOperationException();
}
}