You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using code splitting, when a service is not included in the initial code, the
policy name for this service is not found in the permutation html but in the
deferred js file.
I changed the fetchSerializationPolicyName method to crawl the deferred js
files.
Here is the modified method:
//////CODE//////////
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 last word of url appended with .nocache.js
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);
// while (matcher.find())
if (matcher.find()){
/// BEGIN CHANGE////
String permutationName=matcher.group();
permutationName = permutationName.replace("\'", "");
// Load the first permutation html file
String permutationFile =permutationName+ ".cache.html";
/// END CHANGE///
responseText = getResposeText(moduleBaseURL + permutationFile);
matcher = pattern.matcher(responseText);
int i = 0;
while (matcher.find()){
String policyName = matcher.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"))));
}
/// BEGIN CHANGE////
//Iterate over fragment files
boolean exists=true;
int fragmentIndex=1;
while(exists){
String url= moduleBaseURL+"deferredjs/"+permutationName+"/"+fragmentIndex+".cache.js";
try {
responseText = getResposeText(url);
matcher = pattern.matcher(responseText);
i = 0;
while (matcher.find()){
String policyName = matcher.group();
policyName = policyName.replace("\'", "");
responseText = getResposeText(moduleBaseURL + policyName + GWT_PRC_POLICY_FILE_EXT);
result.putAll(parsePolicyName(policyName, new ByteArrayInputStream(responseText.getBytes("UTF8"))));
}
} catch (IOException e) {
//no found
exists=false;
}
fragmentIndex++;
}
/// END CHANGE///
}
if (result.size() == 0){
logger.warning("No RemoteService fetched from server");
}else{
dumpRemoteService(result);
}
return result;
}
//////END CODE//////////
I made that quickly but it works for my installation.
Original issue reported on code.google.com by [email protected] on 1 Nov 2011 at 12:24
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 1 Nov 2011 at 12:24The text was updated successfully, but these errors were encountered: