@Override
    public void filter(ContainerRequestContext context) throws IOException {

        // Retrieve configured request size limits
        final long maxRequestSize;
        try {
            maxRequestSize = environment.getProperty(API_MAX_REQUEST_SIZE, DEFAULT_MAX_REQUEST_SIZE);
        }
        catch (GuacamoleException e) {
            throw new APIException(e);
        }

        // Ignore request size if limit is disabled
        if (maxRequestSize == 0 || resourceInfo.getResourceMethod().isAnnotationPresent(DoNotLimit.class))
            return;

        // Restrict maximum size of requests which have an input stream
        // available to be limited
        InputStream stream = context.getEntityStream();
        if (stream != null)
            context.setEntityStream(new LimitedRequestInputStream(stream, maxRequestSize));

    }
Information describing the resource that was requested.
guacamole/src/main/java/org/apache/guacamole/rest/RequestSizeFilter.java