cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r562802 - in /cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice: ServletConnection.java util/BlockCallHttpServletResponse.java
Date Sun, 05 Aug 2007 01:52:23 GMT
Author: vgritsenko
Date: Sat Aug  4 18:52:23 2007
New Revision: 562802

URL: http://svn.apache.org/viewvc?view=rev&rev=562802
Log:
set default status code to the 200 OK.
if status code is never set on response, it should be 200.

Modified:
    cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java
    cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletResponse.java

Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java?view=diff&rev=562802&r1=562801&r2=562802
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java
(original)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java
Sat Aug  4 18:52:23 2007
@@ -73,11 +73,11 @@
      * Construct a new object
      */
     public ServletConnection(String url)
-        throws MalformedURLException {
+    throws MalformedURLException {
 
-        URI blockURI = null;
+        URI blockURI;
         try {
-            blockURI = parseBlockURI(new URI(url.toString()));
+            blockURI = parseBlockURI(new URI(url));
         } catch (URISyntaxException e) {
             throw new MalformedURLException("Malformed URI in block source " +
                                             e.getMessage());
@@ -101,7 +101,9 @@
     
     public void connect() throws IOException, ServletException {
     	//if already connected, do nothing
-    	if (connected) return;
+    	if (connected) {
+            return;
+        }
     	
     	if (requestBody != null) {
     		request.setInputStream(new ByteArrayInputStream(requestBody.toByteArray()));
@@ -144,9 +146,11 @@
     }
 
     public void setIfModifiedSince(long ifmodifiedsince) {
-    	if (connected)
+    	if (connected) {
     	    throw new IllegalStateException("Already connected");
-    	request.setDateHeader("If-Modified-Since", ifmodifiedsince);
+        }
+
+        request.setDateHeader("If-Modified-Since", ifmodifiedsince);
     }
     
     public long getLastModified() {
@@ -189,8 +193,13 @@
      * @throws IllegalStateException - if already connected
      */
     public OutputStream getOutputStream() throws IllegalStateException {
-    	if (connected) throw new IllegalStateException("You cannot write to the connection already
connected.");
-    	if (requestBody == null) requestBody = new ByteArrayOutputStream();
+    	if (connected) {
+            throw new IllegalStateException("You cannot write to the connection already connected.");
+        }
+
+        if (requestBody == null) {
+            requestBody = new ByteArrayOutputStream();
+        }
     	return requestBody;
     	
     }
@@ -205,7 +214,7 @@
         String scheme = uri.getScheme();
 
         this.logger.debug("ServletSource: resolving " + uri.toString() + " with scheme "
+
-                uri.getScheme() + " and ssp " + uri.getRawSchemeSpecificPart());
+                          uri.getScheme() + " and ssp " + uri.getRawSchemeSpecificPart());
         uri = new URI(uri.getRawSchemeSpecificPart());
         this.logger.debug("ServletSource: resolved to " + uri.toString());
         

Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletResponse.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletResponse.java?view=diff&rev=562802&r1=562801&r2=562802
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletResponse.java
(original)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletResponse.java
Sat Aug  4 18:52:23 2007
@@ -52,8 +52,10 @@
 	 */
 	final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss'
'Z", Locale.US);
 
+
     public BlockCallHttpServletResponse() {
     	headers = new HashMap();
+        statusCode = HttpServletResponse.SC_OK;
     }
 
     /* (non-Javadoc)
@@ -360,6 +362,5 @@
 
     public void setCharacterEncoding(String arg0) {
         // TODO Auto-generated method stub
-        
     }
 }



Mime
View raw message