本文整理了Java中org.apache.tomcat.util.descriptor.web.WebXml.getURL()
方法的一些代码示例,展示了WebXml.getURL()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebXml.getURL()
方法的具体详情如下:
包路径:org.apache.tomcat.util.descriptor.web.WebXml
类名称:WebXml
方法名:getURL
暂无
代码示例来源:origin: codefollower/Tomcat-Research
@Override
public String toString() {
StringBuilder buf = new StringBuilder(32);
buf.append("Name: ");
buf.append(getName());
buf.append(", URL: ");
buf.append(getURL());
return buf.toString();
}
代码示例来源:origin: org.apache.tomcat/tomcat-util-scan
@Override
public String toString() {
StringBuilder buf = new StringBuilder(32);
buf.append("Name: ");
buf.append(getName());
buf.append(", URL: ");
buf.append(getURL());
return buf.toString();
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
@Override
public String toString() {
StringBuilder buf = new StringBuilder(32);
buf.append("Name: ");
buf.append(getName());
buf.append(", URL: ");
buf.append(getURL());
return buf.toString();
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
private boolean mergeLifecycleCallback(
Map<String, String> fragmentMap, Map<String, String> tempMap,
WebXml fragment, String mapName) {
for (Entry<String, String> entry : fragmentMap.entrySet()) {
final String key = entry.getKey();
final String value = entry.getValue();
if (tempMap.containsKey(key)) {
if (value != null && !value.equals(tempMap.get(key))) {
log.error(sm.getString("webXml.mergeConflictString",
mapName, key, fragment.getName(), fragment.getURL()));
return false;
}
} else {
tempMap.put(key, value);
}
}
return true;
}
代码示例来源:origin: codefollower/Tomcat-Research
private static <T> boolean mergeLifecycleCallback(
Map<String, String> fragmentMap, Map<String, String> tempMap,
WebXml fragment, String mapName) {
for (Entry<String, String> entry : fragmentMap.entrySet()) {
final String key = entry.getKey();
final String value = entry.getValue();
if (tempMap.containsKey(key)) {
if (value != null && !value.equals(tempMap.get(key))) {
log.error(sm.getString("webXml.mergeConflictString",
mapName, key, fragment.getName(), fragment.getURL()));
return false;
}
} else {
tempMap.put(key, value);
}
}
return true;
}
代码示例来源:origin: org.apache.tomcat/tomcat-jasper
private List<URL> scanForResourceJARs(Set<WebXml> orderedFragments, Collection<WebXml> fragments)
throws JasperException {
List<URL> resourceJars = new ArrayList<>();
// Build list of potential resource JARs. Use same ordering as ContextConfig
Set<WebXml> resourceFragments = new LinkedHashSet<>();
for (WebXml fragment : orderedFragments) {
resourceFragments.add(fragment);
}
for (WebXml fragment : fragments) {
if (!resourceFragments.contains(fragment)) {
resourceFragments.add(fragment);
}
}
for (WebXml resourceFragment : resourceFragments) {
try (Jar jar = JarFactory.newInstance(resourceFragment.getURL())) {
if (jar.exists("META-INF/resources/")) {
// This is a resource JAR
resourceJars.add(resourceFragment.getURL());
}
} catch (IOException ioe) {
throw new JasperException(ioe);
}
}
return resourceJars;
}
代码示例来源:origin: org.apache.tomcat/tomcat-util-scan
private boolean mergeLifecycleCallback(
Map<String, String> fragmentMap, Map<String, String> tempMap,
WebXml fragment, String mapName) {
for (Entry<String, String> entry : fragmentMap.entrySet()) {
final String key = entry.getKey();
final String value = entry.getValue();
if (tempMap.containsKey(key)) {
if (value != null && !value.equals(tempMap.get(key))) {
log.error(sm.getString("webXml.mergeConflictString",
mapName, key, fragment.getName(), fragment.getURL()));
return false;
}
} else {
tempMap.put(key, value);
}
}
return true;
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
private <T> boolean mergeMap(Map<String,T> fragmentMap,
Map<String,T> mainMap, Map<String,T> tempMap, WebXml fragment,
String mapName) {
for (Entry<String, T> entry : fragmentMap.entrySet()) {
final String key = entry.getKey();
if (!mainMap.containsKey(key)) {
// Not defined in main web.xml
T value = entry.getValue();
if (tempMap.containsKey(key)) {
if (value != null && !value.equals(
tempMap.get(key))) {
log.error(sm.getString(
"webXml.mergeConflictString",
mapName,
key,
fragment.getName(),
fragment.getURL()));
return false;
}
} else {
tempMap.put(key, value);
}
}
}
return true;
}
代码示例来源:origin: codefollower/Tomcat-Research
private static <T> boolean mergeMap(Map<String,T> fragmentMap,
Map<String,T> mainMap, Map<String,T> tempMap, WebXml fragment,
String mapName) {
for (Entry<String, T> entry : fragmentMap.entrySet()) {
final String key = entry.getKey();
if (!mainMap.containsKey(key)) {
// Not defined in main web.xml
T value = entry.getValue();
if (tempMap.containsKey(key)) {
if (value != null && !value.equals(
tempMap.get(key))) {
log.error(sm.getString(
"webXml.mergeConflictString",
mapName,
key,
fragment.getName(),
fragment.getURL()));
return false;
}
} else {
tempMap.put(key, value);
}
}
}
return true;
}
代码示例来源:origin: org.apache.tomcat/tomcat-util-scan
private <T> boolean mergeMap(Map<String,T> fragmentMap,
Map<String,T> mainMap, Map<String,T> tempMap, WebXml fragment,
String mapName) {
for (Entry<String, T> entry : fragmentMap.entrySet()) {
final String key = entry.getKey();
if (!mainMap.containsKey(key)) {
// Not defined in main web.xml
T value = entry.getValue();
if (tempMap.containsKey(key)) {
if (value != null && !value.equals(
tempMap.get(key))) {
log.error(sm.getString(
"webXml.mergeConflictString",
mapName,
key,
fragment.getName(),
fragment.getURL()));
return false;
}
} else {
tempMap.put(key, value);
}
}
}
return true;
}
代码示例来源:origin: codefollower/Tomcat-Research
@Override
public void scan(File file, String webappPath, boolean isWebapp) throws IOException {
InputStream stream = null;
WebXml fragment = new WebXml();
fragment.setWebappJar(isWebapp);
fragment.setDelegate(delegate);
try {
File fragmentFile = new File(file, FRAGMENT_LOCATION);
if (fragmentFile.isFile()) {
stream = new FileInputStream(fragmentFile);
InputSource source =
new InputSource(fragmentFile.toURI().toURL().toString());
source.setByteStream(stream);
if (!webXmlParser.parseWebXml(source, fragment, true)) {
ok = false;
}
} else {
// If there is no web.xml, normal folder no impact on
// distributable
fragment.setDistributable(true);
}
} finally {
fragment.setURL(file.toURI().toURL());
if (fragment.getName() == null) {
fragment.setName(fragment.getURL().toString());
}
fragment.setJarName(file.getName());
fragments.put(fragment.getName(), fragment);
}
}
代码示例来源:origin: apache/meecrowave
@Override
protected void processClasses(final WebXml webXml, final Set<WebXml> orderedFragments) {
final ClassLoader loader = context.getLoader().getClassLoader();
orderedFragments.forEach(fragment -> {
final WebXml annotations = new WebXml();
annotations.setDistributable(true);
final URL url = fragment.getURL();
final Collection<Class<?>> classes = webClasses.get(url.toExternalForm());
if (classes == null) {
return;
}
classes.forEach(clazz -> {
try (final InputStream stream = loader.getResourceAsStream(clazz.getName().replace('.', '/') + ".class")) {
processClass(annotations, new ClassParser(stream).parse());
} catch (final IOException e) {
new LogFacade(MeecrowaveContextConfig.class.getName()).error("Can't parse " + clazz);
}
});
fragment.merge(singleton(annotations));
});
}
代码示例来源:origin: org.apache.tomcat/tomcat-util-scan
@Override
public void scan(File file, String webappPath, boolean isWebapp) throws IOException {
WebXml fragment = new WebXml();
fragment.setWebappJar(isWebapp);
fragment.setDelegate(delegate);
File fragmentFile = new File(file, FRAGMENT_LOCATION);
try {
if (fragmentFile.isFile()) {
try (InputStream stream = new FileInputStream(fragmentFile)) {
InputSource source =
new InputSource(fragmentFile.toURI().toURL().toString());
source.setByteStream(stream);
if (!webXmlParser.parseWebXml(source, fragment, true)) {
ok = false;
}
}
} else {
// If there is no web.xml, normal folder no impact on
// distributable
fragment.setDistributable(true);
}
} finally {
fragment.setURL(file.toURI().toURL());
if (fragment.getName() == null) {
fragment.setName(fragment.getURL().toString());
}
fragment.setJarName(file.getName());
fragments.put(fragment.getName(), fragment);
}
}
代码示例来源:origin: org.apache.meecrowave/meecrowave-core
@Override
protected void processClasses(final WebXml webXml, final Set<WebXml> orderedFragments) {
final ClassLoader loader = context.getLoader().getClassLoader();
orderedFragments.forEach(fragment -> {
final WebXml annotations = new WebXml();
annotations.setDistributable(true);
final URL url = fragment.getURL();
final Collection<Class<?>> classes = webClasses.get(url.toExternalForm());
if (classes == null) {
return;
}
classes.forEach(clazz -> {
try (final InputStream stream = loader.getResourceAsStream(clazz.getName().replace('.', '/') + ".class")) {
processClass(annotations, new ClassParser(stream).parse());
} catch (final IOException e) {
new LogFacade(MeecrowaveContextConfig.class.getName()).error("Can't parse " + clazz);
}
});
fragment.merge(singleton(annotations));
});
}
代码示例来源:origin: org.apache.tomcat/tomcat-util-scan
private <T extends ResourceBase> boolean mergeResourceMap(
Map<String, T> fragmentResources, Map<String, T> mainResources,
Map<String, T> tempResources, WebXml fragment) {
for (T resource : fragmentResources.values()) {
String resourceName = resource.getName();
if (mainResources.containsKey(resourceName)) {
mainResources.get(resourceName).getInjectionTargets().addAll(
resource.getInjectionTargets());
} else {
// Not defined in main web.xml
T existingResource = tempResources.get(resourceName);
if (existingResource != null) {
if (!existingResource.equals(resource)) {
log.error(sm.getString(
"webXml.mergeConflictResource",
resourceName,
fragment.getName(),
fragment.getURL()));
return false;
}
} else {
tempResources.put(resourceName, resource);
}
}
}
return true;
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
private <T extends ResourceBase> boolean mergeResourceMap(
Map<String, T> fragmentResources, Map<String, T> mainResources,
Map<String, T> tempResources, WebXml fragment) {
for (T resource : fragmentResources.values()) {
String resourceName = resource.getName();
if (mainResources.containsKey(resourceName)) {
mainResources.get(resourceName).getInjectionTargets().addAll(
resource.getInjectionTargets());
} else {
// Not defined in main web.xml
T existingResource = tempResources.get(resourceName);
if (existingResource != null) {
if (!existingResource.equals(resource)) {
log.error(sm.getString(
"webXml.mergeConflictResource",
resourceName,
fragment.getName(),
fragment.getURL()));
return false;
}
} else {
tempResources.put(resourceName, resource);
}
}
}
return true;
}
代码示例来源:origin: codefollower/Tomcat-Research
private static <T extends ResourceBase> boolean mergeResourceMap(
Map<String, T> fragmentResources, Map<String, T> mainResources,
Map<String, T> tempResources, WebXml fragment) {
for (T resource : fragmentResources.values()) {
String resourceName = resource.getName();
if (mainResources.containsKey(resourceName)) {
mainResources.get(resourceName).getInjectionTargets().addAll(
resource.getInjectionTargets());
} else {
// Not defined in main web.xml
T existingResource = tempResources.get(resourceName);
if (existingResource != null) {
if (!existingResource.equals(resource)) {
log.error(sm.getString(
"webXml.mergeConflictResource",
resourceName,
fragment.getName(),
fragment.getURL()));
return false;
}
} else {
tempResources.put(resourceName, resource);
}
}
}
return true;
}
代码示例来源:origin: codefollower/Tomcat-Research
protected void processAnnotations(Set<WebXml> fragments,
boolean handlesTypesOnly) {
for(WebXml fragment : fragments) {
// Only need to scan for @HandlesTypes matches if any of the
// following are true:
// - it has already been determined only @HandlesTypes is required
// (e.g. main web.xml has metadata-complete="true"
// - this fragment is for a container JAR (Servlet 3.1 section 8.1)
// - this fragment has metadata-complete="true"
boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() ||
fragment.isMetadataComplete();
WebXml annotations = new WebXml();
// no impact on distributable
annotations.setDistributable(true);
URL url = fragment.getURL();
processAnnotationsUrl(url, annotations, htOnly);
Set<WebXml> set = new HashSet<>();
set.add(annotations);
// Merge annotations into fragment - fragment takes priority
fragment.merge(set);
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
protected void processAnnotations(Set<WebXml> fragments,
boolean handlesTypesOnly, Map<String,JavaClassCacheEntry> javaClassCache) {
for(WebXml fragment : fragments) {
// Only need to scan for @HandlesTypes matches if any of the
// following are true:
// - it has already been determined only @HandlesTypes is required
// (e.g. main web.xml has metadata-complete="true"
// - this fragment is for a container JAR (Servlet 3.1 section 8.1)
// - this fragment has metadata-complete="true"
boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() ||
fragment.isMetadataComplete();
WebXml annotations = new WebXml();
// no impact on distributable
annotations.setDistributable(true);
URL url = fragment.getURL();
processAnnotationsUrl(url, annotations, htOnly, javaClassCache);
Set<WebXml> set = new HashSet<>();
set.add(annotations);
// Merge annotations into fragment - fragment takes priority
fragment.merge(set);
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
protected void processAnnotations(Set<WebXml> fragments,
boolean handlesTypesOnly, Map<String,JavaClassCacheEntry> javaClassCache) {
for(WebXml fragment : fragments) {
// Only need to scan for @HandlesTypes matches if any of the
// following are true:
// - it has already been determined only @HandlesTypes is required
// (e.g. main web.xml has metadata-complete="true"
// - this fragment is for a container JAR (Servlet 3.1 section 8.1)
// - this fragment has metadata-complete="true"
boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() ||
fragment.isMetadataComplete();
WebXml annotations = new WebXml();
// no impact on distributable
annotations.setDistributable(true);
URL url = fragment.getURL();
processAnnotationsUrl(url, annotations, htOnly, javaClassCache);
Set<WebXml> set = new HashSet<>();
set.add(annotations);
// Merge annotations into fragment - fragment takes priority
fragment.merge(set);
}
}
内容来源于网络,如有侵权,请联系作者删除!