diff --git a/pom.xml b/pom.xml
index 33e97a8..0f8cdf7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,6 +129,18 @@
2.0
provided
+
+ org.slf4j
+ slf4j-log4j12
+ 1.6.4
+ provided
+
+
+ org.slf4j
+ slf4j-api
+ 1.6.4
+ provided
+
junit
junit
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java
index fe7ccbb..ea02b17 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java
@@ -48,7 +48,7 @@ public class GeoportalDataViewer implements EntryPoint {
private String paramLayerTitle;
/** The layer manager. */
- private LayerManager layerManager;
+ private LayerManager layerManager = new LayerManager();
/**
* This is the entry point method.
@@ -64,7 +64,7 @@ public class GeoportalDataViewer implements EntryPoint {
@Override
public void execute() {
olMap = new OpenLayerOSM(mainPanel.getMapPanel().getElement().getId());
- layerManager = new LayerManager(olMap);
+ layerManager.setOlMap(olMap);
mainPanel.setMap(olMap);
}
@@ -93,7 +93,7 @@ public class GeoportalDataViewer implements EntryPoint {
int indexStart = paramWmsRequest.indexOf("?");
String url;
if(indexStart>=0){
- url = paramWmsRequest.substring(0, indexStart); //get only base uri
+ url = paramWmsRequest.substring(0, indexStart); //get only base uri
url = url.trim(); //string trim
}else{
Window.alert("Bad wms request '?' not found!");
@@ -102,9 +102,16 @@ public class GeoportalDataViewer implements EntryPoint {
String layerName = URLUtil.getValueOfParameter("layers", paramWmsRequest);
String displayName = paramLayerTitle==null || paramLayerTitle.isEmpty()?layerName:paramLayerTitle;
- layerManager.addLayerByWmsRequest(displayName, layerName, paramWmsRequest, false, false, paramUUID, true);
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+
+ @Override
+ public void execute() {
+ layerManager.addLayerByWmsRequest(displayName, layerName, paramWmsRequest, false, false, paramUUID, true);
+ }
+ });
+
} catch (Exception e) {
- GWT.log("An error occurred on adding wmsrequest :" + paramWmsRequest);
+ GWT.log("An error occurred on adding wmsrequest :" + paramWmsRequest, e);
e.printStackTrace();
}
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java
index 6bbc283..3fd7240 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java
@@ -5,31 +5,24 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoInformationForW
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
-public interface GeoportalDataViewerServiceAsync
-{
+public interface GeoportalDataViewerServiceAsync {
+ /**
+ * Utility class to get the RPC Async interface from client-side code
+ */
+ public static final class Util {
+ private static GeoportalDataViewerServiceAsync instance;
+ public static final GeoportalDataViewerServiceAsync getInstance() {
+ if (instance == null) {
+ instance = (GeoportalDataViewerServiceAsync) GWT.create(GeoportalDataViewerService.class);
+ }
+ return instance;
+ }
- /**
- * Utility class to get the RPC Async interface from client-side code
- */
- public static final class Util
- {
- private static GeoportalDataViewerServiceAsync instance;
-
- public static final GeoportalDataViewerServiceAsync getInstance()
- {
- if ( instance == null )
- {
- instance = (GeoportalDataViewerServiceAsync) GWT.create( GeoportalDataViewerService.class );
- }
- return instance;
- }
-
- private Util()
- {
- // Utility class should not be instantiated
- }
- }
+ private Util() {
+ // Utility class should not be instantiated
+ }
+ }
void parseWmsRequest(String wmsRequest, String layerName, AsyncCallback callback);
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java
index b828c54..0e3e7f4 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java
@@ -15,6 +15,7 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
+// TODO: Auto-generated Javadoc
/**
* The Class LayerManager.
*
@@ -32,11 +33,8 @@ public class LayerManager {
/**
* Instantiates a new layer manager.
- *
- * @param olMap the ol map
*/
- public LayerManager(OpenLayerOSM olMap) {
- this.olMap = olMap;
+ public LayerManager() {
}
@@ -179,6 +177,16 @@ public class LayerManager {
// layersPanel.addLayerItems(layerItems, onTop);
// layersPanel.updateLayersOrder();
}
+
+
+ /**
+ * Sets the ol map.
+ *
+ * @param olMap the new ol map
+ */
+ public void setOlMap(OpenLayerOSM olMap) {
+ this.olMap = olMap;
+ }
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/util/URLUtil.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/util/URLUtil.java
index 2c398f0..385a160 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/util/URLUtil.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/util/URLUtil.java
@@ -15,7 +15,6 @@ public class URLUtil {
// logger.trace("start index of "+wmsParam+ " is: "+index);
String value = "";
if(index > -1){
-
int start = index + paramName.length()+1; //add +1 for char '='
String sub = url.substring(start, url.length());
int indexOfSeparator = sub.indexOf("&");
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java
index a262665..cfc4e59 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java
@@ -27,23 +27,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
/** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerServiceImpl.class);
- /**
- * Escape an html string. Escaping data received from the client helps to
- * prevent cross-site script vulnerabilities.
- *
- * @param html the html string to escape
- * @return the escaped string
- */
- private String escapeHtml(String html) {
- if (html == null) {
- return null;
- }
- return html.replaceAll("&", "&").replaceAll("<", "<").replaceAll(
- ">", ">");
- }
-
@Override
- public GeoInformationForWMSRequest parseWmsRequest(String wmsRequest, String layerName) throws Exception{
+ public GeoInformationForWMSRequest parseWmsRequest(String wmsRequest, String layerName) throws Exception {
return loadGeoInfoForWmsRequest(wmsRequest, layerName);
}