abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r571829 - in /incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server: HttpResponse.java servlet/HttpResponseServletAdapter.java
Date Sat, 01 Sep 2007 17:19:11 GMT
Author: jmsnell
Date: Sat Sep  1 10:19:11 2007
New Revision: 571829

URL: http://svn.apache.org/viewvc?rev=571829&view=rev
Log:
Need a bit more expressiveness with the new HttpResponse.

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/HttpResponse.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/HttpResponseServletAdapter.java

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/HttpResponse.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/HttpResponse.java?rev=571829&r1=571828&r2=571829&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/HttpResponse.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/HttpResponse.java
Sat Sep  1 10:19:11 2007
@@ -15,4 +15,23 @@
 
   OutputStream getOutputStream() throws IOException;
 
+  void addCookie(String name, String value);
+
+  void addCookie(
+    String name, 
+    String value, 
+    String domain,
+    String path,
+    int maxage,
+    String comment);
+  
+  void setContentLength(int length);
+  
+  void sendError(int status) throws IOException;
+
+  void sendError(int status, String message) throws IOException;
+
+  void sendRedirect(String to) throws IOException;
+  
+  void reset();
 }

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/HttpResponseServletAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/HttpResponseServletAdapter.java?rev=571829&r1=571828&r2=571829&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/HttpResponseServletAdapter.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/HttpResponseServletAdapter.java
Sat Sep  1 10:19:11 2007
@@ -3,6 +3,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
+import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.abdera.protocol.server.HttpResponse;
@@ -35,4 +36,50 @@
     response.setStatus(status);
   }
 
+  public void addCookie(String name, String value) {
+    addCookie(name,value,null,null,-1,null);
+  }
+  
+  public void addCookie(
+    String name, 
+    String value, 
+    String domain,
+    String path,
+    int maxage,
+    String comment) {
+      Cookie cookie = new Cookie(name,value);
+      if (domain != null) cookie.setDomain(domain);
+      if (path != null) cookie.setPath(path);
+      if (maxage >= 0) cookie.setMaxAge(maxage);
+      if (comment != null) cookie.setComment(comment);
+      response.addCookie(cookie);
+  }
+  
+  public void setCharacterEncoding(String charset) {
+    response.setCharacterEncoding(charset);
+  }
+  
+  public void setContentLength(int length) {
+    response.setContentLength(length);
+  }
+
+  public void sendError(int status) throws IOException {
+    response.sendError(status);
+  }
+  
+  public void sendError(int status, String message) throws IOException {
+    response.sendError(status, message);
+  }
+  
+  public void sendRedirect(String to) throws IOException {
+    response.sendRedirect(to);
+  }
+  
+  public void reset() {
+    response.reset();
+  }
+  
+  public HttpServletResponse getActual() {
+    return response;
+  }
 }



Mime
View raw message