Added decoded base64

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@178532 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-03-11 16:14:40 +00:00
parent 35302f698b
commit 1c80354d80
6 changed files with 64 additions and 19 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/performfish-analytics-portlet-0.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/performfish-analytics-portlet-0.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/performfish-analytics-portlet-0.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/performfish-analytics-portlet-0.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/performfish-analytics-portlet-0.0.1-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/performfish-analytics-portlet-0.1.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -35,11 +35,6 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.gwtplugins.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
@ -50,6 +45,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1
lastWarOutDir=/home/francesco-mangiacrapa/eclipse-workspace/performfish-analytics-portlet-TRUNK/target/performfish-analytics-portlet-0.0.1-SNAPSHOT
lastWarOutDir=/home/francesco-mangiacrapa/eclipse-workspace/performfish-analytics-portlet/target/performfish-analytics-portlet-0.1.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="performfish-analytics-portlet-0.0.1-SNAPSHOT">
<wb-module deploy-name="performfish-analytics-portlet-0.1.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>

View File

@ -29,6 +29,7 @@ import org.gcube.portlets.user.performfishanalytics.client.event.SelectedPopulat
import org.gcube.portlets.user.performfishanalytics.client.event.SubmitRequestEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.SubmitRequestEventHandler;
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.client.view.util.DecodeParameterUtil;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.AnalyticsPanelResult;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.ShowResult;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.SubmitRequestPanel;
@ -88,25 +89,39 @@ public class PerformFishAnalyticsController {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
final String batchtypeParam = Window.Location.getParameter(PerformFishAnalyticsConstant.BATCHTYPE_PARAM);
final String farmidParam = Window.Location.getParameter(PerformFishAnalyticsConstant.FARMID_PARAM);
Map<String, String> initParams = new HashMap<String, String>();
for (String key : Window.Location.getParameterMap().keySet()) {
try {
String dKeY = DecodeParameterUtil.base64Decode(key);
String eValue = Window.Location.getParameter(key);
String dParam = DecodeParameterUtil.base64Decode(eValue);
initParams.put(dKeY, dParam);
} catch (Exception e) {
GWT.log("Error: "+e.getMessage());
}
}
GWT.log("Decoded parameters: "+initParams);
final String batchtypeParam = initParams.get(PerformFishAnalyticsConstant.BATCHTYPE_PARAM);
final String farmidParam = initParams.get(PerformFishAnalyticsConstant.FARMID_PARAM);
if(batchtypeParam==null || batchtypeParam.isEmpty()){
Window.alert("You must pass a valid '"+PerformFishAnalyticsConstant.BATCHTYPE_PARAM+"' param");
Window.alert("Error: no '"+PerformFishAnalyticsConstant.BATCHTYPE_PARAM+"' param detected");
return;
}
if(farmidParam==null || farmidParam.isEmpty()){
Window.alert("You must pass a valid '"+PerformFishAnalyticsConstant.FARMID_PARAM+"' param");
Window.alert("Error: no '"+PerformFishAnalyticsConstant.FARMID_PARAM+"' param detected");
return;
}
PerformFishInitParameter initParams = new PerformFishInitParameter();
initParams.addParameter(PerformFishAnalyticsConstant.BATCHTYPE_PARAM, batchtypeParam);
initParams.addParameter(PerformFishAnalyticsConstant.FARMID_PARAM, farmidParam);
PerformFishInitParameter performFishInitParams = new PerformFishInitParameter();
performFishInitParams.addParameter(PerformFishAnalyticsConstant.BATCHTYPE_PARAM, batchtypeParam);
performFishInitParams.addParameter(PerformFishAnalyticsConstant.FARMID_PARAM, farmidParam);
PerformFishAnalyticsServiceAsync.Util.getInstance().decryptAndValidParameters(initParams, new AsyncCallback<PerformFishInitParameter>() {
PerformFishAnalyticsServiceAsync.Util.getInstance().decryptAndValidParameters(performFishInitParams, new AsyncCallback<PerformFishInitParameter>() {
@Override
public void onSuccess(PerformFishInitParameter result) {

View File

@ -0,0 +1,30 @@
package org.gcube.portlets.user.performfishanalytics.client.view.util;
// TODO: Auto-generated Javadoc
/**
* The Class DecodeParameterUtil.
*/
public class DecodeParameterUtil {
/**
* Base 64 decode.
*
* @param valueToDecode the value to decode
* @return the long
* @throws Exception the exception
*/
public static String base64Decode(String valueToDecode) throws Exception{
try {
return b64decode(valueToDecode);
}catch (Exception e) {
throw new Exception("Error on decoding the parameter: "+ valueToDecode, e);
}
}
private static native String b64decode(String a) /*-{
return window.atob(a);
}-*/;
}