cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andr...@apache.org
Subject svn commit: r1215229 - /cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/TextResponse.java
Date Fri, 16 Dec 2011 17:16:33 GMT
Author: andreas
Date: Fri Dec 16 17:16:32 2011
New Revision: 1215229

URL: http://svn.apache.org/viewvc?rev=1215229&view=rev
Log:
Allow to set charset for TextResponse.

Modified:
    cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/TextResponse.java

Modified: cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/TextResponse.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/TextResponse.java?rev=1215229&r1=1215228&r2=1215229&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/TextResponse.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/TextResponse.java
Fri Dec 16 17:16:32 2011
@@ -32,6 +32,7 @@ public class TextResponse implements Res
 
     private String data, contentType;
     private int statusCode = 200;
+    private String charset;
 
     public TextResponse(String data, String contentType) {
         this.data = data;
@@ -53,7 +54,12 @@ public class TextResponse implements Res
     
     public void execute(OutputStream outputStream) throws Exception {
      // write the data to output
-        IOUtils.write(data, outputStream);
+        if (this.charset == null) {
+            IOUtils.write(data, outputStream);
+        }
+        else {
+            IOUtils.write(data, outputStream, this.charset);
+        }
     }
 
     public int getStatusCode() {
@@ -63,4 +69,12 @@ public class TextResponse implements Res
     public void setStatusCode(int statusCode) {
         this.statusCode = statusCode;
     }
+
+    public String getCharset() {
+        return charset;
+    }
+
+    public void setCharset(String charset) {
+        this.charset = charset;
+    }
 }



Mime
View raw message