Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

modify the HTTP Header with a Filter

 
Florian Weber I
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

I am using a Liferay 6.X Portal bundled with a Tomcat 6.0.29 Server.
I want to modify the HTTP-Header information (filtering line breaks in parameters to prevent a Header Injection) and I am trying to do that with a filter.
After finding this example: http://vangjee.wordpress.com/2009/02/25/how-to-modify-request-headers-in-a-j2ee-web-application/ I tried to rebuild it for my own purpose. As a first Test I deleted the cookie stuff so the filter is doing nothing but passing the data.

Everything went good, I got no Java Errors or something until I tried to add the Filter in my Configuration-File.
After adding the Filter, the Site crashes and I get a 404 response.

I am totally clueless what is going wrong, but I suspect the configuration written inside the web.xml:


My Filter Class looks like:


and the class where I want to modify the header data:


It would be very great if someone could help me out with that!
 
Florian Weber I
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I finally had some progress on this issue.

For Liferay you need to use specific Render- and Action Filters and configure them in your portlet.xml.
This is what you need to configure in your Portlet.xml:


And this is my Filter so far:


The Problem I now have is that my ActionRequest has only the Portlet Parameters and I can't filter the Liferay Specific Parameters (p_auth, p_p_id, p_p_lifecycle, p_p_state, p_p_mode, p_p_col_id, p_p_col_count).

Can anyone give me some input on this problem, please?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic