Missing HttpOnly attribute in session cookie resolved

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.