Just write a filter to
1 PackageCom.neusoft.streamone.framework.security.filter;2 3 Importjava.io.IOException;4 5 ImportJavax.servlet.Filter;6 ImportJavax.servlet.FilterChain;7 ImportJavax.servlet.FilterConfig;8 Importjavax.servlet.ServletException;9 Importjavax.servlet.ServletRequest;Ten ImportJavax.servlet.ServletResponse; One ImportJavax.servlet.http.Cookie; A Importjavax.servlet.http.HttpServletRequest; - - /** the * Created on 2015-7-19 - * <p>description:cookie Add httponly properties </p> - * @authorHardware - * @version$Revision $ + */ - Public classCookiehttponlyfilterImplementsFilter + { A at @Override - Public voidDestroy () - { - - } - in @Override - Public voidDoFilter (ServletRequest request, servletresponse response, Filterchain Filterchain)throwsIOException, Servletexception to { +cookie[] Cookies =((httpservletrequest) request). GetCookies (); - if(cookies!=NULL) the { * for(Cookie cookie:cookies) { $ //TOMCAT7 supports this property, TOMCAT6 does not supportPanax NotoginsengCookie.sethttponly (true); - } the } + Filterchain.dofilter (request, response); A } the + @Override - Public voidInit (Filterconfig arg0)throwsservletexception $ { $ - } - the}
Missing HttpOnly attribute in session cookie resolved