reinhard | 5 Mar 18:35 2007
Picon

svn commit: r514745 - in /cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl: ./ src/changes/ src/main/java/org/apache/cocoon/components/flow/apples/

Author: reinhard
Date: Mon Mar  5 09:35:27 2007
New Revision: 514745

URL: http://svn.apache.org/viewvc?view=rev&rev=514745
Log:
add sendStatus() method to the AppleResponse interface

Added:
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml   (with props)
Modified:
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/pom.xml
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleResponse.java
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
    cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/DefaultAppleResponse.java

Modified: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/pom.xml?view=diff&rev=514745&r1=514744&r2=514745
==============================================================================
--- cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/pom.xml Mon Mar  5 09:35:27 2007
 <at>  <at>  -42,4 +42,5  <at>  <at> 
       <version>2.2.0-RC1-SNAPSHOT</version>
     </dependency>
   </dependencies>
+  
 </project>

Added: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml?view=auto&rev=514745
==============================================================================
--- cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml (added)
+++ cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml Mon Mar  5
09:35:27 2007
 <at>  <at>  -0,0 +1,43  <at>  <at> 
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<!--+
+    | Find usage details at http://maven.apache.org/plugins/maven-changes-plugin/usage.html
+    |
+    |  <at> version $Id$
+    +-->
+<document>
+  <body>
+    <release version="1.0.0-RC1" date="2007-02-05" description="unreleased">  
+      <action dev="reinhard" type="add">
+        Add sendStatus() to the AppleResponse interface.
+      </action>
+    </release>    
+    <release version="1.0.0-M2" date="2007-02-05" description="released">  
+      <action dev="reinhard" type="update">
+        Use block directory structure as required from cocoon-core-2.2M3
+      </action>
+    </release>
+    <release version="1.0.0-M1" date="2006-08-03" description="released">  
+      <action dev="reinhard" type="update">
+        Initial release from trunk.
+      </action>
+    </release>
+  </body>
+</document>

Propchange: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/changes/changes.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleResponse.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleResponse.java?view=diff&rev=514745&r1=514744&r2=514745
==============================================================================
---
cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleResponse.java (original)
+++
cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleResponse.java
Mon Mar  5 09:35:27 2007
 <at>  <at>  -24,9 +24,13  <at>  <at> 
  *  <at> version $Id$
  */
 public interface AppleResponse {
+	
     public void sendPage(String uri, Object bizData);

     public void redirectTo(String uri);

+    public void sendStatus(int status);
+    
     public Response getCocoonResponse();
+    
 }

Modified: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java?view=diff&rev=514745&r1=514744&r2=514745
==============================================================================
---
cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java (original)
+++
cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
Mon Mar  5 09:35:27 2007
 <at>  <at>  -123,7 +123,11  <at>  <at> 

         if (res.isRedirect()) {
             redirector.redirect(false, res.getURI());
-        } else {
+        }
+        else if (res.isSendStatus()) {
+        	redirector.sendStatus(res.getStatus());
+        }     
+        else {
             String uri = res.getURI();
             if (getLogger().isDebugEnabled()) {
                 getLogger().debug(

Modified: cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/DefaultAppleResponse.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/DefaultAppleResponse.java?view=diff&rev=514745&r1=514744&r2=514745
==============================================================================
---
cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/DefaultAppleResponse.java (original)
+++
cocoon/trunk/blocks/cocoon-apples/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/DefaultAppleResponse.java
Mon Mar  5 09:35:27 2007
 <at>  <at>  -27,6 +27,7  <at>  <at> 
 public class DefaultAppleResponse implements AppleResponse {
     private String uri;
     private Object data;
+    private int status;
     private boolean redirect = false;
     private Response cocoonResponse;

 <at>  <at>  -39,8 +40,20  <at>  <at> 
         this.data = bizData;
         this.redirect = false;
     }
+    
+    public void sendStatus(int status) {
+    	if(isRedirect()) {
+    		throw new IllegalStateException(
+    				"It's not possible to call redirectTo() and sendStatus() at the same response object.");
+    	}
+    	this.status = status;
+    }

     public void redirectTo(String uri) {
+    	if(isSendStatus()) {
+    		throw new IllegalStateException(
+    				"It's not possible to call redirectTo() and sendStatus() at the same response object.");
+    	}    	
         this.uri = uri;
         this.redirect = true;
     }
 <at>  <at>  -48,6 +61,10  <at>  <at> 
     protected boolean isRedirect() {
         return redirect;
     }
+    
+    protected boolean isSendStatus() {
+    	return this.status > 0 ? true : false;
+    }

     protected String getURI() {
         return uri;
 <at>  <at>  -57,7 +74,12  <at>  <at> 
         return data;
     }

+    protected int getStatus() {
+    	return this.status;
+    }
+    
     public Response getCocoonResponse() {
         return cocoonResponse;
     }
+
 }


Gmane