You are viewing a plain text version of this content. The canonical link for it is here.
Posted to droids-commits@incubator.apache.org by to...@apache.org on 2013/02/01 13:29:54 UTC

svn commit: r1441440 - /incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/ContentEntity.java

Author: tobr
Date: Fri Feb  1 13:29:54 2013
New Revision: 1441440

URL: http://svn.apache.org/viewvc?rev=1441440&view=rev
Log:
added charset

Modified:
    incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/ContentEntity.java

Modified: incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/ContentEntity.java
URL: http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/ContentEntity.java?rev=1441440&r1=1441439&r2=1441440&view=diff
==============================================================================
--- incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/ContentEntity.java (original)
+++ incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/core/ContentEntity.java Fri Feb  1 13:29:54 2013
@@ -32,16 +32,20 @@ import java.util.Set;
 public class ContentEntity {
     private Map<String, Object> data;
 
+    public final static String CHARSET = "charset";
     public final static String CONTENT = "content";
     public final static String CONTENT_TYPE = "content-type";
     public final static String CONTENT_LENGTH = "content-length";
     public final static String LINKS = "links";
 
+    public final static String DEFAULT_CHARSET = "UTF-8";
+
     /**
      * Constructor
      */
     public ContentEntity() {
         this.data = new HashMap<String, Object>();
+        setCharset(DEFAULT_CHARSET);
     }
 
     /**
@@ -144,6 +148,24 @@ public class ContentEntity {
     }
 
     /**
+     * Get the charset.
+     *
+     * @return the charset
+     */
+    public String getCharset() {
+        return this.getValue(CHARSET).toString();
+    }
+
+    /**
+     * Set the charset of the document.
+     *
+     * @param charset the charset
+     */
+    public void setCharset(String charset) {
+        this.put(CHARSET, charset);
+    }
+
+    /**
      * Get the content type.
      *
      * @return the content type
@@ -152,6 +174,7 @@ public class ContentEntity {
         return this.getValue(CONTENT_TYPE).toString();
     }
 
+
     /**
      * Set the content length
      *