incubator-ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r939482 - /incubator/ace/trunk/ace-obr-servlet/src/main/java/org/apache/ace/obr/servlet/BundleServlet.java
Date Thu, 29 Apr 2010 21:01:16 GMT
Author: marrs
Date: Thu Apr 29 21:01:16 2010
New Revision: 939482

URL: http://svn.apache.org/viewvc?rev=939482&view=rev
Log:
Fixed some outstanding issues, slightly improved error handling and reporting.

Modified:
    incubator/ace/trunk/ace-obr-servlet/src/main/java/org/apache/ace/obr/servlet/BundleServlet.java

Modified: incubator/ace/trunk/ace-obr-servlet/src/main/java/org/apache/ace/obr/servlet/BundleServlet.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-obr-servlet/src/main/java/org/apache/ace/obr/servlet/BundleServlet.java?rev=939482&r1=939481&r2=939482&view=diff
==============================================================================
--- incubator/ace/trunk/ace-obr-servlet/src/main/java/org/apache/ace/obr/servlet/BundleServlet.java
(original)
+++ incubator/ace/trunk/ace-obr-servlet/src/main/java/org/apache/ace/obr/servlet/BundleServlet.java
Thu Apr 29 21:01:16 2010
@@ -36,7 +36,7 @@ public class BundleServlet extends HttpS
     public static final String TEXT_MIMETYPE = "text/plain";
 
     private static final long serialVersionUID = 1L;
-    private static final int COPY_BUFFER_SIZE = 1024;
+    private static final int COPY_BUFFER_SIZE = 4096;
 
     private volatile LogService m_log; /* will be injected by dependencymanager */
     private volatile BundleStore m_store; /* will be injected by dependencymanager */
@@ -125,17 +125,15 @@ public class BundleServlet extends HttpS
         }
         else {
             String id = path.substring(1);
-            response.setContentType(TEXT_MIMETYPE);
-
             ServletOutputStream output = null;
             try {
-                output = response.getOutputStream();
                 InputStream fileStream = null;
                 try {
                     fileStream = m_store.get(id);
-
                     if (fileStream != null) {
                         // send the bundle as stream to the caller
+                        response.setContentType(TEXT_MIMETYPE);
+                        output = response.getOutputStream();
                         byte[] buffer = new byte[COPY_BUFFER_SIZE];
                         for (int bytes = fileStream.read(buffer); bytes != -1; bytes = fileStream.read(buffer))
{
                             output.write(buffer, 0, bytes);
@@ -158,8 +156,6 @@ public class BundleServlet extends HttpS
             }
             catch (IOException ex) {
                 m_log.log(LogService.LOG_WARNING, "Exception in request: " + request.getRequestURL(),
ex);
-                // TODO sending an error response after we've already started writing data
does not work,
-                sendResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             }
             finally {
                 try {
@@ -191,11 +187,11 @@ public class BundleServlet extends HttpS
 
     @Override
     public String getServletInfo() {
-        return "LiQ OBR Servlet";
+        return "Apache ACE OBR Servlet";
     }
 
     @SuppressWarnings("unchecked")
     public void updated(Dictionary settings) throws ConfigurationException {
-        // Nothing needs to be done - handled by DependencyManager
+        // nothing needs to be done, settings are propagated by the dependency manager
     }
 }
\ No newline at end of file



Mime
View raw message