學習筆記

          Simple is beautiful.

          導航

          <2007年9月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          30123456

          統計

          公告

          ...

          常用鏈接

          留言簿(1)

          隨筆分類(2)

          隨筆檔案(56)

          Weblog

          搜索

          最新評論

          評論排行榜

          Coding Guidelines for URL Rewriting

          There are some general guidelines for how your code should handle URLs in order to support URL rewriting.

          • Avoid writing a URL straight to the output stream, as shown here:
            out.println("<a href=\"/myshop/catalog.jsp\">catalog</a>");

            Instead, use the HttpServletResponse.encodeURL() method, for example:

            out.println("<a href=\""
            + response.encodeURL("myshop/catalog.jsp")
            + "\">catalog</a>");

            Calling the encodeURL() method determines if the URL needs to be rewritten, and if so, it rewrites it by including the session ID in the URL. The session ID is appended to the URL and begins with a semicolon.

          • In addition to URLs that are returned as a response to WebLogic Server, also encode URLs that send redirects. For example:
            if (session.isNew())
              response.sendRedirect (response.encodeRedirectUrl(welcomeURL));

            WebLogic Server uses URL rewriting when a session is new, even if the browser does accept cookies, because the server cannot tell whether a browser accepts cookies in the first visit of a session.

          • Your servlet can determine whether a given session ID was received from a cookie by checking the Boolean returned from the HttpServletRequest.isRequestedSessionIdFromCookie() method. Your application may respond appropriately, or simply rely on URL rewriting by WebLogic Server.

          posted on 2007-09-01 11:48 Ecko 閱讀(251) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 梓潼县| 商南县| 腾冲县| 汨罗市| 永定县| 共和县| 大同县| 航空| 紫云| 金阳县| 鲁山县| 武平县| 垣曲县| 庄浪县| 修文县| 九江市| 沽源县| 江口县| 闽清县| 富宁县| 壶关县| 舟曲县| 武夷山市| 扶风县| 宝应县| 岐山县| 尚义县| 孟津县| 灌阳县| 镇坪县| 武安市| 搜索| 包头市| 枣强县| 永和县| 邮箱| 天全县| 沁阳市| 屏山县| 鹿邑县| 嘉祥县|