[jboss-user] [Installation, Configuration & Deployment] - Re: Configuration to remove key Server from HTTP header

jijisv do-not-reply at jboss.com
Thu Jul 20 02:17:43 EDT 2006


Ya.. I removed that from the header. I want to remove the Server also.

I put a Valve in the request/reponse processing pipeline and tried to change value of the key Server. but wat i got is the key Server got added twice in the header.

HTTP/1.1 200 OK
  | Server: Apache-Coyote/1.1
  | Set-Cookie: JSESSIONID=BAEB56FBC19BEE1B1C5FECBBBEBA5C80; Path=/; Secure
  | 
  | Stored cookie 192.168.3.156 443 / nonpermanent 1 Thu Jan  1 05:29:59 1970
  |  JSESSIONID BAEB56FBC19BEE1B1C5FECBBBEBA5C80
  | Server: My Server
  | Content-Type: text/html
  | Content-Length: 0
  | Date: Thu, 20 Jul 2006 08:25:34 GMT
  | Connection: keep-alive

...and my Source code is 


import javax.servlet.http.HttpServletResponse;
  | import java.io.IOException;
  | import javax.servlet.ServletException;
  | import org.apache.catalina.connector.Request;
  | import org.apache.catalina.connector.Response;
  | import org.apache.commons.logging.Log;
  | import org.apache.catalina.valves.ValveBase;
  | 
  | public class KnHttpRequestFilterValve extends ValveBase {
  | 
  |     private static final String info = KnHttpRequestFilterValve.class.getName() + "/1.0";
  | 
  |     public String getInfo() {
  |         return info;
  |     }
  | 
  |     public void invoke(Request request, Response response)
  |         throws IOException, ServletException {
  | 
  |         Log log = container.getLogger();
  |         // process request
  |         log.debug("Processing Request...");
  |         processRequest(request, response);
  | 
  |         // call next valve
  |         getNext().invoke(request, response);
  | 
  |         // process response
  |         log.debug("Processing Responses...");
  |         processResponse(request, response);
  |     }
  | 
  |     private void processRequest(Request request, Response response)
  |         throws IOException, ServletException {
  |     }
  | 
  |     private void processResponse(Request request, Response response)
  |         throws IOException, ServletException {
  | 
  |         if (response instanceof HttpServletResponse) {
  |             ((HttpServletResponse)response).setHeader("Server", "My Server");
  |         }
  |     }
  | }
  | 

... and the valve configuration is 


 <Host name="localhost" 
  |     autoDeploy="false" deployOnStartup="false" deployXML="false">
  |    
  |    <Valve className="com.kodiak.wgp.container.util.KnHttpRequestFilterValve" />
  |    .......
  |    .......

I feel like the key Server is put in the last stage of response processing pipeline.  Any idea to remove this ??

Thanks,
Jiji

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959432#3959432

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959432



More information about the jboss-user mailing list