1

When I click on "update preview", "update preview" show again and again.

Because Real URL is different from URL of Broker DB, the above problem happen.

So, I solve the problem by using ADF.

I confirm that custom claimProsessor is work and the variables claim store have by the following question.

About ADF solution for Update Preview issue in XPM

next To solve the XPM issue, I implement custom claimProsessor.

the solution is that Real URL is same to URL of Broker DB.

so I implement that the value of taf:request:full_url is changed to URL of Broker DB.

  1. implement program and build

    public class AmbientDataFrameworkExtensionHandler extends AbstractClaimProcessor {
    
    @Override
    public void onRequestStart(ClaimStore claimStore) throws AmbientDataException {
        File file = new File("/tmp/log_adf1.txt");
        FileWriter filewriter = null;
        try {
            filewriter = new FileWriter(file);
            TreeMap<URI, Object> claims = new TreeMap<URI, Object>();
            Map<URI, Object> allClaims = claimStore.getAll();
            for (URI claimUri : allClaims.keySet()) {
                filewriter.write(claimUri.toString());
                filewriter.write("\n");
                filewriter.write(allClaims.get(claimUri).toString());
                filewriter.write("\n");
                if (claimStore.isReadOnly(claimUri)) {
                    if ("taf:request:full_url".equals(claimUri.toString())) {
                        claims.put(claimUri, allClaims.get(claimUri).toString().replace("/xxxx/", "/yyyy/"));
                    } else {
                        claims.put(claimUri, allClaims.get(claimUri));
                    }
                    filewriter.write("read only");
                    filewriter.write("\n");
                } else {
                    filewriter.write("not read only");
                    filewriter.write("\n");
                }
            }
            try {
                claimStore.clearReadOnly();
                for (URI claimsUri : claims.keySet()) {
                    claimStore.put(claimsUri, claims.get(claimsUri));
                }
            } catch (Exception e) {
                filewriter.write(e.getMessage());
            }
            filewriter.write("\n");
            filewriter.write("final");
            Map<URI, Object> allAfterClaims = claimStore.getAll();
            for (URI claimAfterUri : allAfterClaims.keySet()) {
                filewriter.write(claimAfterUri.toString());
                filewriter.write("\n");
                filewriter.write(allAfterClaims.get(claimAfterUri).toString());
                filewriter.write("\n");
            }
            filewriter.close();
        } catch (Exception e) {
            throw new AmbientDataException(e);
        }
    }
    
    @Override
    public void onRequestEnd(ClaimStore claimStore) throws AmbientDataException {
        File file = new File("/tmp/log_adf2.txt");
        FileWriter filewriter = null;
        try {
            filewriter = new FileWriter(file);
            TreeMap<String, Object> claims = new TreeMap<String, Object>();
            Map<URI, Object> allClaims = claimStore.getAll();
            for (URI claimUri : allClaims.keySet()) {
                claims.put(claimUri.toString(), allClaims.get(claimUri));
                filewriter.write(claimUri.toString());
                filewriter.write("\n");
                filewriter.write(allClaims.get(claimUri).toString());
                filewriter.write("\n");
            }
            filewriter.close();
        } catch (Exception e) {
            throw new AmbientDataException(e);
        }
    }
    
    @Override
    public void onSessionStart(ClaimStore claimStore) throws AmbientDataException {
        File file = new File("/tmp/log_adf3.txt");
        FileWriter filewriter = null;
        try {
            filewriter = new FileWriter(file);
            filewriter.write("onSessionStart");
            filewriter.close();
        } catch (Exception e) {
            throw new AmbientDataException(e);
        }
    }
    

    }

  2. create cd_ambient_cartridge_conf.xml (configuration file)

  3. configure cd_ambient_conf.xml

  4. restart webservice

  5. access the webpage

  6. confirm the result

    I confirm that Real URL is same to URL of Broker DB. but XPM issue is not solved. Is My solved approach wrong or my implementation wrong ?

I refer to the follow pages. the follow pages are very useful for me.

http://docs.sdl.com/LiveContent/content/en-US/SDL%20Tridion%20full%20documentation-v1/GUID-C6537469-7D70-4F82-B6C9-7883213F9F1B

http://jaimesantosalcon.blogspot.jp/2013/10/managing-claims-and-their-scope-in-sdl.html

http://erichuiza.blogspot.jp/2012/07/ambient-data-framework-in-nutshell.html

https://github.com/TridionPractice/tridion-practice/blob/master/AmbientDataFramework/ClaimStore.jsp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.