Project

General

Profile

« Previous | Next » 

Revision 2920

Added by harris almost 19 years ago

modified the code to return the correct metacat resltset.

View differences:

src/spatial/metacat_spatialresolver.jsp
1
<%
2
/**
1 3
<!--
2 4
  *   '$RCSfile$'
3 5
  *   '$Author$'
......
19 21
  * along with this program; if not, write to the Free Software
20 22
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 23
-->
22

  
24
  */
25
%>
23 26
<%@ page import="org.apache.tools.mail.MailMessage" %>
24 27
<%@ page import="java.io.PrintStream" %>
25 28
<%@ page import="java.io.BufferedReader" %>
26 29
<%@ page import="java.util.StringTokenizer" %>
27 30
<%@ page import="java.io.InputStreamReader" %>
31
<%@ page import="java.io.PrintWriter" %>
28 32
<%@ page import="java.net.URLConnection" %>
29 33
<%@ page import="java.net.URL" %>
30

  
31

  
34
<%@ page import="edu.ucsb.nceas.metacat.spatial.XSLTransform" %>
32 35
<%
33 36
	System.out.println("********************************************************");
34 37
	System.out.println("********************************************************");
......
49 52

  
50 53
	if (_request.toLowerCase().equals("aoimetacatquery")) {
51 54
		// bounded box
52
		System.out.println("forwarding AoiMetacatQuery");
53
		String _url = "http://nebulous.msi.ucsb.edu:9999/knp/metacat?action=spatial_query&"+ request.getQueryString();
55
		System.out.println("handling AoiMetacatQuery");
56
		String urlString = "http://nebulous.msi.ucsb.edu:9999/knp/metacat?action=spatial_query&"+ request.getQueryString();
57
		
58
		System.out.println("redirecting to: " + urlString);
59
		response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
60
		response.setHeader("Location",urlString);
61
		
62
		
63
		/***********
64
		URL url = new URL(urlString);
65
		URLConnection c = url.openConnection();
66
		BufferedReader in = new BufferedReader(
67
				new InputStreamReader(c.getInputStream()));
68
		String inputLine;
69
		//StringBuffer xmlResults = new StringBuffer(4096);
70
		try {
71
		PrintWriter _out = response.getWriter();
72
			while ((inputLine = in.readLine()) != null) {
73
				//	xmlResults.append(inputLine);
74
				//System.out.println(inputLine);
75
				out.println(inputLine);
76
			} 
77
		} catch (Exception e) { e.printStackTrace(); }
54 78

  
55
		System.out.println("redirecting to: " + _url);
79
		***/
80
		
81
		
82
		// transform xml into html
83
		//String xslPath = "/tmp/spatial_results.xsl";
84
		//XSLTransform.transform(xmlResults.toString(), xslPath, response.getWriter(), null);
85

  
86

  
87
		/*
88
		System.out.println("redirecting to: " + urlString);
56 89
		response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
57
		response.setHeader("Location",_url);
90
		response.setHeader("Location",urlString);
91
		*/
58 92
	} else {
59 93
		// feature info
60 94
		if ( request.getQueryString().indexOf("metacat_testdata") > -1 ) {
......
83 117

  
84 118
		} else {
85 119
			System.out.println(" -- not a metacat query");
86
			String _url = "/geoserver/wms?"+ request.getQueryString();
120
			String urlString = "/geoserver/wms?"+ request.getQueryString();
87 121

  
88
			System.out.println("redirecting to: " + _url);
122
			System.out.println("redirecting to: " + urlString);
89 123
			response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
90
			response.setHeader("Location",_url);
124
			response.setHeader("Location",urlString);
91 125
		}
92 126
	}
93 127

  
94
%>
95

  
96
<html>
128
if (false) {
129
%><!--html>
97 130
<head>
98 131
<title>Metacat Spatial Resolver</title>
99 132
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
......
121 154
  </tr>
122 155
</table>
123 156
</body>
124
</html>
125

  
157
</html-->
158
<% } %>

Also available in: Unified diff