Strabon

changeset 519:81346ef0ee23

decode the DESCRIBE query and input RDF data
author Babis Nikolaou <charnik@di.uoa.gr>
date Sat Jul 28 03:40:49 2012 +0300 (2012-07-28)
parents a915117ecad3
children 55c2dcbfb273
files endpoint/WebContent/describe.jsp endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/DescribeBean.java endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StoreBean.java
line diff
     1.1 --- a/endpoint/WebContent/describe.jsp	Sat Jul 28 00:06:32 2012 +0300
     1.2 +++ b/endpoint/WebContent/describe.jsp	Sat Jul 28 03:40:49 2012 +0300
     1.3 @@ -58,7 +58,6 @@
     1.4  </center><br/></td>
     1.5  </tr>
     1.6  
     1.7 -
     1.8  <% if (request.getAttribute("error") != null) {%>
     1.9  	<!-- Error Message -->
    1.10  	<TR>
     2.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/DescribeBean.java	Sat Jul 28 00:06:32 2012 +0300
     2.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/DescribeBean.java	Sat Jul 28 03:40:49 2012 +0300
     2.3 @@ -100,7 +100,7 @@
     2.4  		// get the dispatcher for forwarding the rendering of the response
     2.5  		RequestDispatcher dispatcher = request.getRequestDispatcher("describe.jsp");
     2.6  		
     2.7 -		String query = request.getParameter("query");
     2.8 +		String query = URLDecoder.decode(request.getParameter("query"), "UTF-8");
     2.9  		String format = request.getParameter("format");
    2.10  		
    2.11  		if (format == null || query == null) {
    2.12 @@ -142,7 +142,7 @@
    2.13          RDFFormat format = Common.getRDFFormatFromAcceptHeader(request.getHeader("accept"));
    2.14          
    2.15          // get the query
    2.16 -		String query = request.getParameter("query");
    2.17 +		String query = URLDecoder.decode(request.getParameter("query"), "UTF-8");
    2.18      	
    2.19      	// check for required parameters
    2.20      	if (format == null || query == null) {
     3.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StoreBean.java	Sat Jul 28 00:06:32 2012 +0300
     3.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StoreBean.java	Sat Jul 28 03:40:49 2012 +0300
     3.3 @@ -4,7 +4,9 @@
     3.4  package eu.earthobservatory.org.StrabonEndpoint;
     3.5  
     3.6  import java.io.IOException;
     3.7 +import java.io.UnsupportedEncodingException;
     3.8  import java.net.MalformedURLException;
     3.9 +import java.net.URLDecoder;
    3.10  
    3.11  import javax.servlet.RequestDispatcher;
    3.12  import javax.servlet.ServletConfig;
    3.13 @@ -65,12 +67,12 @@
    3.14  		doPost(request, response);
    3.15  	}
    3.16  	
    3.17 -	private String getData(HttpServletRequest request) {
    3.18 +	private String getData(HttpServletRequest request) throws UnsupportedEncodingException {
    3.19  		// check whether we read from INPUT or URL
    3.20  		boolean input = (request.getParameter(Common.SUBMIT_URL) != null) ? false:true;
    3.21  		
    3.22  		// return "data" value accordingly
    3.23 -		return input ? request.getParameter(Common.PARAM_DATA):request.getParameter(Common.PARAM_DATA_URL);
    3.24 +		return input ? URLDecoder.decode(request.getParameter(Common.PARAM_DATA), "UTF-8"):request.getParameter(Common.PARAM_DATA_URL);
    3.25  	}
    3.26  	
    3.27  	@Override