GeeCON Prague 2014*
The moose likes BEA/Weblogic and the fly likes Weblogic Servlet Filter to modify request or response header for Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Weblogic Servlet Filter to modify request or response header for "Connection"" Watch "Weblogic Servlet Filter to modify request or response header for "Connection"" New topic
Author

Weblogic Servlet Filter to modify request or response header for "Connection"

Sri Sri
Greenhorn

Joined: Jun 17, 2009
Posts: 2
Here is my problem, I need to modify HTTP Connection header in the response. Weblogic is sending "Connection:close", I want to send "Connection: Keep-Alive", I know this is violating the standards, but one of the HTTPClients is behaving wierd, that is the reason I am forced to do this on the server side.

In order to achieve this I am trying to write a Servlet Filter. But the problem is, weblogic is wrapping request and response to its internal classes.
weblogic.servlet.internal.ServletRequestImpl;
weblogic.servlet.internal.ServletResponseImpl;

How can I achieve something like avoid using weblogic internal classes (i.e., may be remove weblogic.jar) from classpath and add j2ee.jar in the classpath so that I can get HttpServletRequestWrapper and HttpServletResponseWrapper so that I can override getHeader(String) Method by extending HttpServletRequestWrapper class using a filter.



When I remove weblogic.jar from classpath, I am not able to start weblogic server.

Any clues??

Thanks in advance for your help. BTW I am using Weblogic 9.x



Ed Ward
Ranch Hand

Joined: Jan 30, 2006
Posts: 147
What WL version?

In WL10 there are a couple of HTTP config settings for the managed servers which look like they may control this.
Check what the "Enable Keepalives", Duration and HTTS Duration are set at.


Though the docs show the min value is 5 seconds, so might be barking up the wrong tree here.

http://e-docs.bea.com/wls/docs100/ConsoleHelp/pagehelp/Corecoreserverserverprotocolshttptitle.html#attributes

Sri Sri
Greenhorn

Joined: Jun 17, 2009
Posts: 2
Ed Ward,

Thanks for your reply. I am using Weblogic 9.2. It seems in Weblogic there is no way you can modify standard HTTP headers using Servlet Filters.

The configuration you are pointing is to enable/disable keep-alive and modify keep alive time.

Thanks,
Harish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Weblogic Servlet Filter to modify request or response header for "Connection"