This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sri Sri
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic