Strabon

changeset 174:2ecb0d2877a8

small additions
author Michael Sioutis
date Tue May 22 15:14:43 2012 +0300 (2012-05-22)
parents 072932f4751e
children f986c0fce749
files endpoint/WebContent/WEB-INF/web.xml endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java
line diff
     1.1 --- a/endpoint/WebContent/WEB-INF/web.xml	Mon May 21 20:49:35 2012 +0300
     1.2 +++ b/endpoint/WebContent/WEB-INF/web.xml	Tue May 22 15:14:43 2012 +0300
     1.3 @@ -54,6 +54,15 @@
     1.4  <!-- 		<servlet-name>QueryServlet</servlet-name> -->
     1.5  <!-- 		<url-pattern>/QueryServlet</url-pattern> -->
     1.6  <!-- 	</servlet-mapping> -->
     1.7 + 
     1.8 +    	<mime-mapping>
     1.9 +        	<extension>kml</extension>
    1.10 +        	<mime-type>application/vnd.google-earth.kml+xml</mime-type>
    1.11 +    	</mime-mapping>
    1.12 +    	<mime-mapping>
    1.13 +        	<extension>kmz</extension>
    1.14 +        	<mime-type>application/vnd.google-earth.kmz</mime-type>
    1.15 +    	</mime-mapping>
    1.16  	
    1.17  	<session-config>
    1.18  		<session-timeout>60</session-timeout>
     2.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Mon May 21 20:49:35 2012 +0300
     2.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Tue May 22 15:14:43 2012 +0300
     2.3 @@ -122,10 +122,10 @@
     2.4  			hive.setFormat("HTML");
     2.5  			response.setContentType("text/html; charset=UTF-8");			
     2.6  		} else if (reqAccept.contains("application/vnd.google-earth.kml+xml")) {
     2.7 -			response.setContentType("application/vnd.google-earth.kml+xml");
     2.8 +			response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8");
     2.9  			hive.setFormat("KML");
    2.10  		} else if (reqAccept.contains("application/vnd.google-earth.kmz")) {
    2.11 -			response.setContentType("application/vnd.google-earth.kmz");
    2.12 +			response.setContentType("application/vnd.google-earth.kmz; charset=UTF-8");
    2.13  			hive.setFormat("KMZ");
    2.14  		} else if (reqAccept.contains("application/sparql-results+xml")) {			
    2.15  			response.setContentType("application/sparql-results+xml; charset=UTF-8");
    2.16 @@ -134,10 +134,10 @@
    2.17  			response.setContentType("text/xml; charset=UTF-8");
    2.18  			hive.setFormat("XML");
    2.19  		} else if (reqFormat.equalsIgnoreCase("KML")) {
    2.20 -			response.setContentType("application/vnd.google-earth.kml+xml");
    2.21 +			response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8");
    2.22  			hive.setFormat("KML");
    2.23  		} else if (reqFormat.equalsIgnoreCase("KMZ")) {
    2.24 -			response.setContentType("application/vnd.google-earth.kmz");
    2.25 +			response.setContentType("application/vnd.google-earth.kmz; charset=UTF-8");
    2.26  			hive.setFormat("KMZ");
    2.27  		} else if (reqFormat.equalsIgnoreCase("SPARQLRESULTS"))  {
    2.28  			response.setContentType("application/sparql-results+xml; charset=UTF-8");
    2.29 @@ -167,7 +167,7 @@
    2.30  			//String answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage);
    2.31  			//hive.setErrorMessage(errorMessage.toString());
    2.32  			//SecureRandom random = new SecureRandom();
    2.33 -			//String extension = (hive.format.equalsIgnoreCase("KMLMAP") ? "kml" : "kmz");
    2.34 +			String extension = (hive.format.equalsIgnoreCase("KML") ? "kml" : "kmz");
    2.35  			//String temp = new BigInteger(130, random).toString(32);   
    2.36  			
    2.37  			int status_code = HttpServletResponse.SC_OK;
    2.38 @@ -200,11 +200,12 @@
    2.39  
    2.40  			//response.setContentType("text/plain; charset=UTF-8");
    2.41                          response.setStatus(status_code);
    2.42 +                        response.setHeader("Content-Disposition","attachment; filename=pico.kml");
    2.43  			if (status_code == HttpServletResponse.SC_OK) {
    2.44                                  response.setContentLength(answer.length());
    2.45  				//response.getWriter().append(answer.toString());
    2.46                                  out.append(answer.toString());
    2.47 -                                out.flush();
    2.48 +                                //out.flush();
    2.49  
    2.50  			} else {
    2.51  				response.getWriter().append(ResponseMessages.getXMLHeader());