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"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <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> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </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> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </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> </classpath>

View File

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

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1 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 warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?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="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <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.SubmitRequestEvent;
import org.gcube.portlets.user.performfishanalytics.client.event.SubmitRequestEventHandler; 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.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.AnalyticsPanelResult;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.ShowResult; import org.gcube.portlets.user.performfishanalytics.client.viewbinder.ShowResult;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.SubmitRequestPanel; import org.gcube.portlets.user.performfishanalytics.client.viewbinder.SubmitRequestPanel;
@ -88,25 +89,39 @@ public class PerformFishAnalyticsController {
Scheduler.get().scheduleDeferred(new ScheduledCommand() { Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override @Override
public void execute() { public void execute() {
final String batchtypeParam = Window.Location.getParameter(PerformFishAnalyticsConstant.BATCHTYPE_PARAM); Map<String, String> initParams = new HashMap<String, String>();
final String farmidParam = Window.Location.getParameter(PerformFishAnalyticsConstant.FARMID_PARAM); 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()){ 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; return;
} }
if(farmidParam==null || farmidParam.isEmpty()){ 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; return;
} }
PerformFishInitParameter initParams = new PerformFishInitParameter(); PerformFishInitParameter performFishInitParams = new PerformFishInitParameter();
initParams.addParameter(PerformFishAnalyticsConstant.BATCHTYPE_PARAM, batchtypeParam); performFishInitParams.addParameter(PerformFishAnalyticsConstant.BATCHTYPE_PARAM, batchtypeParam);
initParams.addParameter(PerformFishAnalyticsConstant.FARMID_PARAM, farmidParam); performFishInitParams.addParameter(PerformFishAnalyticsConstant.FARMID_PARAM, farmidParam);
PerformFishAnalyticsServiceAsync.Util.getInstance().decryptAndValidParameters(initParams, new AsyncCallback<PerformFishInitParameter>() { PerformFishAnalyticsServiceAsync.Util.getInstance().decryptAndValidParameters(performFishInitParams, new AsyncCallback<PerformFishInitParameter>() {
@Override @Override
public void onSuccess(PerformFishInitParameter result) { 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);
}-*/;
}