com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverContext Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResolverLocalFilesystem.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #2
Source File: ResolverLocalFilesystem.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #3
Source File: ResolverFragment.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #4
Source File: ResolverLocalFilesystem.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #5
Source File: ResolverFragment.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #6
Source File: ResolverLocalFilesystem.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #7
Source File: ResolverFragment.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #8
Source File: ResolverLocalFilesystem.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #9
Source File: ResolverFragment.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #10
Source File: ResolverLocalFilesystem.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #11
Source File: ResolverFragment.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #12
Source File: ResolverLocalFilesystem.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #13
Source File: ResolverLocalFilesystem.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #14
Source File: ResolverLocalFilesystem.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #15
Source File: ResolverFragment.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #16
Source File: ResolverLocalFilesystem.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #17
Source File: ResolverFragment.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #18
Source File: ResolverLocalFilesystem.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #19
Source File: ResolverFragment.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #20
Source File: ResolverLocalFilesystem.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #21
Source File: ResolverFragment.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #22
Source File: ResolverLocalFilesystem.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
    throws ResourceResolverException {
    try {
        // calculate new URI
        URI uriNew = getNewURI(context.uriToResolve, context.baseUri);

        String fileName =
            ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
    } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
    }
}
 
Example #23
Source File: ResolverFragment.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #24
Source File: ResolverFragment.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method engineCanResolve
 * @inheritDoc
 * @param uri
 * @param baseURI
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Quick fail for null uri");
        }
        return false;
    }

    if (context.uriToResolve.equals("") ||
        ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer("))
    ) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "State I can resolve reference: \"" + context.uriToResolve + "\"");
        }
        return true;
    }
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
    }
    return false;
}
 
Example #25
Source File: ResolverDirectHTTP.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * We resolve http URIs <I>without</I> fragment...
 *
 * @param uri
 * @param baseURI
 * @return true if can be resolved
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "quick fail, uri == null");
        }
        return false;
    }

    if (context.uriToResolve.equals("") || (context.uriToResolve.charAt(0)=='#')) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "quick fail for empty URIs and local ones");
        }
        return false;
    }

    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "I was asked whether I can resolve " + context.uriToResolve);
    }

    if (context.uriToResolve.startsWith("http:") ||
        (context.baseUri != null && context.baseUri.startsWith("http:") )) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "I state that I can resolve " + context.uriToResolve);
        }
        return true;
    }

    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "I state that I can't resolve " + context.uriToResolve);
    }

    return false;
}
 
Example #26
Source File: ResolverDirectHTTP.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * We resolve http URIs <I>without</I> fragment...
 *
 * @param uri
 * @param baseURI
 * @return true if can be resolved
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "quick fail, uri == null");
        }
        return false;
    }

    if (context.uriToResolve.equals("") || (context.uriToResolve.charAt(0)=='#')) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "quick fail for empty URIs and local ones");
        }
        return false;
    }

    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "I was asked whether I can resolve " + context.uriToResolve);
    }

    if (context.uriToResolve.startsWith("http:") ||
        (context.baseUri != null && context.baseUri.startsWith("http:") )) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "I state that I can resolve " + context.uriToResolve);
        }
        return true;
    }

    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "I state that I can't resolve " + context.uriToResolve);
    }

    return false;
}
 
Example #27
Source File: ResolverLocalFilesystem.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @inheritDoc
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        return false;
    }

    if (context.uriToResolve.equals("") || (context.uriToResolve.charAt(0)=='#') ||
        context.uriToResolve.startsWith("http:")) {
        return false;
    }

    try {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "I was asked whether I can resolve " + context.uriToResolve);
        }

        if (context.uriToResolve.startsWith("file:") || context.baseUri.startsWith("file:")) {
            if (log.isLoggable(java.util.logging.Level.FINE)) {
                log.log(java.util.logging.Level.FINE, "I state that I can resolve " + context.uriToResolve);
            }
            return true;
        }
    } catch (Exception e) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, e.getMessage(), e);
        }
    }

    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "But I can't");
    }

    return false;
}
 
Example #28
Source File: ResolverAnonymous.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        return true;
    }
    return false;
}
 
Example #29
Source File: ResolverAnonymous.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        return true;
    }
    return false;
}
 
Example #30
Source File: ResolverXPointer.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * @inheritDoc
 */
public boolean engineCanResolveURI(ResourceResolverContext context) {
    if (context.uriToResolve == null) {
        return false;
    }
    if (isXPointerSlash(context.uriToResolve) || isXPointerId(context.uriToResolve)) {
        return true;
    }

    return false;
}