com.catchpoint.trace.instrument.integrations.spring.web.advice.CapturingHttpServletRequest Maven / Gradle / Ivy
package com.catchpoint.trace.instrument.integrations.spring.web.advice;
import org.springframework.web.util.ContentCachingRequestWrapper;
import javax.servlet.http.HttpServletRequest;
/**
* @author serkan
*/
public class CapturingHttpServletRequest extends ContentCachingRequestWrapper {
private boolean overflowed = false;
public CapturingHttpServletRequest(HttpServletRequest request, int maxSize) {
super(request, maxSize);
}
@Override
protected void handleContentOverflow(int contentCacheLimit) {
super.handleContentOverflow(contentCacheLimit);
overflowed = true;
}
public boolean isOverflowed() {
return overflowed;
}
public byte[] getCapturedRequest() {
if (overflowed) {
return null;
}
return getContentAsByteArray();
}
}