Strabon

changeset 139:2c6b9d24ada8

KMLMAP/KMZMAP functionality
author Michael Sioutis
date Wed May 09 14:11:28 2012 +0300 (2012-05-09)
parents 1de6a3e4670f
children 59234a910710
files endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java
line diff
     1.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Wed May 09 12:35:14 2012 +0300
     1.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Wed May 09 14:11:28 2012 +0300
     1.3 @@ -243,13 +243,14 @@
     1.4  		} else if ((hive.getFormat().equalsIgnoreCase("KMLMAP")) || (hive.getFormat().equalsIgnoreCase("KMZMAP"))) {
     1.5  
     1.6  			StringBuilder errorMessage = new StringBuilder ();
     1.7 -			String answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage);
     1.8 +			String answer = evaluateQuery(strabonWrapper, hive.getFormat().equalsIgnoreCase("KMLMAP") ? "KML" : "KMZ", reqFuncionality, hive.getSPARQLQuery(), errorMessage);
     1.9  			hive.setErrorMessage(errorMessage.toString());
    1.10  			SecureRandom random = new SecureRandom();
    1.11  			String temp = new BigInteger(130, random).toString(32);  			
    1.12 -			String basePath = context.getRealPath("/") + "/../ROOT/tmp/";
    1.13 +			String basePath = context.getRealPath("/") + "/../ROOT/tmp/"; 
    1.14  			String extension = (hive.format.equalsIgnoreCase("KMLMAP") ? "kml" : "kmz");
    1.15  
    1.16 +			
    1.17  			try{
    1.18  				Date date = new Date();
    1.19  
    1.20 @@ -280,11 +281,11 @@
    1.21  				e.printStackTrace();
    1.22  			}
    1.23  
    1.24 -			response.setDateHeader("Expires", 0);			
    1.25 -			response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
    1.26 +			//response.setDateHeader("Expires", 0);			
    1.27 +			//response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
    1.28  
    1.29  			String pathToKML = "";
    1.30 -			response.setHeader("Location", request.getScheme() + "://" +  request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + "."+extension);
    1.31 +			//response.setHeader("Location", request.getScheme() + "://" +  request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + "."+extension);
    1.32  			
    1.33  			if (answer!="")
    1.34  				pathToKML = request.getScheme() + "://" +  request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + "."+extension;