aspose file tools*
The moose likes Portals and Portlets and the fly likes modify the HTTP Header with a Filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "modify the HTTP Header with a Filter" Watch "modify the HTTP Header with a Filter" New topic
Author

modify the HTTP Header with a Filter

Florian Weber I
Greenhorn

Joined: Nov 16, 2011
Posts: 2
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

Joined: Nov 16, 2011
Posts: 2
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: modify the HTTP Header with a Filter