wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jra...@apache.org
Subject svn commit: r1028045 - /incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/AdminServlet.java
Date Wed, 27 Oct 2010 17:19:16 GMT
Author: jramos
Date: Wed Oct 27 17:19:15 2010
New Revision: 1028045

URL: http://svn.apache.org/viewvc?rev=1028045&view=rev
Log:
Re-implement fix in AdminServlet that was accidentally removed

Modified:
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/AdminServlet.java

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/AdminServlet.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/AdminServlet.java?rev=1028045&r1=1028044&r2=1028045&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/AdminServlet.java
(original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/AdminServlet.java
Wed Oct 27 17:19:15 2010
@@ -419,7 +419,7 @@ public class AdminServlet extends Abstra
             Marshaller marshaller = JAXBUtils.createMarshaller(resourceCtx);
             marshaller.marshal(jaxbObject, writer);
         } catch (JAXBException e) {
-            throw new ServletException(Messages.getMessage("adminServletFailMarshalObject",
+            throw new ServletException(Messages.getMessage("adminServletFailMarshalObject",
//$NON-NLS-1$
                                                            jaxbObject.getClass().getName()),
e);
 
         }
@@ -436,7 +436,11 @@ public class AdminServlet extends Abstra
      * @throws IOException
      */
     private void buildAdminHome(HttpServletResponse response) throws IOException {
-        PrintWriter writer = response.getWriter();
+        // Set the status code before writing content to the stream
+        // per the servlet specification.
+        response.setStatus(HttpStatus.BAD_REQUEST.getCode());
+        
+	PrintWriter writer = response.getWriter();
         writer
             .write("<html>\r\n" + "<head>\r\n" //$NON-NLS-1$ //$NON-NLS-2$
                 + "<title>Admin Console</title>\r\n" //$NON-NLS-1$
@@ -462,7 +466,6 @@ public class AdminServlet extends Abstra
                 + "</form>\r\n" //$NON-NLS-1$
                 + "</body>\r\n" //$NON-NLS-1$
                 + "</html>"); //$NON-NLS-1$
-        response.setStatus(HttpStatus.BAD_REQUEST.getCode());
         writer.close();
         return;
     }



Mime
View raw message