- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.catalina.WebResource.getURL()
方法的一些代码示例,展示了WebResource.getURL()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebResource.getURL()
方法的具体详情如下:
包路径:org.apache.catalina.WebResource
类名称:WebResource
方法名:getURL
[英]Obtain a URL to access the resource or null
if no such URL is available or if the resource does not exist.
[中]获取一个URL以访问资源,如果没有可用的URL或资源不存在,则获取null
。
代码示例来源:origin: codefollower/Tomcat-Research
@Override
public URL getURL() {
return webResource.getURL();
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public URL getURL() {
return webResource.getURL();
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
@Override
public URL getURL() {
return webResource.getURL();
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
@Override
public URL getCodeBase() {
if (getWebappPath().startsWith("/WEB-INF/classes/") && name.endsWith(".class")) {
return getWebResourceRoot().getResource("/WEB-INF/classes/").getURL();
} else {
return getURL();
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public URL getCodeBase() {
if (getWebappPath().startsWith("/WEB-INF/classes/") && name.endsWith(".class")) {
return getWebResourceRoot().getResource("/WEB-INF/classes/").getURL();
} else {
return getURL();
}
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Return the URL to the resource that is mapped to a specified path.
* The path must begin with a "/" and is interpreted as relative to the
* current context root.
*
* @param path The path to the desired resource
*
* @exception MalformedURLException if the path is not given
* in the correct form
*/
@Override
public URL getResource(String path)
throws MalformedURLException {
if (path == null ||
!path.startsWith("/") && GET_RESOURCE_REQUIRE_SLASH)
throw new MalformedURLException(sm.getString(
"applicationContext.requestDispatcher.iae", path));
WebResourceRoot resources = context.getResources();
if (resources != null) {
return resources.getResource(path).getURL();
}
return null;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public URL getResource(String path) throws MalformedURLException {
String validatedPath = validateResourcePath(path, false);
if (validatedPath == null) {
throw new MalformedURLException(
sm.getString("applicationContext.requestDispatcher.iae", path));
}
WebResourceRoot resources = context.getResources();
if (resources != null) {
return resources.getResource(validatedPath).getURL();
}
return null;
}
代码示例来源:origin: codefollower/Tomcat-Research
private void processWebInfLib() {
WebResource[] possibleJars = listResources("/WEB-INF/lib", false);
for (WebResource possibleJar : possibleJars) {
if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) {
createWebResourceSet(ResourceSetType.CLASSES_JAR,
"/WEB-INF/classes", possibleJar.getURL(), "/");
}
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
@Override
public URL getResource(String path) throws MalformedURLException {
String validatedPath = validateResourcePath(path, false);
if (validatedPath == null) {
throw new MalformedURLException(
sm.getString("applicationContext.requestDispatcher.iae", path));
}
WebResourceRoot resources = context.getResources();
if (resources != null) {
return resources.getResource(validatedPath).getURL();
}
return null;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Start the class loader.
*
* @exception LifecycleException if a lifecycle error occurs
*/
@Override
public void start() throws LifecycleException {
state = LifecycleState.STARTING_PREP;
WebResource classes = resources.getResource("/WEB-INF/classes");
if (classes.isDirectory() && classes.canRead()) {
localRepositories.add(classes.getURL());
}
WebResource[] jars = resources.listResources("/WEB-INF/lib");
for (WebResource jar : jars) {
if (jar.getName().endsWith(".jar") && jar.isFile() && jar.canRead()) {
localRepositories.add(jar.getURL());
jarModificationTimes.put(
jar.getName(), Long.valueOf(jar.getLastModified()));
}
}
state = LifecycleState.STARTED;
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
/**
* Start the class loader.
*
* @exception LifecycleException if a lifecycle error occurs
*/
@Override
public void start() throws LifecycleException {
state = LifecycleState.STARTING_PREP;
WebResource classes = resources.getResource("/WEB-INF/classes");
if (classes.isDirectory() && classes.canRead()) {
localRepositories.add(classes.getURL());
}
WebResource[] jars = resources.listResources("/WEB-INF/lib");
for (WebResource jar : jars) {
if (jar.getName().endsWith(".jar") && jar.isFile() && jar.canRead()) {
localRepositories.add(jar.getURL());
jarModificationTimes.put(
jar.getName(), Long.valueOf(jar.getLastModified()));
}
}
state = LifecycleState.STARTED;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Class loader resources are handled by treating JARs in WEB-INF/lib as
* resource JARs (without the internal META-INF/resources/ prefix) mounted
* at WEB-INF/classes (rather than the web app root). This enables reuse
* of the resource handling plumbing.
*
* These resources are marked as class loader only so they are only used in
* the methods that are explicitly defined to return class loader resources.
* This prevents calls to getResource("/WEB-INF/classes") returning from one
* or more of the JAR files.
*
* @throws LifecycleException If an error occurs that should stop the web
* application from starting
*/
protected void processWebInfLib() throws LifecycleException {
WebResource[] possibleJars = listResources("/WEB-INF/lib", false);
for (WebResource possibleJar : possibleJars) {
if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) {
createWebResourceSet(ResourceSetType.CLASSES_JAR,
"/WEB-INF/classes", possibleJar.getURL(), "/");
}
}
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Return an enumeration of <code>URLs</code> representing all of the
* resources with the given name. If no resources with this name are
* found, return an empty enumeration.
*
* @param name Name of the resources to be found
*
* @exception IOException if an input/output error occurs
*/
@Override
public Enumeration<URL> findResources(String name) throws IOException {
if (log.isDebugEnabled())
log.debug(" findResources(" + name + ")");
LinkedHashSet<URL> result = new LinkedHashSet<>();
String path = nameToPath(name);
WebResource[] webResources = resources.getClassLoaderResources(path);
for (WebResource webResource : webResources) {
if (webResource.exists()) {
result.add(webResource.getURL());
}
}
return Collections.enumeration(result);
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
/**
* Class loader resources are handled by treating JARs in WEB-INF/lib as
* resource JARs (without the internal META-INF/resources/ prefix) mounted
* at WEB-INF/classes (rather than the web app root). This enables reuse
* of the resource handling plumbing.
*
* These resources are marked as class loader only so they are only used in
* the methods that are explicitly defined to return class loader resources.
* This prevents calls to getResource("/WEB-INF/classes") returning from one
* or more of the JAR files.
*
* @throws LifecycleException If an error occurs that should stop the web
* application from starting
*/
protected void processWebInfLib() throws LifecycleException {
WebResource[] possibleJars = listResources("/WEB-INF/lib", false);
for (WebResource possibleJar : possibleJars) {
if (possibleJar.isFile() && possibleJar.getName().endsWith(".jar")) {
createWebResourceSet(ResourceSetType.CLASSES_JAR,
"/WEB-INF/classes", possibleJar.getURL(), "/");
}
}
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Start the class loader.
*
* @exception LifecycleException if a lifecycle error occurs
*/
@Override
public void start() throws LifecycleException {
WebResource classes = resources.getResource("/WEB-INF/classes");
if (classes.isDirectory() && classes.canRead()) {
addURL(classes.getURL());
}
WebResource[] jars = resources.listResources("/WEB-INF/lib");
for (WebResource jar : jars) {
if (jar.getName().endsWith(".jar") && jar.isFile() && jar.canRead()) {
addURL(jar.getURL());
jarModificationTimes.put(
jar.getName(), Long.valueOf(jar.getLastModified()));
}
}
started = true;
String encoding = null;
try {
encoding = System.getProperty("file.encoding");
} catch (SecurityException e) {
return;
}
if (encoding.indexOf("EBCDIC")!=-1) {
needConvert = true;
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
private WebXml getTomcatWebXmlFragment(WebXmlParser webXmlParser) {
WebXml webXmlTomcatFragment = createWebXml();
webXmlTomcatFragment.setOverridable(true);
// Set to distributable else every app will be prevented from being
// distributable when the Tomcat fragment is merged with the main
// web.xml
webXmlTomcatFragment.setDistributable(true);
// When merging, the default welcome files are only used if the app has
// not defined any welcomes files.
webXmlTomcatFragment.setAlwaysAddWelcomeFiles(false);
WebResource resource = context.getResources().getResource(Constants.TomcatWebXml);
if (resource.isFile()) {
try {
InputSource source = new InputSource(resource.getURL().toURI().toString());
source.setByteStream(resource.getInputStream());
if (!webXmlParser.parseWebXml(source, webXmlTomcatFragment, false)) {
ok = false;
}
} catch (URISyntaxException e) {
log.error(sm.getString("contextConfig.tomcatWebXmlError"), e);
}
}
return webXmlTomcatFragment;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
private WebXml getTomcatWebXmlFragment(WebXmlParser webXmlParser) {
WebXml webXmlTomcatFragment = createWebXml();
webXmlTomcatFragment.setOverridable(true);
// Set to distributable else every app will be prevented from being
// distributable when the Tomcat fragment is merged with the main
// web.xml
webXmlTomcatFragment.setDistributable(true);
// When merging, the default welcome files are only used if the app has
// not defined any welcomes files.
webXmlTomcatFragment.setAlwaysAddWelcomeFiles(false);
WebResource resource = context.getResources().getResource(Constants.TomcatWebXml);
if (resource.isFile()) {
try {
InputSource source = new InputSource(resource.getURL().toURI().toString());
source.setByteStream(resource.getInputStream());
if (!webXmlParser.parseWebXml(source, webXmlTomcatFragment, false)) {
ok = false;
}
} catch (URISyntaxException e) {
log.error(sm.getString("contextConfig.tomcatWebXmlError"), e);
}
}
return webXmlTomcatFragment;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Allocate resources, including proxy.
* @throws LifecycleException if a start error occurs
*/
public void resourcesStart() throws LifecycleException {
// Check current status in case resources were added that had already
// been started
if (!resources.getState().isAvailable()) {
resources.start();
}
if (effectiveMajorVersion >=3 && addWebinfClassesResources) {
WebResource webinfClassesResource = resources.getResource(
"/WEB-INF/classes/META-INF/resources");
if (webinfClassesResource.isDirectory()) {
getResources().createWebResourceSet(
WebResourceRoot.ResourceSetType.RESOURCE_JAR, "/",
webinfClassesResource.getURL(), "/");
}
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
/**
* Allocate resources, including proxy.
* @throws LifecycleException if a start error occurs
*/
public void resourcesStart() throws LifecycleException {
// Check current status in case resources were added that had already
// been started
if (!resources.getState().isAvailable()) {
resources.start();
}
if (effectiveMajorVersion >=3 && addWebinfClassesResources) {
WebResource webinfClassesResource = resources.getResource(
"/WEB-INF/classes/META-INF/resources");
if (webinfClassesResource.isDirectory()) {
getResources().createWebResourceSet(
WebResourceRoot.ResourceSetType.RESOURCE_JAR, "/",
webinfClassesResource.getURL(), "/");
}
}
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Allocate resources, including proxy.
* Return <code>true</code> if initialization was successfull,
* or <code>false</code> otherwise.
*/
public void resourcesStart() throws LifecycleException {
// May have been started (but not fully configured) in init() so no need
// to start the resources if they are already available
if (!resources.getState().isAvailable()) {
resources.start();
}
if (effectiveMajorVersion >=3 && addWebinfClassesResources) {
WebResource webinfClassesResource = resources.getResource(
"/WEB-INF/classes/META-INF/resources");
if (webinfClassesResource.isDirectory()) {
getResources().createWebResourceSet(
WebResourceRoot.ResourceSetType.RESOURCE_JAR, "/",
webinfClassesResource.getURL(), "/");
}
}
}
尝试启动 servlet 引擎时,出现以下错误: 8080端口免费 在启动服务期间发现此错误。 服务器中已启用 IPv6。 错误: Using CATALINA_BASE: /app/iw-hom
我在尝试调用 Tomcat 上的 shutdown.sh 时遇到此错误。Tomcat 在 192.168.1.240:8080 上的内部服务器上 堆栈跟踪是 Aug 29, 2016 5:14:09
在我的 Linux 服务器 (ubuntu) 中,tomcat 日志文件 catalina.out 会自动重命名为新文件名,例如。 catalina.out catalina.out.1 , cata
我正在尝试为其中一个设备编写驱动程序套件扩展。我没有关于如何为 mac os Catalina 编写驱动程序扩展的信息。 我得到的唯一文档是 DriverKit 引用:https://develope
我有一个 bash 脚本,一旦文件超过特定大小时,它会成功删除一个或多个 tomcat 日志目录(我们运行多个实例)的 catalina.out 文件。我每晚运行此脚本作为 cron 作业。它基本上看
在 tomcat 启动后,Hibernate 开始登录 catalina.out。 (( 由于我从 tomcat/conf/logging.properties 中删除了控制台处理程序,它已开始在 c
我只是想知道如果我想替换: "$CATALINA_OUT" 2>&1 & 要每天轮换日志 我应该用什么替换它。我的理解是: "$CATALINA_BASE"/logs/catalina.out 2>&
我有我作为 .pkg 分发的应用程序使用 pkgbuild 创建的文件和 productbuild .使用 macOS Catalina,这不再起作用。安装程序提示我正在尝试将内容安装到系统卷。 三周
我在 Netbeans 中实现了一个基于 SOAP 的 Web 服务。我在服务器端遇到了一些问题,它给我错误 500,内部错误,因为我无法自动调试它,它告诉我检查日志但是我的catalina.out
我的一台主机在 Mac OS Catalina 上运行,并且它经常用完磁盘空间...... 我已经安排了在那里运行的任务,并且每天它都会将文件上传到 /用户/labuser/我的文件夹并从该文件夹中删
我已经修改了 php.ini 文件以启用操作码缓存并重新启动 apache,但它在 phpinfo() 中无处可见。 php -v 说: PHP 7.4.1 (cli) (built: Dec 18
01-Jul-2018 20:00:33.968 SEVERE [RMI TCP Connection(5)-127.0.0.1] org.apache.catalina.core.Container
由于 stderr.log 中的以下错误消息,我无法启动 tomcat 5.5 服务器。有人可以帮助我吗,这是一种紧急情况。提前致谢。 java.lang.ClassNotFoundException
该项目正在顺利运行突然我在控制台日志中收到此错误。我使用的是 Tomcat 8.0.35 版。我已经尝试了从干净构建到更新项目的所有方法。我知道已经解决了一些问题,但没有一个解决方案对我有用。 jav
我正在使用 Eclipse 在 Apache Tomcat 服务器上部署应用程序修复服务,但问题似乎是该应用程序没有被复制到 webapps 文件夹中,即它没有被发布。 HTTPConnectionM
在 tomcat 服务器中,logs 文件夹包含这样的文件 localhost.YYYY-MM-DD.log:主机日志 host-manager.YYYY-MM-DD.log 和manager.Y
我的 Java 应用程序(Spring、Hibernate、MySQL)在 Tomcat 5.5 中运行 在对我的应用程序进行最后一组更改后,Tomcat 的 catalina.out 文件增长非常迅
我禁用了 SIP,但目录/usr/bin 无论如何都是写保护的。如何获得/usr/bin 的写权限?请不要建议切换到/usr/local/bin。 最佳答案 Catalina 有一个新的文件系统安排,
我尝试在 Spring 中使用 Apache Tomcat 7.0 编写一个简单的 hello world 程序。我收到以下错误,服务器进入停止状态。 SEVERE: A child containe
我无法初始化 log4j catalina 日志附加器 - 你知道我缺少什么吗?我知道这是一个基本问题,但我坚持这一点。我为 catalina 记录器添加了 org.apache.log4j.net.
我是一名优秀的程序员,十分优秀!