ref 7167:DataMiner interface should report encoded parameters in the URL

https://support.d4science.org/issues/7167

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@142799 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-02-20 16:49:40 +00:00
parent 843733bae1
commit d4d7da6c67
1 changed files with 42 additions and 15 deletions

View File

@ -733,8 +733,8 @@ public class SClient4WPS extends SClient {
throw new Exception("Invalid processLocation: " + processUrl); throw new Exception("Invalid processLocation: " + processUrl);
} }
String equivalentRequest = extractEquivalentRequestForComputation(operator, String equivalentRequest = extractEquivalentRequestForComputation(
equivalentRequestMap); operator, equivalentRequestMap);
ComputationId computationId = new ComputationId(id, processUrl, ComputationId computationId = new ComputationId(id, processUrl,
operator.getId(), operator.getName(), equivalentRequest); operator.getId(), operator.getName(), equivalentRequest);
@ -753,18 +753,31 @@ public class SClient4WPS extends SClient {
+ "&DataInputs="; + "&DataInputs=";
for (String key : equivalentRequestMap.keySet()) { for (String key : equivalentRequestMap.keySet()) {
String value=""; String keyEncoded = "";
try { try {
value = URLEncoder.encode(equivalentRequestMap.get(key), keyEncoded = URLEncoder.encode(key, "UTF-8");
} catch (UnsupportedEncodingException e) {
logger.error(
"Error in equivalent request creation: Unsupported Encoding for parameter="
+ key, e);
break;
}
String valueEncoded = "";
try {
valueEncoded = URLEncoder.encode(equivalentRequestMap.get(key),
"UTF-8"); "UTF-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
logger.error("Error in equivalent request creation: Unsupported Encoding for key=" logger.error(
+ key,e); "Error in equivalent request creation: Unsupported Encoding for value="
+ equivalentRequestMap.get(key)
+ " of parameter=" + key, e);
break;
} }
equivalentRequest = equivalentRequest + keyEncoded + "="
equivalentRequest = equivalentRequest + key + "=" + valueEncoded + ";";
+ value + ";";
} }
return equivalentRequest; return equivalentRequest;
} }
@ -1288,7 +1301,6 @@ public class SClient4WPS extends SClient {
throw new Exception("Invalid processLocation: " + processUrl); throw new Exception("Invalid processLocation: " + processUrl);
} }
String equivalentRequest = extractEquivalentRequestForResubmit( String equivalentRequest = extractEquivalentRequestForResubmit(
computationProperties, equivalentRequestMap); computationProperties, equivalentRequestMap);
@ -1311,16 +1323,31 @@ public class SClient4WPS extends SClient {
+ computationProperties.get("operator_id") + "&DataInputs="; + computationProperties.get("operator_id") + "&DataInputs=";
for (String key : equivalentRequestMap.keySet()) { for (String key : equivalentRequestMap.keySet()) {
String value=""; String keyEncoded = "";
try { try {
value = URLEncoder.encode(equivalentRequestMap.get(key), keyEncoded = URLEncoder.encode(key, "UTF-8");
} catch (UnsupportedEncodingException e) {
logger.error(
"Error in equivalent request creation: Unsupported Encoding for parameter="
+ key, e);
break;
}
String valueEncoded = "";
try {
valueEncoded = URLEncoder.encode(equivalentRequestMap.get(key),
"UTF-8"); "UTF-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
logger.error("Error in equivalent request creation: Unsupported Encoding for key=" logger.error(
+ key,e); "Error in equivalent request creation: Unsupported Encoding for value="
+ equivalentRequestMap.get(key)
+ " of parameter=" + key, e);
break;
} }
equivalentRequest = equivalentRequest + key + "=" + value + ";"; equivalentRequest = equivalentRequest + keyEncoded + "="
+ valueEncoded + ";";
} }
return equivalentRequest; return equivalentRequest;
} }