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.

  • 相关阅读:
    C++数字与字符串相互转化
    NextDate问题
    Mac使用host屏蔽某指定网站
    Pycharm里面使用anaconda配置环境
    Logisim
    XML有关知识
    Mac环境下的Tomcat
    Allow apps downloaded from Anywhere
    寻找两数之和
    最大子序列
  • 原文地址:https://www.cnblogs.com/hephec/p/4586854.html
Copyright © 2011-2022 走看看