开发者

Enable browser cookie through program in struts2 java

How can I enable the browser cook开发者_StackOverflow中文版ie, through web application code (through code written in web projects) in Java and Struts2?

Thank you.


my issue with Cookie in IE solve by using P3P policy in Apache, In IE third party cookies were being blocked to make them unblock by browser need to configure in web server.

setHeader in apache config file. ===>

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\""

also you can place setHeader Or addheader code in masterpage of your project (Optional)

before this create a P3P.xml file (using below sample or u can use generator tool) and deploy it.

Sample 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>

for More details:

  1. http://www.p3pwriter.com
  2. Accessing Domain Cookies within an iFrame on Internet Explorer internet-explorer
  3. https://stackoverflow.com/users/13002/sleep-deprivation-ninja
  4. http://msdn.microsoft.com/en-us/library/ms537343.aspx
  5. Cookie blocked/not saved in IFRAME in Internet Explorer

To Validate your Privacy Policy xml file :

1.http://www.w3.org/P3P/validator.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜