/[Apache-SVN]/cocoon/trunk/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java
ViewVC logotype

Diff of /cocoon/trunk/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- cocoon/trunk/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java	2005/04/29 09:09:44	165283
+++ cocoon/trunk/src/java/org/apache/cocoon/environment/commandline/CommandLineRequest.java	2005/04/29 09:24:28	165284
@@ -182,9 +182,8 @@ public class CommandLineRequest implemen
     public Object getAttribute(String name, int scope) {
         if ( scope == Request.REQUEST_SCOPE ) {
             return this.attributes.get(name);
-        } else {
-            return this.globalAttributes.get(name);
         }
+        return this.globalAttributes.get(name);
     }
     
     /* (non-Javadoc)
@@ -193,9 +192,8 @@ public class CommandLineRequest implemen
     public Enumeration getAttributeNames(int scope) {
         if ( scope == Request.REQUEST_SCOPE ) {
             return IteratorUtils.asEnumeration(this.attributes.keySet().iterator());
-        } else {
-            return IteratorUtils.asEnumeration(this.globalAttributes.keySet().iterator());
         }
+        return IteratorUtils.asEnumeration(this.globalAttributes.keySet().iterator());
     }
     
     /* (non-Javadoc)
@@ -247,9 +245,8 @@ public class CommandLineRequest implemen
         final Object value = this.parameters.get(name);
         if (value instanceof String) {
             return new String[] { (String)value };
-        } else {
-            return (String[]) value;
         }
+        return (String[]) value;
     }
 
     public String getHeader(String name) {
@@ -275,9 +272,8 @@ public class CommandLineRequest implemen
     public Enumeration getHeaderNames() {
         if (headers != null) {
             return IteratorUtils.asEnumeration(headers.keySet().iterator());
-        } else {
-            return new EmptyEnumeration();
         }
+        return new EmptyEnumeration();
     }
 
     public String getCharacterEncoding() { return characterEncoding; }
@@ -427,4 +423,15 @@ public class CommandLineRequest implemen
 		throw new UnsupportedOperationException();
 	}
 
+    /**
+     * @see org.apache.cocoon.environment.Request#searchAttribute(java.lang.String)
+     */
+    public Object searchAttribute(String name) {
+        Object result = this.getAttribute(name, REQUEST_SCOPE);
+        if ( result == null ) {
+            result = this.getAttribute(name, GLOBAL_SCOPE);
+        }
+        return result;
+    }
+
 }

 

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26