Mantis - Resin
Viewing Issue Advanced Details
5777 major always 07-16-14 04:17 09-12-14 13:56
wxiaoguang  
ferg  
normal  
closed 4.0.39  
fixed  
none    
none 4.0.41  
0005777: resin + gzip hangs with Content-Length header in response
package com.springapp.mvc;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
@RequestMapping("/")
public class TestController {


/*
in resin.xml:
    <filter filter-name="gzip" filter-class="com.caucho.filters.GzipFilter"/>
    <filter-mapping url-pattern="*.api" filter-name="gzip"/>

resin + gzip hangs forever
caused by "Content-Length" in response header
*/

    @RequestMapping(value = "test.api", method = RequestMethod.GET)
    public void test(HttpServletResponse response) throws IOException {
        String s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

        //if this line is commented out, resin won't hang
        response.setIntHeader("Content-Length", s.length());

        response.getOutputStream().write(s.getBytes());

        System.out.println("response done");
    }
}
 resin-gzip-hang-test.zip [^] (3,475 bytes) 07-16-14 04:17

Notes
(0006529)
ferg   
09-12-14 13:56   
server/183w