Strabon

changeset 183:2192aa4a6418

merge
author George Garbis <ggarbis@di.uoa.gr>
date Wed May 23 12:03:47 2012 +0300 (2012-05-23)
parents ea0f600da0a1 1d7ebafc223f
children 514cf28c79ab 91c401e50902
files
line diff
     1.1 --- a/endpoint/WebContent/WEB-INF/web.xml	Wed May 23 12:03:34 2012 +0300
     1.2 +++ b/endpoint/WebContent/WEB-INF/web.xml	Wed May 23 12:03:47 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	Wed May 23 12:03:34 2012 +0300
     2.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Wed May 23 12:03:47 2012 +0300
     2.3 @@ -134,7 +134,8 @@
     2.4  			response.setContentType("text/xml; charset=UTF-8");
     2.5  			hive.setFormat("XML");
     2.6  		} else if (reqFormat.equalsIgnoreCase("KML")) {
     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 +                        response.setHeader("Content-Disposition","attachment;filename=pico.kml");
    2.10  			hive.setFormat("KML");
    2.11  		} else if (reqFormat.equalsIgnoreCase("KMZ")) {
    2.12  			response.setContentType("application/vnd.google-earth.kmz");
    2.13 @@ -167,7 +168,7 @@
    2.14  			//String answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage);
    2.15  			//hive.setErrorMessage(errorMessage.toString());
    2.16  			//SecureRandom random = new SecureRandom();
    2.17 -			//String extension = (hive.format.equalsIgnoreCase("KMLMAP") ? "kml" : "kmz");
    2.18 +			String extension = (hive.format.equalsIgnoreCase("KML") ? "kml" : "kmz");
    2.19  			//String temp = new BigInteger(130, random).toString(32);   
    2.20  			
    2.21  			int status_code = HttpServletResponse.SC_OK;
    2.22 @@ -198,13 +199,14 @@
    2.23  				answer = e.getMessage();
    2.24  			}
    2.25  
    2.26 -			//response.setContentType("text/plain; charset=UTF-8");
    2.27 +                        //response.setContentType("text/plain");
    2.28 +			//response.setCharacterEncoding("UTF-8");
    2.29                          response.setStatus(status_code);
    2.30  			if (status_code == HttpServletResponse.SC_OK) {
    2.31 -                                response.setContentLength(answer.length());
    2.32 +                                //response.setContentLength(answer.length());
    2.33  				//response.getWriter().append(answer.toString());
    2.34                                  out.append(answer.toString());
    2.35 -                                out.flush();
    2.36 +                                //out.flush();
    2.37  
    2.38  			} else {
    2.39  				response.getWriter().append(ResponseMessages.getXMLHeader());