@Path("/helloworld")
public class HelloWorld {
@GET
@Produces("text/plain")
public String hello(@Context HttpServletRequest req) {
HttpSession session= req.getSession(true);
Object foo = session.getAttribute("foo");
if (foo!=null) {
System.out.println(foo.toString());
} else {
foo = "bar";
session.setAttribute("foo", "bar");
}
return foo.toString();
}
}
星期日, 6月 03, 2012
[Java] Jersey Session
Session控制
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言
留個話吧:)