Example usage for org.apache.wicket.protocol.http BufferedWebResponse close

List of usage examples for org.apache.wicket.protocol.http BufferedWebResponse close

Introduction

In this page you can find the example usage for org.apache.wicket.protocol.http BufferedWebResponse close.

Prototype

public void close() 

Source Link

Document

Closes the response

Usage

From source file:name.martingeisse.wicket.util.ResponseFlusher.java

License:Open Source License

@Override
protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    /*/*from   ww w .ja va  2 s.  c o m*/
     * Flush early to allow the browser to load satellite files while the server
     * is performing the search. Flushing has been tested to work (using a
     * delay after flushing) and has the obvious effect that a subsequent
     * exception will print the stack trace / page expired below the flushed
     * HEAD, so use the early flusher with care!
     */
    Response response = RequestCycle.get().getResponse();
    if (response instanceof BufferedWebResponse) {
        BufferedWebResponse bufferedWebResponse = (BufferedWebResponse) response;
        // the following lines are Wicketese for "flush"
        bufferedWebResponse.close();
        bufferedWebResponse.reset();
        try {
            ((HttpServletResponse) bufferedWebResponse.getContainerResponse()).flushBuffer();
        } catch (IOException e) {
        }
    }

}