org.apache.cxf.resource.URIResolver Java Examples

The following examples show how to use org.apache.cxf.resource.URIResolver. 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: CxfWSDLImporter.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void importFrom(Import theImport, String sourceSystemId) {
  this.namespace = theImport.getNamespace() == null ? "" : theImport.getNamespace() + ":";
  try {
    final URIResolver uriResolver = new URIResolver(sourceSystemId, theImport.getLocation());
    if (uriResolver.isResolved()) {
        if (uriResolver.getURI() != null) {
            this.importFrom(uriResolver.getURI().toString());
        } else if (uriResolver.isFile()) {
            this.importFrom(uriResolver.getFile().getAbsolutePath());
        } else if (uriResolver.getURL() != null) {
            this.importFrom(uriResolver.getURL().toString());
        }
    } else {
        throw new UncheckedException(new Exception("Unresolved import against " + sourceSystemId));
    }
    
  } catch (final IOException e) {
    throw new UncheckedException(e);
  }
}
 
Example #2
Source File: CxfWSDLImporter.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Override
public void importFrom(Import theImport, String sourceSystemId) {
    this.namespace = theImport.getNamespace() == null ? "" : theImport.getNamespace() + ":";
    try {
        final URIResolver uriResolver = this.createUriResolver(sourceSystemId, theImport);
        if (uriResolver.isResolved()) {
            if (uriResolver.getURI() != null) {
                this.importFrom(uriResolver.getURI().toString());
            } else if (uriResolver.isFile()) {
                this.importFrom(uriResolver.getFile().getAbsolutePath());
            } else if (uriResolver.getURL() != null) {
                this.importFrom(uriResolver.getURL().toString());
            }
        } else {
            throw new UncheckedException(new Exception("Unresolved import against " + sourceSystemId));
        }

    } catch (final IOException e) {
        throw new UncheckedException(e);
    }
}
 
Example #3
Source File: DynamicClientFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
private URL composeUrl(String s) {
    try {
        URIResolver resolver = new URIResolver(null, s, getClass());

        if (resolver.isResolved()) {
            return resolver.getURI().toURL();
        }
        throw new ServiceConstructionException(new Message("COULD_NOT_RESOLVE_URL", LOG, s));
    } catch (IOException e) {
        throw new ServiceConstructionException(new Message("COULD_NOT_RESOLVE_URL", LOG, s), e);
    }
}
 
Example #4
Source File: OASISCatalogManager.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static EntityResolver getResolver() {
    try {
        CatalogManager catalogManager = new CatalogManager();
        if (DEBUG_LEVEL != null) {
            catalogManager.debug.setDebug(Integer.parseInt(DEBUG_LEVEL));
        }
        catalogManager.setUseStaticCatalog(false);
        catalogManager.setIgnoreMissingProperties(true);
        return new CatalogResolver(catalogManager) {
            public String getResolvedEntity(String publicId, String systemId) {
                String s = super.getResolvedEntity(publicId, systemId);
                if (s != null && s.startsWith("classpath:")) {
                    try {
                        URIResolver r = new URIResolver(s);
                        if (r.isResolved()) {
                            r.getInputStream().close();
                            return r.getURL().toExternalForm();
                        }
                    } catch (IOException e) {
                        //ignore
                    }
                }
                return s;
            }
        };
    } catch (Throwable t) {
        //ignore
    }
    return null;
}
 
Example #5
Source File: CxfWSDLImporter.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
protected URIResolver createUriResolver(String sourceSystemId, Import theImport) throws IOException {
    return new URIResolver(sourceSystemId, theImport.getLocation());
}