posts - 48, comments - 13, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          Tapestry5ObtainingHttpServletRequest

          Tapestry encapsulates the HTTP servlet request, response and session, and you should not normally need to access them directly. However, sometimes it is necessary. For example, Acegi Security stores exception messages in the HttpSession.

          The underlying HTTP servlet mechanics are available via the [WWW] RequestGlobals service.

          Example

              @Inject
          private RequestGlobals requestGlobals;
          public void onActivate(Object context) {
          HttpSession session = requestGlobals.getHTTPServletRequest().getSession();
          ...
          }
          

          /!\ You need the servlet-api.jar in your classpath (dependency not included with tapestry quickstart).

          Alternatively, you can inject the HttpServletRequest directly (at least in 5.0.13):

              @Inject
          private HttpServletRequest _request;
          

          RequestGlobals is not accessible inside of AppModule.





          Copy From : http://wiki.apache.org/tapestry/Tapestry5ObtainingHttpServletRequest

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


          網站導航:
           
          主站蜘蛛池模板: 卢湾区| 昌吉市| 金平| 金溪县| 鄂尔多斯市| 伊通| 鄂托克旗| 孝义市| 涟水县| 静安区| 锦州市| 绥德县| 华蓥市| 石台县| 宁德市| 蒲城县| 临海市| 拜城县| 宜丰县| 富蕴县| 灵宝市| 浪卡子县| 建湖县| 阆中市| 岐山县| 洪泽县| 南靖县| 会理县| 区。| 久治县| 邯郸市| 新宾| 海城市| 玉屏| 通渭县| 来宾市| 邓州市| 手机| 佛坪县| 广汉市| 金乡县|