zoukankan      html  css  js  c++  java
  • Tomcat, pathinfo, and servlets

     

    So today I learned that you can't just access PATH_INFO (pathinfo) information from a servlet when you're using Tomcat (at least not Tomcat 3.2.4 running under Apache). I can access the PATH_INFO information okay under Tomcat running standalone on my PC, but for some reason the same config did not work properly using Tomcat under Apache. (I'll investigate this more in the future.)

    Specifically, for me to be able to access PATH_INFO (PathInfo) information in a servlet, I had to add this servlet mapping information to my web.xml file:

        <servlet-mapping>
            <servlet-name>
                Content
            </servlet-name>
            <url-pattern>
                /Content/*
            </url-pattern>
        </servlet-mapping>
    

      

    The /Content/* is the key. When I just had /Content as the url-pattern like I normally would, I kept getting a 404 error any time I pre-pended anything to the end of my servlet call (for instance, when I tried to hit a URL like http://mondo.devdaily.com/Content/1/1/). But once I changed the servlet mapping as shown above, it started working like a champ.

  • 相关阅读:
    基于Spring的集群会话共享方案-spring session
    Tensorflow 模型线上部署
    Dijkstra算法
    BFS和DFS
    图的基本概念
    排序5
    排序4
    排序3
    排序2
    排序1
  • 原文地址:https://www.cnblogs.com/hephec/p/4586854.html
Copyright © 2011-2022 走看看