Writing Servlet 2.3 Filters
Subject:   Implementing Filter Servlet for WebServices in WebLogic
Date:   2003-06-20 21:00:17
From:   anonymous2
This article addresses response object sent by servlets through filter. But when the SOAP over HTTP response is sent by a WebService (a Servlet in J2EE implementation), as it uses OutputStream to send the response object, the same response in the filter servlet is not available to modify. Is there any example/sample/implementation where the same is achieved to read through the response and make any change required to the response object.

Thanks in advance for any info on this.


Full Threads Newest First

Showing messages 1 through 1 of 1.

  • Implementing Filter Servlet for WebServices in WebLogic
    2003-08-28 09:53:45  vaddanki [View]

    Hi Chetan,

    the doFilter method of Filter has this prototype
    public void doFilter(ServletRequest request,
    ServletResponse response,
    FilterChain chain)

    You can get the output stream using the following code
    ServletOutputStream out = response.
    getOutputStream ();

    It is the responsibility of the container (implementing servlet api 2.3 or above) to call the doFilter method with the correct args -- even in the case of a web service.

    Hope it helps.