Strabon

changeset 274:215a496f0410

Adding utf-8 support - fix
author Kostis Kyzirakos <kkyzir@di.uoa.gr>
date Wed Jun 13 17:57:27 2012 +0300 (2012-06-13)
parents 8b75a4e15e4b
children 40e87b44f8f7
files endpoint/WebContent/WEB-INF/beans.xml endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java
line diff
     1.1 --- a/endpoint/WebContent/WEB-INF/beans.xml	Wed Jun 13 11:22:02 2012 +0300
     1.2 +++ b/endpoint/WebContent/WEB-INF/beans.xml	Wed Jun 13 17:57:27 2012 +0300
     1.3 @@ -19,7 +19,7 @@
     1.4  
     1.5          <constructor-arg type="java.lang.String" >
     1.6              <!-- Database name -->
     1.7 -            <value>endpoint</value>
     1.8 +            <value>endpoint-remote</value>
     1.9          </constructor-arg>
    1.10  
    1.11          <constructor-arg type="java.lang.String" >
    1.12 @@ -29,7 +29,7 @@
    1.13  
    1.14          <constructor-arg type="java.lang.String" >
    1.15              <!-- Password -->
    1.16 -	    <value>postgres</value>
    1.17 +	    <value>p1r3as</value>
    1.18          </constructor-arg>
    1.19  
    1.20          <constructor-arg type="int" >
    1.21 @@ -39,7 +39,7 @@
    1.22  
    1.23          <constructor-arg type="java.lang.String" >
    1.24              <!-- Database server -->
    1.25 -            <value>localhost</value>
    1.26 +            <value>kakofonix.di.uoa.gr</value>
    1.27          </constructor-arg>
    1.28  
    1.29          <constructor-arg type="boolean" >
     2.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Wed Jun 13 11:22:02 2012 +0300
     2.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Wed Jun 13 17:57:27 2012 +0300
     2.3 @@ -102,8 +102,17 @@
     2.4  
     2.5  		DataHive hive = new DataHive(); 
     2.6  
     2.7 -		String encoding = "UTF-8";
     2.8 -		String q = URLDecoder.decode(request.getParameter("SPARQLQuery"), encoding);
     2.9 +		String query = request.getParameter("SPARQLQuery");
    2.10 +		String q = (query == null) ? null : URLDecoder.decode(request.getParameter("SPARQLQuery"), "UTF-8");
    2.11 +		
    2.12 +		if (query != null) {
    2.13 +			String q1 = new String(q.getBytes(), "ISO-8859-1");
    2.14 +			String q2 = new String(q.getBytes(), "ISO-8859-7");
    2.15 +			String q3 = new String(q.getBytes(), "ISO-8859-1");
    2.16 +			String q4 = new String(q.getBytes(), "UTF-8");
    2.17 +			
    2.18 +			System.out.println("la");
    2.19 +		}
    2.20  		
    2.21  		hive.setSPARQLQuery(q);
    2.22  
    2.23 @@ -420,7 +429,7 @@
    2.24  		out.println("<html>");
    2.25  		out.println("<head>");
    2.26  		out.println("<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />");
    2.27 -		out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />");
    2.28 +		out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />");		
    2.29  		out.println("<link href=\"http://code.google.com/apis/maps/documentation/javascript/examples/default.css\" rel=\"stylesheet\" type=\"text/css\" />");
    2.30  		out.println("<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" /> ");
    2.31  		out.println("<script type=\"text/javascript\" src=\"http://maps.googleapis.com/maps/api/js?sensor=false\"></script>");
    2.32 @@ -479,7 +488,16 @@
    2.33  		out.println("      <TD height=\"2\" background=\"images/top_bg_blue.gif\"></TD>");
    2.34  		out.println("	</TR>");
    2.35  		out.println("</TABLE>");
    2.36 -		out.println("<form method=\"get\">");
    2.37 +		out.println("<form " +
    2.38 +				"enctype=\"UTF-8\" " +
    2.39 +				"accept-charset=\"UTF-8\" "+
    2.40 +				//"accept-charset=\"UTF-8\" " +
    2.41 +				//"enctype=\"application/x-www-form-urlencoded;charset=UTF-8\" " +
    2.42 +				//"enctype=\"text/plain\" " +
    2.43 +				
    2.44 +				//"method=\"get\"" +
    2.45 +				"method=\"post\"" +
    2.46 +				">");
    2.47  
    2.48  		out.println("<table border=\"0\" width=\"100%\"><tr> ");
    2.49  		out.println("<td width=\"90\" valign=\"top\" bgcolor=\"#dfe8f0\"> ");