Diff of /cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/environment/portlet/PortletRequest.java
Parent Directory
| Revision Log
| Patch
--- cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/environment/portlet/PortletRequest.java 2005/04/29 09:09:44 165283
+++ cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/environment/portlet/PortletRequest.java 2005/04/29 09:24:28 165284
@@ -93,23 +93,22 @@ public abstract class PortletRequest imp
// if the request has been wrapped then access its method
if (request instanceof MultipartActionRequest) {
return ((MultipartActionRequest) request).get(name);
- } else {
- String[] values = request.getParameterValues(name);
- if (values == null) {
- return null;
- }
- if (values.length == 1) {
- return values[0];
- }
- if (values.length > 1) {
- Vector vect = new Vector(values.length);
- for (int i = 0; i < values.length; i++) {
- vect.add(values[i]);
- }
- return vect;
- }
+ }
+ String[] values = request.getParameterValues(name);
+ if (values == null) {
return null;
}
+ if (values.length == 1) {
+ return values[0];
+ }
+ if (values.length > 1) {
+ Vector vect = new Vector(values.length);
+ for (int i = 0; i < values.length; i++) {
+ vect.add(values[i]);
+ }
+ return vect;
+ }
+ return null;
}
/* The Request interface methods */
@@ -529,9 +528,8 @@ public abstract class PortletRequest imp
public Object getAttribute(String name, int scope) {
if ( scope == Request.REQUEST_SCOPE ) {
return this.attributes.get(name);
- } else {
- return this.request.getAttribute(name);
}
+ return this.request.getAttribute(name);
}
/* (non-Javadoc)
@@ -540,9 +538,8 @@ public abstract class PortletRequest imp
public Enumeration getAttributeNames(int scope) {
if ( scope == Request.REQUEST_SCOPE ) {
return IteratorUtils.asEnumeration(this.attributes.keySet().iterator());
- } else {
- return this.request.getAttributeNames();
}
+ return this.request.getAttributeNames();
}
/* (non-Javadoc)
@@ -567,4 +564,15 @@ public abstract class PortletRequest imp
}
}
+ /**
+ * @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;
+ }
+
}