1
|
<!--
|
2
|
* '$RCSfile$'
|
3
|
* '$Author: harris $'
|
4
|
* '$Date: 2005-11-09 11:20:29 -0800 (Wed, 09 Nov 2005) $'
|
5
|
* '$Revision: 2726 $'
|
6
|
*
|
7
|
*
|
8
|
* This program is free software; you can redistribute it and/or modify
|
9
|
* it under the terms of the GNU General Public License as published by
|
10
|
* the Free Software Foundation; either version 2 of the License, or
|
11
|
* (at your option) any later version.
|
12
|
*
|
13
|
* This program is distributed in the hope that it will be useful,
|
14
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
* GNU General Public License for more details.
|
17
|
*
|
18
|
* You should have received a copy of the GNU General Public License
|
19
|
* along with this program; if not, write to the Free Software
|
20
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21
|
-->
|
22
|
|
23
|
<%@ page import="org.apache.tools.mail.MailMessage" %>
|
24
|
<%@ page import="java.io.PrintStream" %>
|
25
|
<%@ page import="java.io.BufferedReader" %>
|
26
|
<%@ page import="java.util.StringTokenizer" %>
|
27
|
<%@ page import="java.io.InputStreamReader" %>
|
28
|
<%@ page import="java.net.URLConnection" %>
|
29
|
<%@ page import="java.net.URL" %>
|
30
|
|
31
|
|
32
|
<%
|
33
|
System.out.println("********************************************************");
|
34
|
System.out.println("********************************************************");
|
35
|
System.out.println("**************** metacat_spatialresolver.jsp*****************\n");
|
36
|
|
37
|
|
38
|
String _request = request.getParameter("REQUEST");
|
39
|
_request = (_request!=null)? _request.trim() : "";
|
40
|
|
41
|
System.out.println("request param: >>" + _request);
|
42
|
System.out.println("uri: >>" + request.getRequestURI());
|
43
|
System.out.println("request string: >>" + request.getQueryString()+" \n");
|
44
|
|
45
|
|
46
|
// connect to the metacat spatial option, request the info using the wms getFeatureId call
|
47
|
// parse the response for the url to the metacat document and then redirect there. The query
|
48
|
// should look like
|
49
|
// VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=-143.09099999999998,19.856,-96.79899999999999,43.002&WIDTH=600&HEIGHT=300&LAYERS=topp:RIVERS&FORMAT=text/html&FEATURE_COUNT=1&QUERY_LAYERS=topp:RIVERS&X=328&Y=218
|
50
|
|
51
|
if ( request.getQueryString().indexOf("metacat_testdata") > -1 ) {
|
52
|
URL url = new URL("http://nebulous.msi.ucsb.edu:8080/geoserver/wms?"+request.getQueryString());
|
53
|
URLConnection c = url.openConnection();
|
54
|
BufferedReader in = new BufferedReader(
|
55
|
new InputStreamReader(
|
56
|
c.getInputStream()));
|
57
|
String inputLine;
|
58
|
|
59
|
while ((inputLine = in.readLine()) != null)
|
60
|
|
61
|
if ( inputLine.startsWith("url") ) {
|
62
|
|
63
|
StringTokenizer _st = new StringTokenizer(inputLine, " ");
|
64
|
_st.nextToken(); // url string
|
65
|
_st.nextToken(); // equals sign
|
66
|
String _redirectTo = _st.nextToken();
|
67
|
System.out.println("redirecting to: " + _redirectTo);
|
68
|
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
|
69
|
String newLocn = _redirectTo;
|
70
|
response.setHeader("Location",newLocn);
|
71
|
}
|
72
|
in.close();
|
73
|
} else {
|
74
|
System.out.println(" -- not a metacat query");
|
75
|
String _url = "/geoserver/wms?"+ request.getQueryString();
|
76
|
|
77
|
System.out.println("redirecting to: " + _url);
|
78
|
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
|
79
|
response.setHeader("Location",_url);
|
80
|
|
81
|
}
|
82
|
|
83
|
%>
|
84
|
|
85
|
<html>
|
86
|
<head>
|
87
|
<title>Metacat Spatial Resolver</title>
|
88
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
89
|
<link href="styles.css" rel="stylesheet" type="text/css">
|
90
|
</head>
|
91
|
|
92
|
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/blue_pixel_bg.jpg">
|
93
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
94
|
<!--DWLayoutTable-->
|
95
|
<tr>
|
96
|
<td width="700" height="20" background="images/blue_pixel_bg.jpg"></td>
|
97
|
|
98
|
</tr>
|
99
|
|
100
|
|
101
|
|
102
|
|
103
|
<tr>
|
104
|
<td bgcolor="#6699CC"> <table width="700" border="0" cellspacing="0" cellpadding="0">
|
105
|
<tr>
|
106
|
<td> </td>
|
107
|
<td><td> </td>
|
108
|
</tr>
|
109
|
</table>
|
110
|
</tr>
|
111
|
</table>
|
112
|
</body>
|
113
|
</html>
|
114
|
|