You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2012/07/19 13:42:55 UTC
svn commit: r1363305 [2/3] - in /commons/proper/chain/trunk:
apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/
apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/
apps/cookbook-examples/s...
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletApplicationScopeMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletApplicationScopeMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletApplicationScopeMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletApplicationScopeMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.portlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,37 +27,30 @@ import javax.portlet.PortletContext;
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for portlet context
* attributes.</p>
*
* @version $Id$
*/
-
final class PortletApplicationScopeMap implements Map<String, Object> {
-
public PortletApplicationScopeMap(PortletContext context) {
this.context = context;
}
-
private PortletContext context = null;
-
public void clear() {
for (String key : keySet()) {
context.removeAttribute(key);
}
}
-
public boolean containsKey(Object key) {
return (context.getAttribute(key(key)) != null);
}
-
public boolean containsValue(Object value) {
if (value == null) {
return (false);
@@ -73,7 +65,6 @@ final class PortletApplicationScopeMap i
return (false);
}
-
public Set<Entry<String, Object>> entrySet() {
Set<Entry<String, Object>> set = new HashSet<Entry<String, Object>>();
Enumeration<String> keys = context.getAttributeNames();
@@ -85,27 +76,22 @@ final class PortletApplicationScopeMap i
return (set);
}
-
public boolean equals(Object o) {
return (context.equals(o));
}
-
public Object get(Object key) {
return (context.getAttribute(key(key)));
}
-
public int hashCode() {
return (context.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
Enumeration<String> keys = context.getAttributeNames();
@@ -115,7 +101,6 @@ final class PortletApplicationScopeMap i
return (set);
}
-
public Object put(String key, Object value) {
if (value == null) {
return (remove(key));
@@ -125,14 +110,12 @@ final class PortletApplicationScopeMap i
return (previous);
}
-
public void putAll(Map<? extends String, ? extends Object> map) {
for (Entry<? extends String, ? extends Object> entry : map.entrySet()) {
put(key(entry.getKey()), entry.getValue());
}
}
-
public Object remove(Object key) {
String skey = key(key);
Object previous = context.getAttribute(skey);
@@ -140,7 +123,6 @@ final class PortletApplicationScopeMap i
return (previous);
}
-
public int size() {
int n = 0;
Enumeration<String> keys = context.getAttributeNames();
@@ -151,7 +133,6 @@ final class PortletApplicationScopeMap i
return (n);
}
-
public Collection<Object> values() {
List<Object> list = new ArrayList<Object>();
Enumeration<String> keys = context.getAttributeNames();
@@ -161,7 +142,6 @@ final class PortletApplicationScopeMap i
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -172,5 +152,4 @@ final class PortletApplicationScopeMap i
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommand.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommand.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletGetLocaleCommand.java Thu Jul 19 11:42:53 2012
@@ -16,28 +16,23 @@
*/
package org.apache.commons.chain2.web.portlet;
-
import org.apache.commons.chain2.Context;
import org.apache.commons.chain2.web.AbstractGetLocaleCommand;
import javax.portlet.PortletRequest;
import java.util.Locale;
-
/**
* <p>Concrete implementation of {@link AbstractGetLocaleCommand} for
* the Portlet API.</p>
*
* @version $Id$
*/
-
public class PortletGetLocaleCommand
extends AbstractGetLocaleCommand<PortletWebContext> {
-
// ------------------------------------------------------- Protected Methods
-
/**
* <p>Retrieve and return the <code>Locale</code> for this request.</p>
*
@@ -45,11 +40,8 @@ public class PortletGetLocaleCommand
* @return The Locale for the request.
*/
protected Locale getLocale(PortletWebContext context) {
-
PortletRequest request = (PortletRequest)context.get("request");
return (request.getLocale());
-
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletInitParamMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletInitParamMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletInitParamMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletInitParamMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.portlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,40 +27,32 @@ import javax.portlet.PortletContext;
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for portlet context
* init parameters.</p>
*
* @version $Id$
*/
-
final class PortletInitParamMap implements Map<String, String> {
-
public PortletInitParamMap(PortletContext context) {
this.context = context;
}
-
private PortletContext context = null;
-
public void clear() {
throw new UnsupportedOperationException();
}
-
public boolean containsKey(Object key) {
return (context.getInitParameter(key(key)) != null);
}
-
public boolean containsValue(Object value) {
return values().contains(value);
}
-
public Set<Entry<String, String>> entrySet() {
Set<Entry<String, String>> set = new HashSet<Entry<String, String>>();
Enumeration<String> keys = context.getInitParameterNames();
@@ -73,27 +64,22 @@ final class PortletInitParamMap implemen
return (set);
}
-
public boolean equals(Object o) {
return (context.equals(o));
}
-
public String get(Object key) {
return (context.getInitParameter(key(key)));
}
-
public int hashCode() {
return (context.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
Enumeration<String> keys = context.getInitParameterNames();
@@ -103,22 +89,18 @@ final class PortletInitParamMap implemen
return (set);
}
-
public String put(String key, String value) {
throw new UnsupportedOperationException();
}
-
public void putAll(Map<? extends String, ? extends String> map) {
throw new UnsupportedOperationException();
}
-
public String remove(Object key) {
throw new UnsupportedOperationException();
}
-
public int size() {
int n = 0;
Enumeration<String> keys = context.getInitParameterNames();
@@ -129,7 +111,6 @@ final class PortletInitParamMap implemen
return (n);
}
-
public Collection<String> values() {
List<String> list = new ArrayList<String>();
Enumeration<String> keys = context.getInitParameterNames();
@@ -139,7 +120,6 @@ final class PortletInitParamMap implemen
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -150,5 +130,4 @@ final class PortletInitParamMap implemen
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletParamMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletParamMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletParamMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletParamMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.portlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,40 +27,32 @@ import javax.portlet.PortletRequest;
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for portlet parameter
* name-value.</p>
*
* @version $Id$
*/
-
final class PortletParamMap implements Map<String, String> {
-
public PortletParamMap(PortletRequest request) {
this.request = request;
}
-
private PortletRequest request = null;
-
public void clear() {
throw new UnsupportedOperationException();
}
-
public boolean containsKey(Object key) {
return (request.getParameter(key(key)) != null);
}
-
public boolean containsValue(Object value) {
return values().contains(value);
}
-
public Set<Entry<String, String>> entrySet() {
Set<Entry<String, String>> set = new HashSet<Entry<String, String>>();
Enumeration<String> keys = request.getParameterNames();
@@ -73,27 +64,22 @@ final class PortletParamMap implements M
return (set);
}
-
public boolean equals(Object o) {
return (request.equals(o));
}
-
public String get(Object key) {
return (request.getParameter(key(key)));
}
-
public int hashCode() {
return (request.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
Enumeration<String> keys = request.getParameterNames();
@@ -103,22 +89,18 @@ final class PortletParamMap implements M
return (set);
}
-
public String put(String key, String value) {
throw new UnsupportedOperationException();
}
-
public void putAll(Map<? extends String, ? extends String> map) {
throw new UnsupportedOperationException();
}
-
public String remove(Object key) {
throw new UnsupportedOperationException();
}
-
public int size() {
int n = 0;
Enumeration<String> keys = request.getParameterNames();
@@ -129,7 +111,6 @@ final class PortletParamMap implements M
return (n);
}
-
public Collection<String> values() {
List<String> list = new ArrayList<String>();
Enumeration<String> keys = request.getParameterNames();
@@ -139,7 +120,6 @@ final class PortletParamMap implements M
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -150,5 +130,4 @@ final class PortletParamMap implements M
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletParamValuesMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletParamValuesMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletParamValuesMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletParamValuesMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.portlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -35,33 +34,26 @@ import org.apache.commons.chain2.web.Map
*
* @version $Id$
*/
-
final class PortletParamValuesMap implements Map<String, String[]> {
-
public PortletParamValuesMap(PortletRequest request) {
this.request = request;
}
-
private PortletRequest request = null;
-
public void clear() {
throw new UnsupportedOperationException();
}
-
public boolean containsKey(Object key) {
return (request.getParameter(key(key)) != null);
}
-
public boolean containsValue(Object value) {
return values().contains(value);
}
-
public Set<Entry<String, String[]>> entrySet() {
Set<Entry<String, String[]>> set = new HashSet<Entry<String, String[]>>();
Enumeration<String> keys = request.getParameterNames();
@@ -73,27 +65,22 @@ final class PortletParamValuesMap implem
return (set);
}
-
public boolean equals(Object o) {
return (request.equals(o));
}
-
public String[] get(Object key) {
return (request.getParameterValues(key(key)));
}
-
public int hashCode() {
return (request.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
Enumeration<String> keys = request.getParameterNames();
@@ -103,22 +90,18 @@ final class PortletParamValuesMap implem
return (set);
}
-
public String[] put(String key, String[] value) {
throw new UnsupportedOperationException();
}
-
public void putAll(Map<? extends String, ? extends String[]> map) {
throw new UnsupportedOperationException();
}
-
public String[] remove(Object key) {
throw new UnsupportedOperationException();
}
-
public int size() {
int n = 0;
Enumeration<String> keys = request.getParameterNames();
@@ -129,7 +112,6 @@ final class PortletParamValuesMap implem
return (n);
}
-
public Collection<String[]> values() {
List<String[]> list = new ArrayList<String[]>();
Enumeration<String> keys = request.getParameterNames();
@@ -139,7 +121,6 @@ final class PortletParamValuesMap implem
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -150,5 +131,4 @@ final class PortletParamValuesMap implem
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletRequestScopeMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletRequestScopeMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletRequestScopeMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletRequestScopeMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.portlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,37 +27,30 @@ import javax.portlet.PortletRequest;
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for portlet request
* attributes.</p>
*
* @version $Id$
*/
-
final class PortletRequestScopeMap implements Map<String, Object> {
-
public PortletRequestScopeMap(PortletRequest request) {
this.request = request;
}
-
private PortletRequest request = null;
-
public void clear() {
for (String key : keySet()) {
request.removeAttribute(key);
}
}
-
public boolean containsKey(Object key) {
return (request.getAttribute(key(key)) != null);
}
-
public boolean containsValue(Object value) {
if (value == null) {
return (false);
@@ -73,7 +65,6 @@ final class PortletRequestScopeMap imple
return (false);
}
-
public Set<Entry<String, Object>> entrySet() {
Set<Entry<String, Object>> set = new HashSet<Entry<String, Object>>();
Enumeration<String> keys = request.getAttributeNames();
@@ -85,27 +76,22 @@ final class PortletRequestScopeMap imple
return (set);
}
-
public boolean equals(Object o) {
return (request.equals(o));
}
-
public Object get(Object key) {
return (request.getAttribute(key(key)));
}
-
public int hashCode() {
return (request.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
Enumeration<String> keys = request.getAttributeNames();
@@ -115,7 +101,6 @@ final class PortletRequestScopeMap imple
return (set);
}
-
public Object put(String key, Object value) {
if (value == null) {
return (remove(key));
@@ -126,14 +111,12 @@ final class PortletRequestScopeMap imple
return (previous);
}
-
public void putAll(Map<? extends String, ? extends Object> map) {
for (Entry<? extends String, ? extends Object> entry : map.entrySet()) {
put(key(entry.getKey()), entry.getValue());
}
}
-
public Object remove(Object key) {
String skey = key(key);
Object previous = request.getAttribute(skey);
@@ -141,7 +124,6 @@ final class PortletRequestScopeMap imple
return (previous);
}
-
public int size() {
int n = 0;
Enumeration<String> keys = request.getAttributeNames();
@@ -152,7 +134,6 @@ final class PortletRequestScopeMap imple
return (n);
}
-
public Collection<Object> values() {
List<Object> list = new ArrayList<Object>();
Enumeration<String> keys = request.getAttributeNames();
@@ -162,7 +143,6 @@ final class PortletRequestScopeMap imple
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -173,5 +153,4 @@ final class PortletRequestScopeMap imple
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletSessionScopeMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletSessionScopeMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletSessionScopeMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletSessionScopeMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.portlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -29,26 +28,22 @@ import javax.portlet.PortletRequest;
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for portlet session
* attributes.</p>
*
* @version $Id$
*/
-
final class PortletSessionScopeMap implements Map<String, Object> {
-
public PortletSessionScopeMap(PortletRequest request) {
this.request = request;
sessionExists();
}
-
private PortletSession session = null;
- private PortletRequest request = null;
+ private PortletRequest request = null;
public void clear() {
if (sessionExists()) {
@@ -58,12 +53,10 @@ final class PortletSessionScopeMap imple
}
}
-
public boolean containsKey(Object key) {
return sessionExists() && session.getAttribute(key(key)) != null;
}
-
public boolean containsValue(Object value) {
if (value == null || !sessionExists()) {
return false;
@@ -79,7 +72,6 @@ final class PortletSessionScopeMap imple
return false;
}
-
public Set<Entry<String, Object>> entrySet() {
Set<Entry<String, Object>> set = new HashSet<Entry<String, Object>>();
if (sessionExists()) {
@@ -94,12 +86,10 @@ final class PortletSessionScopeMap imple
return set;
}
-
public boolean equals(Object o) {
return sessionExists() && session.equals(o);
}
-
public Object get(Object key) {
if (sessionExists()) {
return session.getAttribute(key(key));
@@ -107,7 +97,6 @@ final class PortletSessionScopeMap imple
return null;
}
-
public int hashCode() {
if (sessionExists()) {
return session.hashCode();
@@ -115,12 +104,10 @@ final class PortletSessionScopeMap imple
return 0;
}
-
public boolean isEmpty() {
return !sessionExists() || !session.getAttributeNames().hasMoreElements();
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
if (sessionExists()) {
@@ -133,7 +120,6 @@ final class PortletSessionScopeMap imple
return set;
}
-
public Object put(String key, Object value) {
if (value == null) {
return remove(key);
@@ -152,14 +138,12 @@ final class PortletSessionScopeMap imple
return previous;
}
-
public void putAll(Map<? extends String, ? extends Object> map) {
for (Entry<? extends String, ? extends Object> entry : map.entrySet()) {
put(key(entry.getKey()), entry.getValue());
}
}
-
public Object remove(Object key) {
if (sessionExists()) {
String skey = key(key);
@@ -170,7 +154,6 @@ final class PortletSessionScopeMap imple
return null;
}
-
public int size() {
int n = 0;
if (sessionExists()) {
@@ -184,7 +167,6 @@ final class PortletSessionScopeMap imple
return n;
}
-
public Collection<Object> values() {
List<Object> list = new ArrayList<Object>();
if (sessionExists()) {
@@ -197,7 +179,6 @@ final class PortletSessionScopeMap imple
return list;
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletSetLocaleCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletSetLocaleCommand.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletSetLocaleCommand.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletSetLocaleCommand.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.portlet;
-
import org.apache.commons.chain2.Context;
import org.apache.commons.chain2.web.AbstractSetLocaleCommand;
@@ -24,21 +23,17 @@ import java.util.Locale;
//import javax.portlet.PortletResponse;
-
/**
* <p>Concrete implementation of {@link AbstractSetLocaleCommand} for
* the Portlet API.</p>
*
* @version $Id$
*/
-
public class PortletSetLocaleCommand
extends AbstractSetLocaleCommand<PortletWebContext> {
-
// ------------------------------------------------------- Protected Methods
-
/**
* <p>Establish the specified <code>Locale</code> for this response.</p>
*
@@ -46,13 +41,10 @@ public class PortletSetLocaleCommand
* @param locale The Locale for the request.
*/
protected void setLocale(PortletWebContext context, Locale locale) {
-
// PortletResponse response = (PortletResponse)
// context.get("response");
// response.setLocale(locale);
// Not supported by the Portlet API
-
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletWebContext.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletWebContext.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletWebContext.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/portlet/PortletWebContext.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.portlet;
-
import org.apache.commons.chain2.web.WebContext;
import javax.portlet.PortletContext;
@@ -26,7 +25,6 @@ import javax.servlet.http.Cookie;
import java.util.Collections;
import java.util.Map;
-
/**
* <p>Concrete implementation of {@link WebContext} suitable for use in
* portlets. The abstract methods are mapped to the appropriate
@@ -35,26 +33,21 @@ import java.util.Map;
*
* @version $Id$
*/
-
public class PortletWebContext extends WebContext {
-
/**
*
*/
private static final long serialVersionUID = -6928446126906631819L;
-
// ------------------------------------------------------------ Constructors
-
/**
* <p>Construct an uninitialized {@link PortletWebContext} instance.</p>
*/
public PortletWebContext() {
}
-
/**
* <p>Construct a {@link PortletWebContext} instance that is initialized
* with the specified Portlet API objects.</p>
@@ -66,128 +59,103 @@ public class PortletWebContext extends W
public PortletWebContext(PortletContext context,
PortletRequest request,
PortletResponse response) {
-
initialize(context, request, response);
-
}
-
// ------------------------------------------------------ Instance Variables
-
/**
* <p>The lazily instantiated <code>Map</code> of application scope
* attributes.</p>
*/
private Map<String, Object> applicationScope = null;
-
/**
* <p>The <code>PortletContext</code> for this web application.</p>
*/
private PortletContext context = null;
-
/**
* <p>The lazily instantiated <code>Map</code> of header name-value
* combinations (immutable).</p>
*/
private Map<String, String> header = null;
-
/**
* <p>The lazily instantitated <code>Map</code> of header name-values
* combinations (immutable).</p>
*/
private Map<String, String[]> headerValues = null;
-
/**
* <p>The lazily instantiated <code>Map</code> of context initialization
* parameters.</p>
*/
private Map<String, String> initParam = null;
-
/**
* <p>The lazily instantiated <code>Map</code> of request
* parameter name-value.</p>
*/
private Map<String, String> param = null;
-
/**
* <p>The lazily instantiated <code>Map</code> of request
* parameter name-values.</p>
*/
private Map<String, String[]> paramValues = null;
-
/**
* <p>The <code>PortletRequest</code> for this request.</p>
*/
private PortletRequest request = null;
-
/**
* <p>The lazily instantiated <code>Map</code> of request scope
* attributes.</p>
*/
private Map<String, Object> requestScope = null;
-
/**
* <p>The <code>PortletResponse</code> for this request.</p>
*/
private PortletResponse response = null;
-
/**
* <p>The lazily instantiated <code>Map</code> of session scope
* attributes.</p>
*/
private Map<String, Object> sessionScope = null;
-
// ---------------------------------------------------------- Public Methods
-
/**
* <p>Return the {@link PortletContext} for this context.</p>
*
* @return The <code>PortletContext</code> for this request
*/
public PortletContext getContext() {
-
- return (this.context);
-
+ return (this.context);
}
-
/**
* <p>Return the {@link PortletRequest} for this context.</p>
*
* @return The <code>PortletRequest</code> for this context.
*/
public PortletRequest getRequest() {
-
- return (this.request);
-
+ return (this.request);
}
-
/**
* <p>Return the {@link PortletResponse} for this context.</p>
*
* @return The <code>PortletResponse</code> for this context.
*/
public PortletResponse getResponse() {
-
- return (this.response);
-
+ return (this.response);
}
-
/**
* <p>Initialize (or reinitialize) this {@link PortletWebContext} instance
* for the specified Portlet API objects.</p>
@@ -199,17 +167,14 @@ public class PortletWebContext extends W
public void initialize(PortletContext context,
PortletRequest request,
PortletResponse response) {
-
// Save the specified Portlet API object references
this.context = context;
this.request = request;
this.response = response;
// Perform other setup as needed
-
}
-
/**
* <p>Release references to allocated resources acquired in
* <code>initialize()</code> of via subsequent processing. After this
@@ -217,7 +182,6 @@ public class PortletWebContext extends W
* <code>initialize()</code> will return undefined results.</p>
*/
public void release() {
-
// Release references to allocated collections
applicationScope = null;
header = null;
@@ -232,42 +196,33 @@ public class PortletWebContext extends W
context = null;
request = null;
response = null;
-
}
-
-
// ------------------------------------------------------ WebContext Methods
-
/**
* See the {@link WebContext}'s Javadoc.
*
* @return Application scope Map.
*/
public Map<String, Object> getApplicationScope() {
-
if ((applicationScope == null) && (context != null)) {
applicationScope = new PortletApplicationScopeMap(context);
}
return (applicationScope);
-
}
-
/**
* See the {@link WebContext}'s Javadoc.
*
* @return Header values Map.
*/
public Map<String, String> getHeader() {
-
if ((header == null) && (request != null)) {
- // header = new PortletHeaderMap(request);
- header = Collections.emptyMap();
+ // header = new PortletHeaderMap(request);
+ header = Collections.emptyMap();
}
return (header);
-
}
/**
@@ -276,61 +231,49 @@ public class PortletWebContext extends W
* @return Header values Map.
*/
public Map<String, String[]> getHeaderValues() {
-
if ((headerValues == null) && (request != null)) {
- // headerValues = new PortletHeaderValuesMap(request);
- headerValues = Collections.emptyMap();
+ // headerValues = new PortletHeaderValuesMap(request);
+ headerValues = Collections.emptyMap();
}
return (headerValues);
-
}
-
/**
* See the {@link WebContext}'s Javadoc.
*
* @return Initialization parameter Map.
*/
public Map<String, String> getInitParam() {
-
if ((initParam == null) && (context != null)) {
initParam = new PortletInitParamMap(context);
}
return (initParam);
-
}
-
/**
* See the {@link WebContext}'s Javadoc.
*
* @return Request parameter Map.
*/
public Map<String, String> getParam() {
-
if ((param == null) && (request != null)) {
param = new PortletParamMap(request);
}
return (param);
-
}
-
/**
* See the {@link WebContext}'s Javadoc.
*
* @return Request parameter Map.
*/
public Map<String, String[]> getParamValues() {
-
if ((paramValues == null) && (request != null)) {
paramValues = new PortletParamValuesMap(request);
}
return (paramValues);
-
}
-
/**
* Returns an empty Map - portlets don't support Cookies.
*
@@ -338,40 +281,32 @@ public class PortletWebContext extends W
* @since Chain 1.1
*/
public Map<String, Cookie> getCookies() {
-
return Collections.emptyMap();
-
}
-
/**
* See the {@link WebContext}'s Javadoc.
*
* @return Request scope Map.
*/
public Map<String, Object> getRequestScope() {
-
if ((requestScope == null) && (request != null)) {
requestScope = new PortletRequestScopeMap(request);
}
return (requestScope);
-
}
-
/**
* See the {@link WebContext}'s Javadoc.
*
* @return Session scope Map.
*/
public Map<String, Object> getSessionScope() {
-
if ((sessionScope == null) && (request != null)) {
sessionScope =
new PortletSessionScopeMap(request);
}
return (sessionScope);
-
}
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import org.apache.commons.chain2.Catalog;
import org.apache.commons.chain2.CatalogFactory;
import org.apache.commons.chain2.Command;
@@ -28,7 +27,6 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-
/**
* <p>Custom subclass of {@link ChainServlet} that also dispatches incoming
* requests to a configurable {@link Command} loaded from the specified
@@ -57,19 +55,15 @@ import java.io.IOException;
*
* @version $Id$
*/
-
public class ChainProcessor extends ChainServlet {
-
// ------------------------------------------------------ Manifest Constants
-
/**
*
*/
private static final long serialVersionUID = -6817532768031279260L;
-
/**
* <p>The name of the servlet init parameter containing the name of the
* {@link Catalog} to use for processing incoming requests.</p>
@@ -77,7 +71,6 @@ public class ChainProcessor extends Chai
public static final String CATALOG =
"org.apache.commons.chain2.CATALOG";
-
/**
* <p>The default request attribute under which we expose the
* {@link Catalog} being used to subordinate {@link Command}s.</p>
@@ -85,7 +78,6 @@ public class ChainProcessor extends Chai
public static final String CATALOG_DEFAULT =
"org.apache.commons.chain2.CATALOG";
-
/**
* <p>The name of the servlet init parameter containing the name of the
* {@link Command} (loaded from our configured {@link Catalog} to use
@@ -94,16 +86,13 @@ public class ChainProcessor extends Chai
public static final String COMMAND =
"org.apache.commons.chain2.COMMAND";
-
/**
* <p>The default command name.</p>
*/
private static final String COMMAND_DEFAULT = "command";
-
// ------------------------------------------------------ Instance Variables
-
/**
* <p>The name of the context attribute under which our {@link Catalog}
* is stored. This value is also used as the name of the
@@ -113,7 +102,6 @@ public class ChainProcessor extends Chai
*/
private String attribute = null;
-
/**
* <p>The name of the {@link Catalog} to retrieve from the
* {@link CatalogFactory} for this application, or <code>null</code>
@@ -121,31 +109,25 @@ public class ChainProcessor extends Chai
*/
private String catalog = null;
-
/**
* <p>The name of the {@link Command} to be executed for each incoming
* request.</p>
*/
private String command = null;
-
// --------------------------------------------------------- Servlet Methods
-
/**
* <p>Clean up as this application is shut down.</p>
*/
@Override
public void destroy() {
-
super.destroy();
attribute = null;
catalog = null;
command = null;
-
}
-
/**
* <p>Cache the name of the command we should execute for each request.</p>
*
@@ -153,7 +135,6 @@ public class ChainProcessor extends Chai
*/
@Override
public void init() throws ServletException {
-
super.init();
attribute = getServletConfig().getInitParameter(CONFIG_ATTR);
catalog = getServletConfig().getInitParameter(CATALOG);
@@ -161,10 +142,8 @@ public class ChainProcessor extends Chai
if (command == null) {
command = COMMAND_DEFAULT;
}
-
}
-
/**
* <p>Configure a {@link ServletWebContext} for the current request, and
* pass it to the <code>execute()</code> method of the specified
@@ -218,8 +197,6 @@ public class ChainProcessor extends Chai
} catch (Exception e) {
throw new ServletException(e);
}
-
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/PathInfoMapper.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/PathInfoMapper.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/PathInfoMapper.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/PathInfoMapper.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import org.apache.commons.chain2.Catalog;
import org.apache.commons.chain2.Command;
import org.apache.commons.chain2.Context;
@@ -24,7 +23,6 @@ import org.apache.commons.chain2.generic
import javax.servlet.http.HttpServletRequest;
-
/**
* <p>{@link Command} that uses the "path info" component of the request URI
* to select a {@link Command} from the appropriate {@link Catalog}, and
@@ -36,19 +34,14 @@ import javax.servlet.http.HttpServletReq
*
* @version $Id$
*/
-
public class PathInfoMapper extends LookupCommand<String, Object, ServletWebContext> {
-
// ------------------------------------------------------ Instance Variables
-
private String catalogKey = ChainProcessor.CATALOG_DEFAULT;
-
// -------------------------------------------------------------- Properties
-
/**
* <p>Return the context key under which our {@link Catalog} has been
* stored.</p>
@@ -60,12 +53,9 @@ public class PathInfoMapper extends Look
*/
@Deprecated
public String getCatalogKey() {
-
return (this.catalogKey);
-
}
-
/**
* <p>Set the context key under which our {@link Catalog} has been
* stored.</p>
@@ -77,15 +67,11 @@ public class PathInfoMapper extends Look
*/
@Deprecated
public void setCatalogKey(String catalogKey) {
-
this.catalogKey = catalogKey;
-
}
-
// --------------------------------------------------------- Command Methods
-
/**
* <p>Look up the extra path information for this request, and use it to
* select an appropriate {@link Command} to be executed.
@@ -106,7 +92,6 @@ public class PathInfoMapper extends Look
}
return pathInfo;
-
}
/**
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/RequestParameterMapper.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/RequestParameterMapper.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/RequestParameterMapper.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/RequestParameterMapper.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import org.apache.commons.chain2.Catalog;
import org.apache.commons.chain2.Command;
import org.apache.commons.chain2.Context;
@@ -24,7 +23,6 @@ import org.apache.commons.chain2.generic
import javax.servlet.http.HttpServletRequest;
-
/**
* <p>{@link Command} that uses a specified request parameter
* to select a {@link Command} from the appropriate {@link Catalog}, and
@@ -37,21 +35,17 @@ import javax.servlet.http.HttpServletReq
*
* @version $Id$
*/
-
public class RequestParameterMapper
extends LookupCommand<String, Object, ServletWebContext> {
-
// ------------------------------------------------------ Instance Variables
-
private String catalogKey = ChainProcessor.CATALOG_DEFAULT;
- private String parameter = "command";
+ private String parameter = "command";
// -------------------------------------------------------------- Properties
-
/**
* <p>Return the context key under which our {@link Catalog} has been
* stored.</p>
@@ -59,12 +53,9 @@ public class RequestParameterMapper
* @return The context key for the Catalog.
*/
public String getCatalogKey() {
-
return (this.catalogKey);
-
}
-
/**
* <p>Set the context key under which our {@link Catalog} has been
* stored.</p>
@@ -76,12 +67,9 @@ public class RequestParameterMapper
*/
@Deprecated
public void setCatalogKey(String catalogKey) {
-
this.catalogKey = catalogKey;
-
}
-
/**
* <p>Return the name of the request parameter to use for
* selecting the {@link Command} to be executed.</p>
@@ -93,12 +81,9 @@ public class RequestParameterMapper
*/
@Deprecated
public String getParameter() {
-
return (this.parameter);
-
}
-
/**
* <p>Set the name of the request parameter to use for
* selecting the {@link Command} to be executed.</p>
@@ -106,15 +91,11 @@ public class RequestParameterMapper
* @param parameter The new parameter name
*/
public void setParameter(String parameter) {
-
this.parameter = parameter;
-
}
-
// --------------------------------------------------------- Command Methods
-
/**
* <p>Look up the specified request parameter for this request, and use it
* to select an appropriate {@link Command} to be executed.
@@ -130,10 +111,8 @@ public class RequestParameterMapper
HttpServletRequest request = context.getRequest();
String value = request.getParameter(getCatalogName());
return value;
-
}
-
/**
* <p>Return the {@link Catalog} to look up the {@link Command} in.</p>
*
@@ -159,5 +138,4 @@ public class RequestParameterMapper
return catalog;
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletApplicationScopeMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletApplicationScopeMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletApplicationScopeMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletApplicationScopeMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,37 +27,30 @@ import javax.servlet.ServletContext;
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for servlet context
* attributes.</p>
*
* @version $Id$
*/
-
final class ServletApplicationScopeMap implements Map<String, Object> {
-
public ServletApplicationScopeMap(ServletContext context) {
this.context = context;
}
-
private ServletContext context = null;
-
public void clear() {
for (String key : keySet()) {
context.removeAttribute(key);
}
}
-
public boolean containsKey(Object key) {
return (context.getAttribute(key(key)) != null);
}
-
public boolean containsValue(Object value) {
if (value == null) {
return (false);
@@ -74,7 +66,6 @@ final class ServletApplicationScopeMap i
return (false);
}
-
public Set<Entry<String, Object>> entrySet() {
Set<Entry<String, Object>> set = new HashSet<Entry<String, Object>>();
@SuppressWarnings( "unchecked" ) // it is known that attribute names are String
@@ -87,27 +78,22 @@ final class ServletApplicationScopeMap i
return (set);
}
-
public boolean equals(Object o) {
return (context.equals(o));
}
-
public Object get(Object key) {
return (context.getAttribute(key(key)));
}
-
public int hashCode() {
return (context.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
@SuppressWarnings( "unchecked" ) // it is known that attribute names are String
@@ -118,7 +104,6 @@ final class ServletApplicationScopeMap i
return (set);
}
-
public Object put(String key, Object value) {
if (value == null) {
return (remove(key));
@@ -128,15 +113,12 @@ final class ServletApplicationScopeMap i
return (previous);
}
-
public void putAll(Map<? extends String, ? extends Object> map) {
-
for (Entry<? extends String, ? extends Object> entry : map.entrySet()) {
put(key(entry.getKey()), entry.getValue());
}
}
-
public Object remove(Object key) {
String skey = key(key);
Object previous = context.getAttribute(skey);
@@ -144,7 +126,6 @@ final class ServletApplicationScopeMap i
return (previous);
}
-
public int size() {
int n = 0;
@SuppressWarnings( "unchecked" ) // it is known that attribute names are String
@@ -156,7 +137,6 @@ final class ServletApplicationScopeMap i
return (n);
}
-
public Collection<Object> values() {
List<Object> list = new ArrayList<Object>();
@@ -169,7 +149,6 @@ final class ServletApplicationScopeMap i
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -180,5 +159,4 @@ final class ServletApplicationScopeMap i
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletCookieMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletCookieMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletCookieMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletCookieMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -28,35 +27,28 @@ import javax.servlet.http.Cookie;
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for servlet cookies</p>
*
* @version $Id$
* @since Chain 1.1
*/
-
final class ServletCookieMap implements Map<String, Cookie> {
-
public ServletCookieMap(HttpServletRequest request) {
this.request = request;
}
-
private HttpServletRequest request = null;
-
public void clear() {
throw new UnsupportedOperationException();
}
-
public boolean containsKey(Object key) {
return (get(key) != null);
}
-
public boolean containsValue(Object value) {
Cookie[] cookies = request.getCookies();
if (cookies != null) {
@@ -69,7 +61,6 @@ final class ServletCookieMap implements
return (false);
}
-
public Set<Entry<String, Cookie>> entrySet() {
Set<Entry<String, Cookie>> set = new HashSet<Entry<String, Cookie>>();
Cookie[] cookies = request.getCookies();
@@ -81,12 +72,10 @@ final class ServletCookieMap implements
return (set);
}
-
public boolean equals(Object o) {
return (request.equals(o));
}
-
public Cookie get(Object key) {
Cookie[] cookies = request.getCookies();
if (cookies != null) {
@@ -99,17 +88,14 @@ final class ServletCookieMap implements
return null;
}
-
public int hashCode() {
return (request.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
Cookie[] cookies = request.getCookies();
@@ -121,7 +107,6 @@ final class ServletCookieMap implements
return (set);
}
-
public Cookie put(String key, Cookie value) {
throw new UnsupportedOperationException();
}
@@ -130,18 +115,15 @@ final class ServletCookieMap implements
throw new UnsupportedOperationException();
}
-
public Cookie remove(Object key) {
throw new UnsupportedOperationException();
}
-
public int size() {
Cookie[] cookies = request.getCookies();
return (cookies == null ? 0 : cookies.length);
}
-
public Collection<Cookie> values() {
List<Cookie> list = new ArrayList<Cookie>(size());
Cookie[] cookies = request.getCookies();
@@ -153,7 +135,6 @@ final class ServletCookieMap implements
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -164,5 +145,4 @@ final class ServletCookieMap implements
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommand.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommand.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletGetLocaleCommand.java Thu Jul 19 11:42:53 2012
@@ -16,28 +16,23 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import org.apache.commons.chain2.Context;
import org.apache.commons.chain2.web.AbstractGetLocaleCommand;
import javax.servlet.http.HttpServletRequest;
import java.util.Locale;
-
/**
* <p>Concrete implementation of {@link AbstractGetLocaleCommand} for
* the Servlet API.</p>
*
* @version $Id$
*/
-
public class ServletGetLocaleCommand
extends AbstractGetLocaleCommand<ServletWebContext> {
-
// ------------------------------------------------------- Protected Methods
-
/**
* <p>Retrieve and return the <code>Locale</code> for this request.</p>
*
@@ -45,12 +40,9 @@ public class ServletGetLocaleCommand
* @return The Locale for the request.
*/
protected Locale getLocale(ServletWebContext context) {
-
HttpServletRequest request = (HttpServletRequest)
context.get("request");
return (request.getLocale());
-
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletHeaderMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletHeaderMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletHeaderMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletHeaderMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,40 +27,32 @@ import javax.servlet.http.HttpServletReq
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for servlet request
* name-value.</p>
*
* @version $Id$
*/
-
final class ServletHeaderMap implements Map<String, String> {
-
public ServletHeaderMap(HttpServletRequest request) {
this.request = request;
}
-
private HttpServletRequest request = null;
-
public void clear() {
throw new UnsupportedOperationException();
}
-
public boolean containsKey(Object key) {
return (request.getHeader(key(key)) != null);
}
-
public boolean containsValue(Object value) {
return values().contains(value);
}
-
public Set<Entry<String, String>> entrySet() {
Set<Entry<String, String>> set = new HashSet<Entry<String, String>>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -74,27 +65,22 @@ final class ServletHeaderMap implements
return (set);
}
-
public boolean equals(Object o) {
return (request.equals(o));
}
-
public String get(Object key) {
return (request.getHeader(key(key)));
}
-
public int hashCode() {
return (request.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -105,22 +91,18 @@ final class ServletHeaderMap implements
return (set);
}
-
public String put(String key, String value) {
throw new UnsupportedOperationException();
}
-
public void putAll(Map<? extends String, ? extends String> map) {
throw new UnsupportedOperationException();
}
-
public String remove(Object key) {
throw new UnsupportedOperationException();
}
-
public int size() {
int n = 0;
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -132,7 +114,6 @@ final class ServletHeaderMap implements
return (n);
}
-
public Collection<String> values() {
List<String> list = new ArrayList<String>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -143,7 +124,6 @@ final class ServletHeaderMap implements
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -154,5 +134,4 @@ final class ServletHeaderMap implements
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletHeaderValuesMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletHeaderValuesMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletHeaderValuesMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletHeaderValuesMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,35 +27,28 @@ import javax.servlet.http.HttpServletReq
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for servlet request
* name-values[].</p>
*
* @version $Id$
*/
-
final class ServletHeaderValuesMap implements Map<String, String[]> {
-
public ServletHeaderValuesMap(HttpServletRequest request) {
this.request = request;
}
-
private HttpServletRequest request = null;
-
public void clear() {
throw new UnsupportedOperationException();
}
-
public boolean containsKey(Object key) {
return (request.getHeader(key(key)) != null);
}
-
public boolean containsValue(Object value) {
if (!(value instanceof String[])) {
return (false);
@@ -81,7 +73,6 @@ final class ServletHeaderValuesMap imple
return (false);
}
-
public Set<Entry<String, String[]>> entrySet() {
Set<Entry<String, String[]>> set = new HashSet<Entry<String, String[]>>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -101,12 +92,10 @@ final class ServletHeaderValuesMap imple
return (set);
}
-
public boolean equals(Object o) {
return (request.equals(o));
}
-
public String[] get(Object key) {
@SuppressWarnings( "unchecked" ) // it is known that header names are String
Enumeration<String> values = request.getHeaders(key(key));
@@ -115,17 +104,14 @@ final class ServletHeaderValuesMap imple
return valuesArray;
}
-
public int hashCode() {
return (request.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -136,22 +122,18 @@ final class ServletHeaderValuesMap imple
return (set);
}
-
public String[] put(String key, String[] value) {
throw new UnsupportedOperationException();
}
-
public void putAll(Map<? extends String, ? extends String[]> map) {
throw new UnsupportedOperationException();
}
-
public String[] remove(Object key) {
throw new UnsupportedOperationException();
}
-
public int size() {
int n = 0;
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -163,7 +145,6 @@ final class ServletHeaderValuesMap imple
return (n);
}
-
public Collection<String[]> values() {
List<String[]> list = new ArrayList<String[]>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -203,5 +184,4 @@ final class ServletHeaderValuesMap imple
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletInitParamMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletInitParamMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletInitParamMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletInitParamMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,40 +27,32 @@ import javax.servlet.ServletContext;
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for servlet context
* init parameters.</p>
*
* @version $Id$
*/
-
final class ServletInitParamMap implements Map<String, String> {
-
public ServletInitParamMap(ServletContext context) {
this.context = context;
}
-
private ServletContext context = null;
-
public void clear() {
throw new UnsupportedOperationException();
}
-
public boolean containsKey(Object key) {
return (context.getInitParameter(key(key)) != null);
}
-
public boolean containsValue(Object value) {
return values().contains(value);
}
-
public Set<Entry<String, String>> entrySet() {
Set<Entry<String, String>> set = new HashSet<Entry<String, String>>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -74,27 +65,22 @@ final class ServletInitParamMap implemen
return (set);
}
-
public boolean equals(Object o) {
return (context.equals(o));
}
-
public String get(Object key) {
return (context.getInitParameter(key(key)));
}
-
public int hashCode() {
return (context.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -110,17 +96,14 @@ final class ServletInitParamMap implemen
throw new UnsupportedOperationException();
}
-
public void putAll(Map<? extends String, ? extends String> map) {
throw new UnsupportedOperationException();
}
-
public String remove(Object key) {
throw new UnsupportedOperationException();
}
-
public int size() {
int n = 0;
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -132,7 +115,6 @@ final class ServletInitParamMap implemen
return (n);
}
-
public Collection<String> values() {
List<String> list = new ArrayList<String>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -143,7 +125,6 @@ final class ServletInitParamMap implemen
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -154,5 +135,4 @@ final class ServletInitParamMap implemen
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletParamMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletParamMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletParamMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletParamMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,40 +27,32 @@ import javax.servlet.http.HttpServletReq
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for servlet parameter
* name-value.</p>
*
* @version $Id$
*/
-
final class ServletParamMap implements Map<String, String> {
-
public ServletParamMap(HttpServletRequest request) {
this.request = request;
}
-
private HttpServletRequest request = null;
-
public void clear() {
throw new UnsupportedOperationException();
}
-
public boolean containsKey(Object key) {
return (request.getParameter(key(key)) != null);
}
-
public boolean containsValue(Object value) {
return values().contains(value);
}
-
public Set<Entry<String, String>> entrySet() {
Set<Entry<String, String>> set = new HashSet<Entry<String, String>>();
@SuppressWarnings( "unchecked" ) // it is known that Servlet request parameter names are String
@@ -74,27 +65,22 @@ final class ServletParamMap implements M
return (set);
}
-
public boolean equals(Object o) {
return (request.equals(o));
}
-
public String get(Object key) {
return (request.getParameter(key(key)));
}
-
public int hashCode() {
return (request.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
@SuppressWarnings( "unchecked" ) // it is known that Servlet request parameter names are String
@@ -105,22 +91,18 @@ final class ServletParamMap implements M
return (set);
}
-
public String put(String key, String value) {
throw new UnsupportedOperationException();
}
-
public void putAll(Map<? extends String, ? extends String> map) {
throw new UnsupportedOperationException();
}
-
public String remove(Object key) {
throw new UnsupportedOperationException();
}
-
public int size() {
int n = 0;
@SuppressWarnings( "unchecked" ) // it is known that Servlet request parameter names are String
@@ -132,7 +114,6 @@ final class ServletParamMap implements M
return (n);
}
-
public Collection<String> values() {
List<String> list = new ArrayList<String>();
@SuppressWarnings( "unchecked" ) // it is known that Servlet request parameter names are String
@@ -143,7 +124,6 @@ final class ServletParamMap implements M
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -154,5 +134,4 @@ final class ServletParamMap implements M
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletParamValuesMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletParamValuesMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletParamValuesMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletParamValuesMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,40 +27,32 @@ import javax.servlet.http.HttpServletReq
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for servlet parameter
* name-values[].</p>
*
* @version $Id$
*/
-
final class ServletParamValuesMap implements Map<String, String[]> {
-
public ServletParamValuesMap(HttpServletRequest request) {
this.request = request;
}
-
private HttpServletRequest request = null;
-
public void clear() {
throw new UnsupportedOperationException();
}
-
public boolean containsKey(Object key) {
return (request.getParameter(key(key)) != null);
}
-
public boolean containsValue(Object value) {
return values().contains(value);
}
-
public Set<Entry<String, String[]>> entrySet() {
Set<Entry<String, String[]>> set = new HashSet<Entry<String, String[]>>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -74,27 +65,22 @@ final class ServletParamValuesMap implem
return (set);
}
-
public boolean equals(Object o) {
return (request.equals(o));
}
-
public String[] get(Object key) {
return (request.getParameterValues(key(key)));
}
-
public int hashCode() {
return (request.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -105,22 +91,18 @@ final class ServletParamValuesMap implem
return (set);
}
-
public String[] put(String key, String[] value) {
throw new UnsupportedOperationException();
}
-
public void putAll(Map<? extends String, ? extends String[]> map) {
throw new UnsupportedOperationException();
}
-
public String[] remove(Object key) {
throw new UnsupportedOperationException();
}
-
public int size() {
int n = 0;
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -132,7 +114,6 @@ final class ServletParamValuesMap implem
return (n);
}
-
public Collection<String[]> values() {
List<String[]> list = new ArrayList<String[]>();
@SuppressWarnings( "unchecked" ) // it is known that header names are String
@@ -143,7 +124,6 @@ final class ServletParamValuesMap implem
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -154,5 +134,4 @@ final class ServletParamValuesMap implem
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletPathMapper.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletPathMapper.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletPathMapper.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletPathMapper.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import org.apache.commons.chain2.Catalog;
import org.apache.commons.chain2.Command;
import org.apache.commons.chain2.Context;
@@ -24,7 +23,6 @@ import org.apache.commons.chain2.generic
import javax.servlet.http.HttpServletRequest;
-
/**
* <p>{@link Command} that uses the "servlet path" component of the request URI
* to select a {@link Command} from the appropriate {@link Catalog}, and
@@ -36,19 +34,14 @@ import javax.servlet.http.HttpServletReq
*
* @version $Id$
*/
-
public class ServletPathMapper extends LookupCommand<String, Object, ServletWebContext> {
-
// ------------------------------------------------------ Instance Variables
-
private String catalogKey = ChainProcessor.CATALOG_DEFAULT;
-
// -------------------------------------------------------------- Properties
-
/**
* <p>Return the context key under which our {@link Catalog} has been
* stored.</p>
@@ -60,12 +53,9 @@ public class ServletPathMapper extends L
*/
@Deprecated
public String getCatalogKey() {
-
return (this.catalogKey);
-
}
-
/**
* <p>Set the context key under which our {@link Catalog} has been
* stored.</p>
@@ -77,15 +67,11 @@ public class ServletPathMapper extends L
*/
@Deprecated
public void setCatalogKey(String catalogKey) {
-
this.catalogKey = catalogKey;
-
}
-
// --------------------------------------------------------- Command Methods
-
/**
* <p>Look up the servlet path information for this request, and use it to
* select an appropriate {@link Command} to be executed.
@@ -106,7 +92,6 @@ public class ServletPathMapper extends L
}
return servletPath;
-
}
/**
@@ -121,7 +106,6 @@ public class ServletPathMapper extends L
*/
@Override
protected Catalog<String, Object, ServletWebContext> getCatalog(ServletWebContext context) {
-
/* If the object returned from the passed context is not a valid catalog
* then we use the super class's catalog extraction logic to pull it
* or to error gracefully.
@@ -137,7 +121,6 @@ public class ServletPathMapper extends L
super.getCatalog(context);
return catalog;
-
}
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletRequestScopeMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletRequestScopeMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletRequestScopeMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletRequestScopeMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -28,37 +27,30 @@ import javax.servlet.http.HttpServletReq
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for servlet request
* attributes.</p>
*
* @version $Id$
*/
-
final class ServletRequestScopeMap implements Map<String, Object> {
-
public ServletRequestScopeMap(HttpServletRequest request) {
this.request = request;
}
-
private HttpServletRequest request = null;
-
public void clear() {
for (String key : keySet()) {
request.removeAttribute(key);
}
}
-
public boolean containsKey(Object key) {
return (request.getAttribute(key(key)) != null);
}
-
public boolean containsValue(Object value) {
if (value == null) {
return (false);
@@ -74,7 +66,6 @@ final class ServletRequestScopeMap imple
return (false);
}
-
public Set<Entry<String, Object>> entrySet() {
Set<Entry<String, Object>> set = new HashSet<Entry<String, Object>>();
@SuppressWarnings( "unchecked" ) // it is known that attribute names are String
@@ -87,27 +78,22 @@ final class ServletRequestScopeMap imple
return (set);
}
-
public boolean equals(Object o) {
return (request.equals(o));
}
-
public Object get(Object key) {
return (request.getAttribute(key(key)));
}
-
public int hashCode() {
return (request.hashCode());
}
-
public boolean isEmpty() {
return (size() < 1);
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
@SuppressWarnings( "unchecked" ) // it is known that attribute names are String
@@ -118,7 +104,6 @@ final class ServletRequestScopeMap imple
return (set);
}
-
public Object put(String key, Object value) {
if (value == null) {
return (remove(key));
@@ -128,15 +113,12 @@ final class ServletRequestScopeMap imple
return (previous);
}
-
public void putAll(Map<? extends String, ? extends Object> map) {
for (Entry<? extends String, ? extends Object> entry : map.entrySet()) {
put(key(entry.getKey()), entry.getValue());
}
-
}
-
public Object remove(Object key) {
String skey = key(key);
Object previous = request.getAttribute(skey);
@@ -144,7 +126,6 @@ final class ServletRequestScopeMap imple
return (previous);
}
-
public int size() {
int n = 0;
@SuppressWarnings( "unchecked" ) // it is known that attribute names are String
@@ -156,7 +137,6 @@ final class ServletRequestScopeMap imple
return (n);
}
-
public Collection<Object> values() {
List<Object> list = new ArrayList<Object>();
@SuppressWarnings( "unchecked" ) // it is known that attribute names are String
@@ -167,7 +147,6 @@ final class ServletRequestScopeMap imple
return (list);
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
@@ -178,5 +157,4 @@ final class ServletRequestScopeMap imple
}
}
-
}
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSessionScopeMap.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSessionScopeMap.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSessionScopeMap.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSessionScopeMap.java Thu Jul 19 11:42:53 2012
@@ -16,7 +16,6 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -29,26 +28,22 @@ import javax.servlet.http.HttpServletReq
import org.apache.commons.chain2.web.MapEntry;
-
/**
* <p>Private implementation of <code>Map</code> for HTTP session
* attributes.</p>
*
* @version $Id$
*/
-
final class ServletSessionScopeMap implements Map<String, Object> {
-
public ServletSessionScopeMap(HttpServletRequest request) {
this.request = request;
sessionExists();
}
-
private HttpSession session = null;
- private HttpServletRequest request = null;
+ private HttpServletRequest request = null;
public void clear() {
if (sessionExists()) {
@@ -58,12 +53,10 @@ final class ServletSessionScopeMap imple
}
}
-
public boolean containsKey(Object key) {
return sessionExists() && session.getAttribute(key(key)) != null;
}
-
public boolean containsValue(Object value) {
if (value == null || !sessionExists()) {
return false;
@@ -79,7 +72,6 @@ final class ServletSessionScopeMap imple
return false;
}
-
public Set<Entry<String, Object>> entrySet() {
Set<Entry<String, Object>> set = new HashSet<Entry<String, Object>>();
if (sessionExists()) {
@@ -94,12 +86,10 @@ final class ServletSessionScopeMap imple
return set;
}
-
public boolean equals(Object o) {
return sessionExists() && session.equals(o);
}
-
public Object get(Object key) {
if (sessionExists()) {
return session.getAttribute(key(key));
@@ -107,7 +97,6 @@ final class ServletSessionScopeMap imple
return null;
}
-
public int hashCode() {
if (sessionExists()) {
return session.hashCode();
@@ -115,12 +104,10 @@ final class ServletSessionScopeMap imple
return 0;
}
-
public boolean isEmpty() {
return !sessionExists() || !session.getAttributeNames().hasMoreElements();
}
-
public Set<String> keySet() {
Set<String> set = new HashSet<String>();
if (sessionExists()) {
@@ -133,7 +120,6 @@ final class ServletSessionScopeMap imple
return set;
}
-
public Object put(String key, Object value) {
if (value == null) {
return remove(key);
@@ -151,14 +137,12 @@ final class ServletSessionScopeMap imple
return previous;
}
-
public void putAll(Map<? extends String, ? extends Object> map) {
for (Entry<? extends String, ? extends Object> entry : map.entrySet()) {
put(key(entry.getKey()), entry.getValue());
}
}
-
public Object remove(Object key) {
if (sessionExists()) {
String skey = key(key);
@@ -169,7 +153,6 @@ final class ServletSessionScopeMap imple
return null;
}
-
public int size() {
int n = 0;
if (sessionExists()) {
@@ -183,7 +166,6 @@ final class ServletSessionScopeMap imple
return n;
}
-
public Collection<Object> values() {
List<Object> list = new ArrayList<Object>();
if (sessionExists()) {
@@ -196,7 +178,6 @@ final class ServletSessionScopeMap imple
return list;
}
-
private String key(Object key) {
if (key == null) {
throw new IllegalArgumentException();
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommand.java?rev=1363305&r1=1363304&r2=1363305&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommand.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletSetLocaleCommand.java Thu Jul 19 11:42:53 2012
@@ -16,28 +16,23 @@
*/
package org.apache.commons.chain2.web.servlet;
-
import org.apache.commons.chain2.Context;
import org.apache.commons.chain2.web.AbstractSetLocaleCommand;
import javax.servlet.http.HttpServletResponse;
import java.util.Locale;
-
/**
* <p>Concrete implementation of {@link AbstractSetLocaleCommand} for
* the Servlet API.</p>
*
* @version $Id$
*/
-
public class ServletSetLocaleCommand
extends AbstractSetLocaleCommand<ServletWebContext> {
-
// ------------------------------------------------------- Protected Methods
-
/**
* <p>Establish the specified <code>Locale</code> for this response.</p>
*
@@ -45,12 +40,9 @@ public class ServletSetLocaleCommand
* @param locale The Locale for the request.
*/
protected void setLocale(ServletWebContext context, Locale locale) {
-
HttpServletResponse response = (HttpServletResponse)
context.get("response");
response.setLocale(locale);
-
}
-
}