/*
 * Created on 2004/08/16
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package com.jware.base.web.struts;

import java.util.Map;
import java.util.TreeMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

/**
 * @author jrmt
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class jWareBaseHttpServletRequestWrapper extends HttpServletRequestWrapper {

	private Map paramValues = new TreeMap();

	private String requestURI = null;

	public jWareBaseHttpServletRequestWrapper(HttpServletRequest request) { 
		super(request);
		requestURI = request.getRequestURI();
	}

	public void setParameterValues(String paramName, String [] paramValues) { 
	if (paramValues==null || paramValues.length==0) 
		throw new RuntimeException( "Illegal Values for parameter name= "+paramName); 
	else 
		this.paramValues.put(paramName,paramValues); 
	} 

	public String getParameter(String paramName) { 
		String [] allValues = (String[]) this.paramValues.get(paramName); 
		return allValues==null ? null : (allValues)[0]; 
	} 

	public String [] getParameterValues(String paramName) { 
		return (String[]) this.paramValues.get(paramName); 
	} 

	
	/**
	 * @return
	 */
	public Map getParamValues() {
		return paramValues;
	}

	/**
	 * @return
	 */
	public String getRequestURI() {
		return requestURI;
	}

	/**
	 * @param map
	 */
	public void setParamValues(Map map) {
		paramValues = map;
	}

	/**
	 * @param string
	 */
	public void setRequestURI(String string) {
		requestURI = string;
	}

}
