<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: HttpServletRequestWrapper, Tomcat and forwards</title>
	<atom:link href="http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/feed/" rel="self" type="application/rss+xml" />
	<link>http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/</link>
	<description>Brian Pontarelli</description>
	<lastBuildDate>Wed, 08 Feb 2012 15:34:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>By: Pia</title>
		<link>http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/#comment-141841</link>
		<dc:creator>Pia</dc:creator>
		<pubDate>Wed, 01 Feb 2012 15:43:19 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/#comment-141841</guid>
		<description>I am facing the same problem that you described: I have a subclassed HttpServletRequestWrapper which I am using to check/add parameters to the request. I am using a filter that wraps this request. While forwarding my filtered request, tomcat overrides the new request and keeps mine intact. Tomcat doesn&#039;t throw any exceptions, just neatly replaces the original request.
I tried your solution but it doesn&#039;t work for me! Am I missing something?</description>
		<content:encoded><![CDATA[<p>I am facing the same problem that you described: I have a subclassed HttpServletRequestWrapper which I am using to check/add parameters to the request. I am using a filter that wraps this request. While forwarding my filtered request, tomcat overrides the new request and keeps mine intact. Tomcat doesn&#8217;t throw any exceptions, just neatly replaces the original request.<br />
I tried your solution but it doesn&#8217;t work for me! Am I missing something?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/#comment-135421</link>
		<dc:creator>David</dc:creator>
		<pubDate>Fri, 12 Aug 2011 14:16:36 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/#comment-135421</guid>
		<description>Hi.

Possibly is not exactly the correct place, but I need to resolve this stuff and your blog is related with this, so I ask you for some help.


I&#039;m using tomcat 5.0.x and trying to get the parameters in URL I get null.

1 way:
for (String requestName : requests.keySet()) {
			if (requests.get(requestName) instanceof HttpServletRequestWrapper) {
				request = (HttpServletRequest) ((HttpServletRequestWrapper) requests
						.get(requestName)).getRequest();
				retVal = request.getParameter(&quot;area&quot;);
				System.out.println(&quot;retVal: &quot; + retVal);
			}
		}

2 way:
Map params = fc.getExternalContext().getRequestParameterMap();
	Iterator it = params.entrySet().iterator();
			while (it.hasNext()) {
				Map.Entry pairs = (Map.Entry) it.next();
				System.out.println(pairs.getKey() + &quot; = &quot; + pairs.getValue());
			}

3 way:
String area = (String) FacesContext.getCurrentInstance()
				.getExternalContext().getRequestParameterMap().get(&quot;area&quot;);

4 way:
area = fc.getCurrentInstance().getExternalContext()
				.getRequestParameterMap().get(&quot;area&quot;);

and the simple url in index.jsp











Thanks</description>
		<content:encoded><![CDATA[<p>Hi.</p>
<p>Possibly is not exactly the correct place, but I need to resolve this stuff and your blog is related with this, so I ask you for some help.</p>
<p>I&#8217;m using tomcat 5.0.x and trying to get the parameters in URL I get null.</p>
<p>1 way:<br />
for (String requestName : requests.keySet()) {<br />
			if (requests.get(requestName) instanceof HttpServletRequestWrapper) {<br />
				request = (HttpServletRequest) ((HttpServletRequestWrapper) requests<br />
						.get(requestName)).getRequest();<br />
				retVal = request.getParameter(&#8220;area&#8221;);<br />
				System.out.println(&#8220;retVal: &#8221; + retVal);<br />
			}<br />
		}</p>
<p>2 way:<br />
Map params = fc.getExternalContext().getRequestParameterMap();<br />
	Iterator it = params.entrySet().iterator();<br />
			while (it.hasNext()) {<br />
				Map.Entry pairs = (Map.Entry) it.next();<br />
				System.out.println(pairs.getKey() + &#8221; = &#8221; + pairs.getValue());<br />
			}</p>
<p>3 way:<br />
String area = (String) FacesContext.getCurrentInstance()<br />
				.getExternalContext().getRequestParameterMap().get(&#8220;area&#8221;);</p>
<p>4 way:<br />
area = fc.getCurrentInstance().getExternalContext()<br />
				.getRequestParameterMap().get(&#8220;area&#8221;);</p>
<p>and the simple url in index.jsp</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Pontarelli</title>
		<link>http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/#comment-8932</link>
		<dc:creator>Brian Pontarelli</dc:creator>
		<pubDate>Thu, 21 Feb 2008 15:02:11 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/#comment-8932</guid>
		<description>It was pretty simple. I just wrapped the request so that the request URI was something different. This was done in a filter. The request got passed down to struts and struts pulled out the new URI correctly and invoked the action. Once the action finished Struts tried to forward the request to the JSP and this is where it failed. The container was unable to perform the forward because the HttpServletRequest that was being passed to the request dispatcher had a different request URI and was a wrapper. Tomcat doesn&#039;t like that and was throwing some strange exceptions back.</description>
		<content:encoded><![CDATA[<p>It was pretty simple. I just wrapped the request so that the request URI was something different. This was done in a filter. The request got passed down to struts and struts pulled out the new URI correctly and invoked the action. Once the action finished Struts tried to forward the request to the JSP and this is where it failed. The container was unable to perform the forward because the HttpServletRequest that was being passed to the request dispatcher had a different request URI and was a wrapper. Tomcat doesn&#8217;t like that and was throwing some strange exceptions back.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/#comment-8819</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 19 Feb 2008 21:42:28 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/01/16/httpservletrequestwrapper-tomcat-and-forwards/#comment-8819</guid>
		<description>How did you discover that tomcat failed on forwards when the request had been wrapped? I can&#039;t find any information online and the workaround you are using will not work for me since I need to have the wrapped request for the resource being forwarded to.</description>
		<content:encoded><![CDATA[<p>How did you discover that tomcat failed on forwards when the request had been wrapped? I can&#8217;t find any information online and the workaround you are using will not work for me since I need to have the wrapped request for the resource being forwarded to.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

