本文整理汇总了Java中org.apache.ivy.util.url.URLHandlerRegistry类的典型用法代码示例。如果您正苦于以下问题:Java URLHandlerRegistry类的具体用法?Java URLHandlerRegistry怎么用?Java URLHandlerRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
URLHandlerRegistry类属于org.apache.ivy.util.url包,在下文中一共展示了URLHandlerRegistry类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.apache.ivy.util.url.URLHandlerRegistry; //导入依赖的package包/类
public static void parse(
URL xmlURL, URL schema, DefaultHandler handler)
throws SAXException, IOException, ParserConfigurationException {
InputStream xmlStream = URLHandlerRegistry.getDefault().openStream(xmlURL);
try {
InputSource inSrc = new InputSource(xmlStream);
inSrc.setSystemId(xmlURL.toExternalForm());
parse(inSrc, schema, handler);
} finally {
try {
xmlStream.close();
} catch (IOException e) {
// ignored
}
}
}
示例2: configureURLHandler
import org.apache.ivy.util.url.URLHandlerRegistry; //导入依赖的package包/类
private void configureURLHandler() {
// TODO : the credentialStore should also be scoped
CredentialsStore.INSTANCE.addCredentials(getRealm(), getHost(), getUsername(), getPasswd());
URLHandlerDispatcher dispatcher = new URLHandlerDispatcher();
URLHandler httpHandler = URLHandlerRegistry.getHttp();
dispatcher.setDownloader("http", httpHandler);
dispatcher.setDownloader("https", httpHandler);
URLHandlerRegistry.setDefault(dispatcher);
}
示例3: configureURLHandler
import org.apache.ivy.util.url.URLHandlerRegistry; //导入依赖的package包/类
private static void configureURLHandler(String realm, String host, String username,
String passwd) {
CredentialsStore.INSTANCE.addCredentials(realm, host, username, passwd);
URLHandlerDispatcher dispatcher = new URLHandlerDispatcher();
URLHandler httpHandler = URLHandlerRegistry.getHttp();
dispatcher.setDownloader("http", httpHandler);
dispatcher.setDownloader("https", httpHandler);
URLHandlerRegistry.setDefault(dispatcher);
}
示例4: parse
import org.apache.ivy.util.url.URLHandlerRegistry; //导入依赖的package包/类
public static void parse(URL xmlURL, URL schema, DefaultHandler handler, LexicalHandler lHandler)
throws SAXException, IOException, ParserConfigurationException {
InputStream xmlStream = URLHandlerRegistry.getDefault().openStream(xmlURL, null);
try {
InputSource inSrc = new InputSource(xmlStream);
inSrc.setSystemId(toSystemId(xmlURL));
parse(inSrc, schema, handler, lHandler);
} finally {
try {
xmlStream.close();
} catch (IOException e) {
// ignored
}
}
}
示例5: init
import org.apache.ivy.util.url.URLHandlerRegistry; //导入依赖的package包/类
private void init() {
final URLInfo info = URLHandlerRegistry.getDefault().getURLInfo(url, this.timeoutConstraint);
contentLength = info.getContentLength();
lastModified = info.getLastModified();
exists = info.isReachable();
init = true;
}
示例6: configureURLHandler
import org.apache.ivy.util.url.URLHandlerRegistry; //导入依赖的package包/类
private void configureURLHandler() {
URLHandlerDispatcher dispatcher = new URLHandlerDispatcher();
URLHandler httpHandler = URLHandlerRegistry.getHttp();
dispatcher.setDownloader("http", httpHandler);
dispatcher.setDownloader("https", httpHandler);
URLHandlerRegistry.setDefault(dispatcher);
}
示例7: copy
import org.apache.ivy.util.url.URLHandlerRegistry; //导入依赖的package包/类
public static void copy(final URL src, final File dest, final CopyProgressListener listener,
final TimeoutConstraint timeoutConstraint) throws IOException {
URLHandlerRegistry.getDefault().download(src, dest, listener, timeoutConstraint);
}
示例8: settingsStarted
import org.apache.ivy.util.url.URLHandlerRegistry; //导入依赖的package包/类
private void settingsStarted(String qName, Map<String, String> attributes) {
if ("conf".equals(qName) && !deprecatedMessagePrinted) {
Message.deprecated("'conf' is deprecated, use 'settings' instead (" + settings + ")");
}
String cache = attributes.get("defaultCache");
if (cache != null) {
Message.deprecated("'defaultCache' is deprecated, "
+ "use 'caches[@defaultCacheDir]' instead (" + settings + ")");
ivy.setDefaultCache(Checks.checkAbsolute(cache, "defaultCache"));
}
String defaultBranch = attributes.get("defaultBranch");
if (defaultBranch != null) {
ivy.setDefaultBranch(defaultBranch);
}
String defaultResolveMode = attributes.get("defaultResolveMode");
if (defaultResolveMode != null) {
ivy.setDefaultResolveMode(defaultResolveMode);
}
String validate = attributes.get("validate");
if (validate != null) {
ivy.setValidate(Boolean.valueOf(validate));
}
String up2d = attributes.get("checkUpToDate");
if (up2d != null) {
Message.deprecated("'checkUpToDate' is deprecated, "
+ "use the 'overwriteMode' on the 'ivy:retrieve' task instead (" + settings
+ ")");
ivy.setCheckUpToDate(Boolean.valueOf(up2d));
}
String useRemoteConfig = attributes.get("useRemoteConfig");
if (useRemoteConfig != null) {
ivy.setUseRemoteConfig(Boolean.valueOf(useRemoteConfig));
}
String cacheIvyPattern = attributes.get("cacheIvyPattern");
if (cacheIvyPattern != null) {
Message.deprecated("'cacheIvyPattern' is deprecated, use 'caches[@ivyPattern]' instead"
+ " (" + settings + ")");
ivy.setDefaultCacheIvyPattern(cacheIvyPattern);
}
String cacheArtPattern = attributes.get("cacheArtifactPattern");
if (cacheArtPattern != null) {
Message.deprecated("'cacheArtifactPattern' is deprecated, "
+ "use 'caches[@artifactPattern]' instead (" + settings + ")");
ivy.setDefaultCacheArtifactPattern(cacheArtPattern);
}
// we do not set following defaults here since no instances has been registered yet
defaultResolver = attributes.get("defaultResolver");
defaultCM = attributes.get("defaultConflictManager");
defaultLatest = attributes.get("defaultLatestStrategy");
defaultCircular = attributes.get("circularDependencyStrategy");
String requestMethod = attributes.get("httpRequestMethod");
if ("head".equalsIgnoreCase(requestMethod)) {
URLHandlerRegistry.getHttp().setRequestMethod(URLHandler.REQUEST_METHOD_HEAD);
} else if ("get".equalsIgnoreCase(requestMethod)) {
URLHandlerRegistry.getHttp().setRequestMethod(URLHandler.REQUEST_METHOD_GET);
} else if (!isNullOrEmpty(requestMethod)) {
throw new IllegalArgumentException(
"Invalid httpRequestMethod specified, must be one of {'HEAD', 'GET'}");
}
}
示例9: PomReader
import org.apache.ivy.util.url.URLHandlerRegistry; //导入依赖的package包/类
public PomReader(final URL descriptorURL, final Resource res) throws IOException, SAXException {
InputStream stream = new AddDTDFilterInputStream(
URLHandlerRegistry.getDefault().openStream(descriptorURL, null));
InputSource source = new InputSource(stream);
source.setSystemId(XMLHelper.toSystemId(descriptorURL));
try {
Document pomDomDoc = XMLHelper.parseToDom(source, new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
if (systemId != null && systemId.endsWith("m2-entities.ent")) {
return new InputSource(
PomReader.class.getResourceAsStream("m2-entities.ent"));
}
return null;
}
});
projectElement = pomDomDoc.getDocumentElement();
if (!PROJECT.equals(projectElement.getNodeName())
&& !MODEL.equals(projectElement.getNodeName())) {
throw new SAXParseException("project must be the root tag", res.getName(),
res.getName(), 0, 0);
}
parentElement = getFirstChildElement(projectElement, PARENT);
} finally {
try {
stream.close();
} catch (IOException e) {
// ignore
}
}
// Both environment and system properties take precedence over properties set in
// pom.xml. So we pre-populate our properties with the environment and system properties
// here
for (final Map.Entry<String, String> envEntry : System.getenv().entrySet()) {
// Maven let's users use "env." prefix for environment variables
this.setProperty("env." + envEntry.getKey(), envEntry.getValue());
}
// add system properties
final Properties sysProps = System.getProperties();
for (final String sysProp : sysProps.stringPropertyNames()) {
this.setProperty(sysProp, sysProps.getProperty(sysProp));
}
}
示例10: openStream
import org.apache.ivy.util.url.URLHandlerRegistry; //导入依赖的package包/类
public InputStream openStream() throws IOException {
return URLHandlerRegistry.getDefault().openStream(url, null);
}