Search in sources :

Example 1 with BaseUriTracker

use of nu.validator.xml.BaseUriTracker in project validator by validator.

the class VerifierServletTransaction method loadDocumentInput.

/**
 * @throws SAXException
 * @throws IOException
 */
protected void loadDocumentInput() throws SAXException, IOException {
    if (documentInput != null) {
        return;
    }
    if (methodIsGet) {
        documentInput = (TypedInputSource) entityResolver.resolveEntity(null, document);
        errorHandler.setLoggingOk(true);
    } else {
        // POST
        long len = request.getContentLength();
        if (len > SIZE_LIMIT) {
            throw new StreamBoundException("Resource size exceeds limit.");
        }
        documentInput = contentTypeParser.buildTypedInputSource(document, null, postContentType);
        documentInput.setByteStream(len < 0 ? new BoundedInputStream(request.getInputStream(), SIZE_LIMIT, document) : request.getInputStream());
        documentInput.setSystemId(request.getHeader("Content-Location"));
    }
    if (imageCollector != null) {
        baseUriTracker = new BaseUriTracker(documentInput.getSystemId(), documentInput.getLanguage());
        imageCollector.initializeContext(baseUriTracker);
    }
}
Also used : BaseUriTracker(nu.validator.xml.BaseUriTracker) BoundedInputStream(nu.validator.io.BoundedInputStream) StreamBoundException(nu.validator.io.StreamBoundException)

Aggregations

BoundedInputStream (nu.validator.io.BoundedInputStream)1 StreamBoundException (nu.validator.io.StreamBoundException)1 BaseUriTracker (nu.validator.xml.BaseUriTracker)1