All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.catchpoint.trace.instrument.integrations.spring.web.advice.CapturingHttpServletRequest Maven / Gradle / Ivy

There is a newer version: 0.0.20
Show newest version
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();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy