chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1552825 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl: atompub/ browser/
Date Fri, 20 Dec 2013 22:12:39 GMT
Author: fmui
Date: Fri Dec 20 22:12:38 2013
New Revision: 1552825

URL: http://svn.apache.org/r1552825
Log:
code clean up

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AbstractBrowserServiceCall.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java?rev=1552825&r1=1552824&r2=1552825&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
Fri Dec 20 22:12:38 2013
@@ -68,6 +68,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
+import org.apache.chemistry.opencmis.commons.impl.IOUtils;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
 import org.apache.chemistry.opencmis.server.impl.ServerVersion;
@@ -293,10 +294,12 @@ public class CmisAtomPubServlet extends 
 
         try {
             response.resetBuffer();
-            PrintWriter pw = response.getWriter();
             response.setStatus(statusCode);
             response.setContentType("text/html");
-
+            response.setCharacterEncoding(IOUtils.UTF8);
+            
+            PrintWriter pw = response.getWriter();
+            
             pw.print("<html><head><title>Apache Chemistry OpenCMIS - "
                     + exceptionName
                     + " error</title>"

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AbstractBrowserServiceCall.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AbstractBrowserServiceCall.java?rev=1552825&r1=1552824&r2=1552825&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AbstractBrowserServiceCall.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AbstractBrowserServiceCall.java
Fri Dec 20 22:12:38 2013
@@ -19,6 +19,7 @@
 package org.apache.chemistry.opencmis.server.impl.browser;
 
 import java.io.IOException;
+import java.io.PrintWriter;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -130,22 +131,24 @@ public abstract class AbstractBrowserSer
             response.setContentType(JSON_MIME_TYPE);
             response.setCharacterEncoding(IOUtils.UTF8);
 
+            PrintWriter pw = response.getWriter();
+
             String callback = getStringParameter(request, Constants.PARAM_CALLBACK);
             if (callback != null) {
                 if (!callback.matches("[A-Za-z0-9._\\[\\]]*")) {
                     throw new CmisInvalidArgumentException("Invalid callback name!");
                 }
-                response.getWriter().print(callback + "(");
+                pw.print(callback + "(");
             }
 
-            json.writeJSONString(response.getWriter());
+            json.writeJSONString(pw);
 
             if (callback != null) {
-                response.getWriter().print(");");
+                pw.print(");");
             }
-        }
 
-        response.getWriter().flush();
+            pw.flush();
+        }
     }
 
     public void writeEmpty(HttpServletRequest request, HttpServletResponse response) throws
IOException {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java?rev=1552825&r1=1552824&r2=1552825&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
Fri Dec 20 22:12:38 2013
@@ -425,7 +425,7 @@ public class CmisBrowserBindingServlet e
         public void printError(CallContext context, Exception ex, HttpServletRequest request,
                 HttpServletResponse response) {
             int statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
-            String exceptionName = "runtime";
+            String exceptionName = CmisRuntimeException.EXCEPTION_NAME;
 
             if (ex instanceof CmisRuntimeException) {
                 LOG.error(ex.getMessage(), ex);
@@ -447,8 +447,7 @@ public class CmisBrowserBindingServlet e
             if (token == null) {
                 response.resetBuffer();
                 setStatus(request, response, statusCode);
-                response.setContentType(JSON_MIME_TYPE);
-
+  
                 JSONObject jsonResponse = new JSONObject();
                 jsonResponse.put(ERROR_EXCEPTION, exceptionName);
                 jsonResponse.put(ERROR_MESSAGE, ex.getMessage());



Mime
View raw message