配置tomcat应用程序的上下文路径

时间:2017-07-10 05:37:59

标签: java spring tomcat web.xml

我正在尝试更改tomcat应用程序的上下文路径。我已阅读this个问题,并尝试按照接受的答案中的说明添加root.xml文件:

  

$CATALINA_BASE/conf/[enginename]/[hostname]/中添加root.xml文件,并将其添加为:

<Context 
  docBase="/opt/mywebapps/<yourApp>" 
  path="" 
  reloadable="true" 
/>
     

有关更多详细信息,您可以使用Apache上下文配置链接:http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

但这对我不起作用。我在这里缺少什么?

我的网络应用的路径:C:\apache-tomcat\webapps\activiti-webapp-explorer2-5.18.0

root.xml文件的路径:C:\apache-tomcat\conf\Catalina\localhost\root.xml

另外,创建root.xml文件仍然是为webapp配置上下文路径的首选方法吗?如果有一种模式“正确”的方式,我想了解它。

修改

我忘了提到两件重要的事情。第一个是我正在使用tomcat 7.第二个是我也无法通过导航到localhost:8080/activiti-webapp-explorer2-5.18.0来访问我的应用程序

EDIT2:

这是我的C:\ apache-tomcat \ conf \ Catalina \ localhost \ root.xml:

<Context path="activiti-explorer-2" docBase="C:\apache-tomcat\webapps\activiti-webapp-explorer2-5.18.0" reloadable="true">

这是我的C:\ apache-tomcat \ webapps \ activiti-webapp-explorer2-5.18.0 \ WEB-INF \ web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>Vaadin Web Application</display-name>
    <distributable />


    <context-param>
        <description>Vaadin production mode</description>
        <param-name>productionMode</param-name>
        <param-value>true</param-value>
    </context-param>

    <!-- To load the Spring context -->
    <listener>
        <listener-class>org.activiti.explorer.servlet.WebConfigurer</listener-class>
    </listener>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- To allow session-scoped beans in Spring -->
    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <filter>
        <filter-name>SecurityFilter</filter-name>
        <filter-class>waffle.servlet.NegotiateSecurityFilter</filter-class>
        <init-param>
            <param-name>principalFormat</param-name>
            <param-value>fqn</param-value>
        </init-param>
        <init-param>
            <param-name>roleFormat</param-name>
            <param-value>both</param-value>
        </init-param>
        <init-param>
            <param-name>allowGuestLogin</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>impersonate</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>securityFilterProviders</param-name>
            <param-value>waffle.servlet.spi.NegotiateSecurityFilterProvider waffle.servlet.spi.BasicSecurityFilterProvider</param-value>
        </init-param>
        <init-param>
            <param-name>waffle.servlet.spi.NegotiateSecurityFilterProvider/protocols</param-name>
            <param-value>Negotiate NTLM</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>SecurityFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>UIFilter</filter-name>
        <filter-class>org.activiti.explorer.filter.ExplorerFilter</filter-class>
    </filter>

    <filter>
        <filter-name>JSONPFilter</filter-name>
        <filter-class>org.activiti.explorer.servlet.JsonpCallbackFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>UIFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>JSONPFilter</filter-name>
        <url-pattern>/service/*</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <servlet-class>org.activiti.explorer.servlet.ExplorerApplicationServlet</servlet-class>
        <init-param>
            <param-name>widgetset</param-name>
            <param-value>org.activiti.explorer.CustomWidgetset</param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <url-pattern>/ui/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <url-pattern>/VAADIN/*</url-pattern>
    </servlet-mapping>

    <!-- Session timeout on one day -->
    <session-config>
        <session-timeout>480</session-timeout>
    </session-config>



</web-app>

提前谢谢。

0 个答案:

没有答案