Skip to content

Instantly share code, notes, and snippets.

@devtdeng
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devtdeng/eccbe119fb0652ff111b to your computer and use it in GitHub Desktop.
Save devtdeng/eccbe119fb0652ff111b to your computer and use it in GitHub Desktop.
test code
package test;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicLong;
import java.util.zip.GZIPOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GreetingController {
@RequestMapping("/zipContentNoType")
public void zipContentNoType(HttpServletResponse response) throws IOException {
response.setHeader("Content-Encoding", "gzip");
GZIPOutputStream zipOutputStream = new GZIPOutputStream(response.getOutputStream());
zipOutputStream.write("zipContentNoType".getBytes("UTF-8"));
zipOutputStream.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment