Integration guide
Spring Boot compression integration
Spring Boot powers enterprise Java applications. Add SuperCompress as a Spring interceptor or filter.
Spring interceptor
@Component
public class CompressionInterceptor implements HandlerInterceptor {
private final RestTemplate restTemplate = new RestTemplate();
private final String apiKey = System.getenv("SUPERCOMPRESS_API_KEY");
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) {
if (request.getRequestURI().equals("/api/chat")) {
// Extract body, call SuperCompress API, set compressed body
String compressed = callSuperCompress(body, query);
request.setAttribute("compressed_context", compressed);
}
return true;
}
}
Frequently asked questions
Does it work with Spring WebFlux?
Yes. Create a WebFilter for reactive Spring applications.
Can I use it with Spring Cloud Gateway?
Yes. Add compression as a gateway filter for all LLM-bound routes.
Try it yourself
Paste your long prompt into the playground, ask a question, and see what SuperCompress keeps and removes. Free, no signup needed.