Author: julien(a)jboss.com
Date: 2008-04-11 18:45:56 -0400 (Fri, 11 Apr 2008)
New Revision: 10546
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java
Log:
generification a bit
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java 2008-04-11
22:23:08 UTC (rev 10545)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java 2008-04-11
22:45:56 UTC (rev 10546)
@@ -30,7 +30,6 @@
import org.jboss.portal.portlet.OpaqueStateString;
import java.util.Map;
-import java.util.Iterator;
/**
* This class is a possible implementation for the behavior of a request made to a
portlet. Which means that this
@@ -99,11 +98,11 @@
/** . */
private int type;
- public void decode(Map queryParams, Map bodyParams) throws IllegalArgumentException
+ public void decode(Map<String, String[]> queryParams, Map<String,
String[]> bodyParams) throws IllegalArgumentException
{
// The meta info from the URL
int meta = 0;
- String[] metaParam = (String[])queryParams.get(META_PARAMETER);
+ String[] metaParam = queryParams.get(META_PARAMETER);
if (metaParam != null)
{
try
@@ -138,7 +137,7 @@
// Get the mode from the parameters if it exists
if ((meta & MODE_MASK) != 0)
{
- String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
+ String[] modeParam = queryParams.get(MODE_PARAMETER);
if (modeParam == null)
{
throw new IllegalArgumentException();
@@ -153,7 +152,7 @@
// Get the window state from the parameters if it exists
if ((meta & WINDOW_STATE_MASK) != 0)
{
- String[] windowStateParam =
(String[])queryParams.get(WINDOW_STATE_PARAMETER);
+ String[] windowStateParam = queryParams.get(WINDOW_STATE_PARAMETER);
if (windowStateParam == null)
{
throw new IllegalArgumentException();
@@ -171,12 +170,11 @@
{
// Compute the parameters skipping the portlet navigational state that may be
encoded as well
ParametersStateString query = ParametersStateString.create();
- for (Iterator i = queryParams.entrySet().iterator(); i.hasNext();)
+ for (Map.Entry<String, String[]> entry : queryParams.entrySet())
{
- Map.Entry entry = (Map.Entry)i.next();
int index = 0;
- String name = (String)entry.getKey();
- String[] queryValues = (String[])entry.getValue();
+ String name = entry.getKey();
+ String[] queryValues = entry.getValue();
//
if (META_PARAMETER.equals(name))
@@ -225,7 +223,7 @@
else
{
// Decode the navigational state
- String[] ns = (String[])queryParams.get(NAVIGATIONAL_STATE_PARAMETER);
+ String[] ns = queryParams.get(NAVIGATIONAL_STATE_PARAMETER);
if (ns != null)
{
navigationalstate = new OpaqueStateString(ns[0]);
@@ -239,7 +237,7 @@
if (type == ACTION_TYPE)
{
// Decode the interaction state
- String[] is = (String[])queryParams.get(INTERACTION_STATE_PARAMETER);
+ String[] is = queryParams.get(INTERACTION_STATE_PARAMETER);
if (is != null)
{
interactionState = new OpaqueStateString(is[0]);
@@ -269,7 +267,7 @@
type = NAV_TYPE;
// Get the mode from the parameters if it exists
- String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
+ String[] modeParam = queryParams.get(MODE_PARAMETER);
if (modeParam != null)
{
mode = Mode.create(modeParam[0]);
@@ -280,7 +278,7 @@
}
// Get the window state from the parameters if it exists
- String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
+ String[] windowStateParam = queryParams.get(WINDOW_STATE_PARAMETER);
if (windowStateParam != null)
{
windowState = WindowState.create(windowStateParam[0]);
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java 2008-04-11
22:23:08 UTC (rev 10545)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java 2008-04-11
22:45:56 UTC (rev 10546)
@@ -29,7 +29,6 @@
import org.jboss.portal.common.util.ParameterMap;
import java.util.Map;
-import java.util.Iterator;
/**
* This class is designed to provide the encoding in the query string of a URL of the
following state :
@@ -161,11 +160,10 @@
private void configure(Map<String, String[]> parameters)
{
- for (Iterator i = parameters.entrySet().iterator(); i.hasNext();)
+ for (Map.Entry<String, String[]> entry : parameters.entrySet())
{
- Map.Entry entry = (Map.Entry)i.next();
- String name = (String)entry.getKey();
- String[] values = (String[])entry.getValue();
+ String name = entry.getKey();
+ String[] values = entry.getValue();
queryParameters.setValues(name, values);
}
}
Show replies by date