乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Servlet path

       shaobin0604@163.com 2006-09-11
      servlet path
      時(shí)間:2004-11-18
                              |-- Context Path --|-- Servlet Path -|--Path Info--|
      http://www.     /mywebapp        /helloServlet      /hello
      |-------- Request URI  ----------------------------|
      


      Remember the following three points:
      1. Request URI = context path + servlet path + path info.
      2. Context paths and servlet paths start with a / but do not end with it.
      3. HttpServletRequest provides three methods getContextPath(),
          getServletPath() and getPathInfo() to retrieve the context path,
          the servlet path, and the path info, respectively, associated with a request.


      Identifying the servlet path
      To match a request URI with a servlet, the servlet container follows a simple algorithm.
      Once it identifies the context path, if any, it evaluates the remaining part of the
      request URI with the servlet mappings specified in the deployment descriptor, in the
      following order. If it finds a match at any step, it does not take the next step.

      1 The container tries to match the request URI to a servlet mapping. If it finds a
      match, the complete request URI (except the context path) is the servlet path. In
      this case, the path info is null.
      2 It tries to recursively match the longest path by stepping down the request URI
      path tree a directory at a time, using the / character as a path separator, and determining
      if there is a match with a servlet. If there is a match, the matching part
      of the request URI is the servlet path and the remaining part is the path info.
      3 If the last node of the request URI contains an extension (.jsp, for example),
      the servlet container tries to match it to a servlet that handles requests for the
      specified extension. In this case, the complete request URI is the servlet path
      and the path info is null.
      4 If the container is still unable to find a match, it will forward the request to the
      default servlet. If there is no default servlet, it will send an error message indicating
      the servlet was not found.



      <servlet-mapping>
          <servlet-name>RedServlet</servlet-name>
          <url-pattern>/red/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
          <servlet-name>RedServlet</servlet-name>
          <url-pattern>/red/red/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
          <servlet-name>RedBlueServlet</servlet-name>
          <url-pattern>/red/blue/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
          <servlet-name>BlueServlet</servlet-name>
          <url-pattern>/blue/</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
          <servlet-name>GreenServlet</servlet-name>
          <url-pattern>/green</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
          <servlet-name>ColorServlet</servlet-name>
          <url-pattern>*.col</url-pattern>
      </servlet-mapping>


      Request URI                Servlet Used            Servlet Path        Path Info
      /colorapp/red                RedServlet              /red                 null
      /colorapp/red/               RedServlet              /red                 /
      /colorapp/red/aaa            RedServlet              /red                 /aaa

      /colorapp/red/blue/aa        RedBlueServlet          /red/blue            /aa
      /colorapp/red/red/aaa        RedServlet              /red/red             /aaa
      /colorapp/aa.col             ColorServlet            /aa.col              null

      /colorapp/hello/aa.col       ColorServlet            /hello/aa.col        null
      /colorapp/red/aa.col         RedServlet              /red                 /aa.col
      /colorapp/blue               NONE(Error message)                         
      /colorapp/hello/blue/        NONE(Error message)                         
      /colorapp/blue/mydir         NONE(Error message)
          
      /colorapp/blue/dir/aa.col    ColorServlet            /blue/dir/aa.col     null 
      /colorapp/green              GreenServlet            /green               null

      解釋一下:
      這里的三個(gè)錯(cuò)誤,都是錯(cuò)在blue上,注意blue的mapping url是/blue/而不是/blue或者/blue/*這是造成錯(cuò)誤的主要原因

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多