如何通过Java和Struts2中的Web应用程序代码(通过Web项目编写的代码)启用浏览器cookie?
谢谢。
答案 0 :(得分:0)
我在使用Cookie中的Cookie解决问题时使用Apache中的P3P策略,在IE中第三方cookie被阻止,以便通过浏览器解锁需要在Web服务器中进行配置。
apache配置文件中的setHeader。 ===>
Header set P3P "policyref=\"example.com/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
您也可以在项目的母版页中放置setHeader或addheader代码(可选)
在此之前创建一个P3P.xml文件(使用下面的示例或你可以使用生成器工具)并部署它。
示例P3P.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Generated by http://www.webentrust.com on 05/25/2011 -->
<META xmlns="http://www.w3.org/2002/01/P3Pv1">
<POLICY-REFERENCES>
<POLICY-REF about="#Policy">
<INCLUDE>/*</INCLUDE>
</POLICY-REF>
</POLICY-REFERENCES>
<POLICIES xmlns="http://www.w3.org/2002/01/P3Pv1">
<EXPIRY max-age="604800"/>
<POLICY name="Policy" discuri="http://www.example.com/privacy.html" opturi="http://www.example.com/contact.html">
<ENTITY>
<DATA-GROUP>
<DATA ref="#business.name">example.com</DATA>
<DATA ref="#business.contact-info.online.email">privacy@example.com</DATA>
</DATA-GROUP>
</ENTITY>
<ACCESS>
<all/>
</ACCESS>
<DISPUTES-GROUP>
<DISPUTES resolution-type="service" short-description="Privacy Disputes" service="http://example.com/contact.html">
<REMEDIES>
<CORRECT/>
</REMEDIES>
<LONG-DESCRIPTION>We will correct any privacy issues.</LONG-DESCRIPTION>
</DISPUTES>
<DISPUTES resolution-type="independent" short-description="Web Entrust" service="http://www.webentrust.com/sites/example.com.html">
<REMEDIES>
<CORRECT/>
</REMEDIES>
<LONG-DESCRIPTION>Web Entrust provides several active seals to represent increased trust, privacy and security. Public reviews provide accountability through an open review policy.</LONG-DESCRIPTION>
<IMG alt="Web Entrust Site Seals" src="http://www.webentrust.com/seals/trusted/example.com.png"/>
</DISPUTES>
</DISPUTES-GROUP>
<STATEMENT>
<CONSEQUENCE>Web server logs are maintained for this web-site.</CONSEQUENCE>
<EXTENSION optional="yes">
<STATEMENT-GROUP name="Logging" xmlns="http://www.w3.org/2006/01/P3Pv11"/>
</EXTENSION>
<PURPOSE>
<current/>
<admin/>
<develop/>
<pseudo-analysis/>
<pseudo-decision/>
<tailoring/>
</PURPOSE>
<RECIPIENT>
<ours/>
</RECIPIENT>
<RETENTION>
<business-practices/>
</RETENTION>
<DATA-GROUP>
<DATA ref="#dynamic.clickstream"></DATA>
<DATA ref="#dynamic.clientevents"></DATA>
<DATA ref="#dynamic.http"></DATA>
<DATA ref="#dynamic.searchtext"></DATA>
</DATA-GROUP>
</STATEMENT>
</POLICY>
</POLICIES>
</META>
了解更多详情: