jcricket/gwt-syncproxy

fetchSerializationPolicyName not working with GWT 2.7

Closed this issue · 3 comments

Hi,
It appears that GWT 2.7: 
- generates cache.js files instead of cache.html
- first cache file does not include SerializationPolicyName (user.agent ie8)
Please correct me if I'm wrong.

I made the following quick adjustements to the code to to get it working with 
2.7:

    public static Map<String, String> fetchSerializationPolicyName(
            String moduleBaseURL) throws IOException {
        Map<String, String> result = new HashMap<String, String>();

        moduleBaseURL = moduleBaseURL.trim(); // remove outer trim just in case
        String[] urlparts = moduleBaseURL.split("/");
        String moduleNoCacheJs = urlparts[urlparts.length - 1] + ".nocache.js"; // get

        String responseText = "";
        responseText = getResposeText(moduleBaseURL + moduleNoCacheJs);
        // parse the .nocache.js for list of Permutation name
        // Permutation name is 32 chars surrounded by apostrophe
        String regex = "\'([A-Z0-9]){32}\'";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(responseText);
        //5A-Lab change to support GWT 2.7
        while (matcher.find() && result.size()==0) {
            String permutationFile = matcher.group();
            permutationFile = permutationFile.replace("\'", "");

            //5A-Lab change to support GWT 2.7
            permutationFile += ".cache.js";
            responseText = getResposeText(moduleBaseURL + permutationFile);
            //5A-Lab change to support GWT 2.7
            Matcher cacheFileMatcher = pattern.matcher(responseText);
            int i = 0;
            while (cacheFileMatcher.find() && result.size()==0) {
                String policyName = cacheFileMatcher.group();
                policyName = policyName.replace("\'", "");
                if (0 == i++) {
                    // The first one is the permutation name
                    continue;
                }
                responseText = getResposeText(moduleBaseURL + policyName
                        + GWT_PRC_POLICY_FILE_EXT);
                result.putAll(parsePolicyName(policyName,
                        new ByteArrayInputStream(responseText.getBytes("UTF8"))));
            }
        }

        if (result.size() == 0) {
            logger.warning("No RemoteService fetched from server");
        } else {
            dumpRemoteService(result);
        }

        return result;
    }



Original issue reported on code.google.com by davorin....@5a-lab.com on 27 Nov 2014 at 9:39

  • Merged into: #35
This appears to be an issue related to using the xsiframe-linker, see Issue 35. 
Please advise which linker you are using, as this may not be a 2.7 specific 
issue. Based on the fix you provided, I believe it is likely Issue 35, which 
has a more general patch made available that will likely be released into the 
next version.

Original comment by p.pr...@blueesoteric.com on 25 Dec 2014 at 3:12

  • Changed state: Pending
On further review, this occurred for you in 2.7 because as of GWT 2.7, the 
XS-IFrame Linker became the default, which produces the .js files instead of 
the .html files. The patch provided in Issue 35 is similar to your provided 
code in functionality but provides legacy support. In either case, this issue 
will be resolved with in the 0.5 release.

Original comment by p.pr...@blueesoteric.com on 3 Jan 2015 at 9:46

  • Changed state: Duplicate
  • Added labels: Milestone-Release0.5, Usability
Sorry for the late response and thank you for clarifying.

Original comment by davorin....@5a-lab.com on 5 Jan 2015 at 7:29