zk 获取session,request,servletContext,response
(参考:http://www.dotblogs.com.tw/rockywang/archive/2010/01/13/12995.aspx)
HttpServletRequest request = (HttpServletRequest) Executions.getCurrent().getNativeRequest();
HttpSession session = request.getSession(true);
或
HttpSession session = (HttpSession) Executions.getCurrent().getDesktop().getSession();
ServletContext sc =
(ServletContext) Sessions.getCurrent().getWebApp().getNativeContext();
HttpServletRequest request =
(HttpServletRequest) Executions.getCurrent().getNativeRequest();
HttpServletResponse response = (HttpServletResponse)Executions.getCurrent().getNativeResponse();
zk 获取session,request,servletContext,response的更多相关文章
- spring的普通类中获取session和request对像
在使用spring时,经常需要在普通类中获取session,request等对像. 1.第一钟方式,针对Spring和Struts2集成的项目: 在有使用struts2时,因为struts2有一个接口 ...
- spring在普通类中获取session和request
在使用spring时,经常需要在普通类中获取session,request等对像.比如一些AOP拦截器类,在有使用struts2时,因为struts2有一个接口使用org.apache.struts2 ...
- Python3+Selenium获取session和token供Requests使用教程
一.背景说明 之前写了一款简单的api模糊测试工具,之前系统可以使用http Base认证现在改成session形式并加上了token. 最简单的改造方法,是自己先在浏览器手动登录,然后提取出sess ...
- java web(三):ServletContext、session、ServletConfig、request、response对象
上一篇讲了Servlet: 1)什么是Servlet[servlet本身就是一种Java类,这种Java类提供了web形式的方法,只要实现了servlet接口的类,都是一种servlet资源.] 2) ...
- Spring获取request、session以及servletContext
获取request: HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestA ...
- struts2中获取request、response,与android客户端进行交互(文件传递给客户端)
用struts2作为服务器框架,与android客户端进行交互需要得到request.response对象. struts2中获取request.response有两种方法. 第一种:利用Servle ...
- SpringMvc4中获取request、response对象的方法
springMVC4中获取request和response对象有以下两种简单易用的方法: 1.在control层获取 在control层中获取HttpServletRequest和HttpServle ...
- 获取Session和request方法
action中的几种写法 //第一种很少用public class LoginAction1 extends ActionSupport { private Map request; ...
- request,response,session,cookie,application
A:request 客服端向服务器端请求 JAVA讲究封装,所以Request也是某个东西的封装,到底是什么东西呢? 按字面意思:请求! 从Http协议说起,当你发一个请求到服务端的时候,你会把一些信 ...
随机推荐
- 【java基础】面向过程~面向对象
相信大家都知道这两个东西,可是大家是如何知道的呢?我们又该如何区分这个东西到底是面向过程还是面向对象的呢? 那,我们首先就要知道什么是面向过程,什么是面向对象: 面向过程"(Procedur ...
- hdu1160 LIS变形
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1160 题意:两个子序列 一个是升序,一个是降序,求最长的子序列是多长,并输出路径.(答案不 ...
- CSS3-animation,表格表单的格式化
animation 1.与transition一样,animation在IE9之前都不支持,不仅如此,还需要大量的供应商前缀 2.定义关键帧:@内容中需要大量的前缀 @keyframes fadeI ...
- [转] Spring MVC sample application for downloading files
http://www.codejava.net/frameworks/spring/spring-mvc-sample-application-for-downloading-files n this ...
- 每天一个linux命令--locate
linux下,不知道自己安装的程序放在哪里了,可以使用locate命令进行查找. [hongye@dev107 ~]$ locate activemq.xml /home/hongye/hongyeC ...
- SOAPUI测试步骤之流量控制(Conditional Goto)
1. TestSteps流量控制 1.1.有条件转到一步步测试 Conditional Goto拥有任意数量的的XPath表达式伴随相应的目标测试步骤.这些被应用到在先前的采样测试的最近的响应; 配置 ...
- hbase 问题记录
hbase regionserver挂掉~ org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hdfs.server.namenode.L ...
- CentOS增加swap分区
使用dd命令创建一个swap分区 [root@localhost Desktop]#dd if=/dev/zero of=/home/swap bs=1024 count=1048576 count的 ...
- [转]复制虚拟机后linux中的eth0变成eth1问题
为什么原来的eth0会变成eth1? 很多Linux distribution使用udev动态管理设备文件,并根据设备的信息对其进行持久化命名.udev会在系统引导的过程中识别网卡,将mac地址和网卡 ...
- gulp plugins 插件介绍
目录 [−] gulp API gulp.src(globs[, options]) gulp.dest(path[, options]) gulp.task(name[, deps], fn) gu ...