首页 > 其他分享 >tomcat配置虚拟访问路径

tomcat配置虚拟访问路径

时间:2023-07-03 09:44:59浏览次数:37  
标签:配置 tomcat -- 路径 虚拟 weblogic pdf

新搭建一套uat环境,在打印预览时出现404,部署的应用包是同一个包,应该不存在问题,考虑是配置问题。
之前是用weblogic部署的,在weblogic.xml中配置了虚拟路径映射,而新搭建的环境是用tomcat部署的,没有配置,所以出现404

weblogic中配置

<weblogic-web-app> 
	......省略其他部分
		
   <context-root>/console</context-root> 
   <virtual-directory-mapping> 
    <local-path>/app/weblogic</local-path> 
    <url-pattern>/pdf/*</url-pattern> 
    <url-pattern>/electronicSeal/*</url-pattern>
  </virtual-directory-mapping> 
</weblogic-web-app>

tomcat配置虚拟路径映射(server.xml中Host标签下)

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--><!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 --><Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener"/>
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the BIO implementation that requires the JSSE
         style configuration. When using the APR/native implementation, the
         OpenSSL style configuration is required as described in the APR/native
         documentation -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine defaultHost="localhost" name="Catalina">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      </Realm>

      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>
		
        <!--虚拟路劲映射-->
		<Context path="/console/pdf" docBase="/app/weblogic/pdf" ></Context>

      </Host>
    </Engine>
  </Service>
</Server>

作用

配置虚拟路径映射后,前端访问如:http://127.0.0.1:8080/console/pdf/1.pdf,该请求会在/app/weblogic/pdf目录下找文件名为1.pdf的文件,而不是在应用包中去找

标签:配置,tomcat,--,路径,虚拟,weblogic,pdf
From: https://www.cnblogs.com/mmcode/p/17521927.html

相关文章

  • 在pycharm中导入conda虚拟环境解释器
    在anaconda中装有多个python环境,如下图如果想在pycharm中导入pytorch-GPU-env虚拟环境解释器,首先进入图中显示的该环境的路径(D:\install\miniconda3\envs\pytorch-GPU-env)可以看到,该路径下有一个python.exe文件,即为我们要导入的解释器打开pycharm,如下图所示操作,即可完成解释......
  • 基于嵌入式Tomcat的War包启动器
    前言最近针对java项目的部署方式进行整理,jenkins/tomcat/windows工具/linux脚本/web部署平台等等发现war包通过tomcat部署比较繁琐,等待时间长,配置规则复杂对于小白很不友好,也难以接入到自定义的部署工具/平台中之前开发的Jar包部署平台是servlet开发通过嵌入式tomcat部署,借此打......
  • vue的虚拟DOM
    1、作用提高性能(直接操作DOM性能低,js层操作效率高)跨平台2、虚拟DOM如何生成1、为组件编写模版-template2、模版被编译器编译渲染为函数-render3、挂载中调用render函数,返回对象就是虚拟DOM4、后续patch过程中进一步转化成真实DOM3、VDOM如何diff1、挂载过程结束,记录第一......
  • Tomcat 部署及优化
    目录一、Tomcat概述1.介绍二、Tomcat核心组件1.有哪些系列的组件结构(1)Web容器(2)JSP容器(3)Server容器(4)扩展2.核心组件如何进行交互(1)Tomcat架构图(2)交互流程图3.功能组件结构三、Tomcat处理请求内部数据流向1.Tomcat请求过程2.详细请求过程3.总结四、Tomcat部署1.准......
  • 关于java 虚拟机栈
    线程的栈是在哪里提出来了的?Oracle官网的java虚拟机规范里面,2.5.2章节。网址:https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-2.html下图就是我们常说的java虚拟机栈。java虚拟机栈的栈帧具体是什么?栈帧(StackFrame)是以方法(Method)为基础的。栈帧里面有局部变量表(......
  • Anaconda创建虚拟环境,安装tensorflow
    Anaconda创建虚拟环境,安装tensorflow1、创建虚拟环境,其中tf为虚拟环境名,3.8.8对应python版本号condacreate-ntfpython=3.8.82、激活虚拟环境,其中tf为虚拟环境名activatetf3、安装tensorflow1.0.0,-i临时更换镜像源pipinstalltensorflow-cpu==2.6.0-ihttps://pypi.......
  • tomcat默认用户名密码修改
     在CATALINA_HOME/conf/tomcat-users.xml文件中。编辑这个文件,可以修改用户名和密码,例如添加一个名为“manager”的角色到该文件中:<rolename="manager"><username="manager"password="admin"roles="manager"/>然后重新启动Tomcat。......
  • 分享6款文字语音生成驱动虚拟数字人说话的开源项目
    一、FACEGOOD的Audio2Facegithub地址:github.com/FACEGOOD/FA…FACEGOOD对输入和输出数据做了相应的调整,声音数据对应的标签不再是模型动画的点云数据而是模型动画的blendshape权重。FACEGOOD主要完成Audio2Face部分,ASR、TTS由思必驰智能机器人完成。如果你想用自己的......
  • JZ82 二叉树中和为某一值的路径(一)
    二叉树递归/***structTreeNode{*intval;*structTreeNode*left;*structTreeNode*right;*TreeNode(intx):val(x),left(nullptr),right(nullptr){}*};*/classSolution{public:/***代码中的类名、方法名、参数名已经......
  • 数据流量来回路径一致配置
    修改OSPF开销,实现数据来回路径一致未配置前,路由表有多条路径[R1]displayiprouting-tableRouteFlags:R-relay,D-downloadtofib------------------------------------------------------------------------------RoutingTables:PublicDestinations:37......