Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
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
@@ -42,4 +42,5 @@
       2.2.0-RC1-SNAPSHOT
     
   
+  
 

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
@@ -0,0 +1,43 @@
+
+
+
+
+  
+      
+      
+        Add sendStatus() to the AppleResponse interface.
+      
+        
+     

+      
+        Use block directory structure as required from cocoon-core-2.2M3
+      
+    
+     

+      
+        Initial release from trunk.
+      
+    
+  
+

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
@@ -24,9 +24,13 @@
  * @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
@@ -123,7 +123,11 @@
 
         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
@@ -27,6 +27,7 @@
 public class DefaultAppleResponse implements AppleResponse {
     private String uri;
     private Object data;
+    private int status;
     private boolean redirect = false;
     private Response cocoonResponse;
 
@@ -39,8 +40,20 @@
         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;
     }
@@ -48,6 +61,10 @@
     protected boolean isRedirect() {
         return redirect;
     }
+    
+    protected boolean isSendStatus() {
+    	return this.status > 0 ? true : false;
+    }
 
     protected String getURI() {
         return uri;
@@ -57,7 +74,12 @@
         return data;
     }
 
+    protected int getStatus() {
+    	return this.status;
+    }
+    
     public Response getCocoonResponse() {
         return cocoonResponse;
     }
+
 }
 
CD: 16ms