i tried
< Context cookies="true" crossContext="true">
< SessionCookie secure="true" httpOnly="true" />
in context.xml but it is not recognising in jboss4.0
and i tried in java program
String sessionid = req.getSession().getId();
resp.setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + ";Path="+req.getContextPath()+"; Secure; Domain="+req.getServerName()+"; HttpOnly");
for 2nd request it not allowing to get session validation object for session so it is showing session expired page
and i tried with filters
public void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain filterChain) throws IOException, ServletException {
final HttpServletResponse response = (HttpServletResponse) res;
final HttpServletRequest request = (HttpServletRequest) req;
System.out.println(response.containsHeader("SET-COOKIE"));
if (response.containsHeader("Set-Cookie")) { // *******
response.setHeader("SET-COOKIE", "JSESSIONID=" + request.getSession().getId() + "; Path=" + request.getContextPath()
+ "; HttpOnly" + (request.isSecure()?SECURE_FLAG : ""));
}
filterChain.doFilter(req, res);
}
IF I use above filter response.containsHeader("SET-COOKIE") or response.containsHeader("Set-Cookie") is always return false
can any one give me solution for jboss 4.0 Jsessionid flag configuration as secure and httponly
I can confirm that for JBoss 4.0.3 it works by manipulating the header in Filter implementation class. This works for me:
I've yet to confirm as to why a solution through context.xml is not supported. I have not found any references, only blog posts claiming that the only way to do it in JBoss 4 is programmatically. http://syams18.blogspot.se/2012/01/setting-httponly-in-jboss-httponly-is.html