query parameters are always decoded on portal rendering

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@133833 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-11-02 22:19:49 +00:00
parent 4fa83e2e07
commit b7c24a86fe
2 changed files with 20 additions and 4 deletions

View File

@ -4,7 +4,9 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.resource.CkanPortletResources;
@ -17,6 +19,7 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Frame;
@ -60,11 +63,22 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
ckanOrganizationsPanel = new CkanOrganizationsPanel(this);
initPanel();
setTopPanelVisible(true);
String pathParameter =
Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER);
String queryParameter =
Window.Location.getParameter(GCubeCkanDataCatalog.GET_QUERY_PARAMETER);
// decode parameters (they could have been encoded)
Map<String, String> paramsMap = new HashMap<String, String>(2);
String queryParameters = Window.Location.getQueryString();
if(queryParameters != null){
String decoded = URL.decodeQueryString(queryParameters); // equals should be encoded too (%3D)
String[] params = decoded.substring(decoded.indexOf("?") + 1).split("&");
for (int i = 0; i < params.length; i++) {
String[] queryAndValue = params[i].split("=");
paramsMap.put(queryAndValue[0], queryAndValue[1]);
}
GWT.log("Extracted parameters are " + paramsMap);
}
String pathParameter = paramsMap.get(GCubeCkanDataCatalog.GET_PATH_PARAMETER); //Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER);
String queryParameter = paramsMap.get(GCubeCkanDataCatalog.GET_QUERY_PARAMETER);// Window.Location.getParameter(GCubeCkanDataCatalog.GET_QUERY_PARAMETER);
String currentPortletUrl = Window.Location.getHref().split("\\?")[0];// ignore get parameters
GCubeCkanDataCatalog.service.getCKanConnector(

View File

@ -25,6 +25,8 @@
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<inherits name="com.google.gwt.http.HTTP" />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />