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

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


          網站導航:
           
          主站蜘蛛池模板: 塔城市| 盖州市| 莫力| 八宿县| 石城县| 华容县| 九龙坡区| 新建县| 仙居县| 平利县| 万盛区| 新巴尔虎左旗| 桑植县| 天气| 汉寿县| 通渭县| 安溪县| 洛南县| 永安市| 十堰市| 兰州市| 区。| 滁州市| 沂南县| 屏山县| 桃园市| 成安县| 建平县| 浮山县| 正镶白旗| 普兰店市| 仙游县| 寻乌县| 寿光市| 塔河县| 天津市| 扶绥县| 如皋市| 花莲市| 贺州市| 离岛区|