Search in sources :

Example 1 with IHttpServletResponse

use of com.genexus.servlet.http.IHttpServletResponse in project JavaClasses by genexuslabs.

the class CustomFilter method doFilter.

public void doFilter(IServletRequest request, IServletResponse response, IFilterChain chain) throws Exception {
    if (request != null && request.isHttpServletRequest()) {
        IHttpServletRequest req = request.getHttpServletRequest();
        String url = req.getRequestURL().toString();
        if (url.contains("apple-app-site-association")) {
            IHttpServletResponse resp = response.getHttpServletResponse();
            resp.setContentType("application/json");
        }
    }
    // pass the request along the filter chain
    chain.doFilter(request, response);
}
Also used : IHttpServletRequest(com.genexus.servlet.http.IHttpServletRequest) IHttpServletResponse(com.genexus.servlet.http.IHttpServletResponse)

Example 2 with IHttpServletResponse

use of com.genexus.servlet.http.IHttpServletResponse in project JavaClasses by genexuslabs.

the class HttpContextWeb method flushStream.

public void flushStream() {
    proxyCookieValues();
    try {
        if (buffered) {
            // Esto en realidad cierra el ZipOutputStream, o el ByteOutputStream, no cierra
            // el del
            // servlet... Es necesario hacerlo, dado que sino el GZip no hace el flush de
            // los datos
            // que se grabaron al bytearray
            closeOutputStream();
            IHttpServletResponse response = getResponse();
            if (buffer != null && !response.isCommitted()) {
                IServletOutputStream stream = response.getOutputStream();
                response.setContentLength(buffer.size());
                buffer.writeToOutputStream(stream.getOutputStream());
                stream.close();
            }
        } else {
            closeOutputStream();
        }
    } catch (IOException e) {
        log.error("Error flushing stream", e);
    }
}
Also used : IHttpServletResponse(com.genexus.servlet.http.IHttpServletResponse) IOException(java.io.IOException)

Aggregations

IHttpServletResponse (com.genexus.servlet.http.IHttpServletResponse)2 IHttpServletRequest (com.genexus.servlet.http.IHttpServletRequest)1 IOException (java.io.IOException)1