Project

General

Profile

« Previous | Next » 

Revision 2911

Added by harris almost 19 years ago

adding changes that pmark made, and some small changes that I made.

View differences:

metacat_spatialresolver.jsp
30 30

  
31 31

  
32 32
<%
33
    System.out.println("********************************************************");
34
    System.out.println("********************************************************");
35
    System.out.println("**************** metacat_spatialresolver.jsp*****************\n");
36
    
33
	System.out.println("********************************************************");
34
	System.out.println("********************************************************");
35
	System.out.println("**************** metacat_spatialresolver.jsp*****************\n");
37 36

  
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");
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 44
					   
45
					   
46 45
	// 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;
46
	// parse the response for the url to the metacat document and then redirect there. The query 
47
	// should look like
48
	// 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
58 49

  
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);
50
	if (_request.toLowerCase().equals("aoimetacatquery")) {
51
		// bounded box
52
		System.out.println("forwarding AoiMetacatQuery");
53
		String _url = "http://nebulous.msi.ucsb.edu:9999/knp/metacat?action=spatial_query&"+ request.getQueryString();
54

  
55
		System.out.println("redirecting to: " + _url);
56
		response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
57
		response.setHeader("Location",_url);
58
	} else {
59
		// feature info
60
		if ( request.getQueryString().indexOf("metacat_testdata") > -1 ) {
61

  
62
			URL url = new URL("http://nebulous.msi.ucsb.edu:8080/geoserver/wms?"+request.getQueryString());
63
			URLConnection c = url.openConnection();
64
			BufferedReader in = new BufferedReader(
65
			new InputStreamReader(
66
			c.getInputStream()));
67
			String inputLine;
68

  
69
			while ((inputLine = in.readLine()) != null) {
70
				if ( inputLine.startsWith("url") ) {
71

  
72
					StringTokenizer _st = new StringTokenizer(inputLine, " ");
73
					_st.nextToken(); // url string
74
					_st.nextToken(); // equals sign
75
					String _redirectTo = _st.nextToken();
76
					System.out.println("redirecting to: " + _redirectTo); 
77
					response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
78
					String newLocn = _redirectTo;
79
					response.setHeader("Location",newLocn);
80
				}
71 81
			}
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
  
82
			in.close();
83

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

  
88
			System.out.println("redirecting to: " + _url);
89
			response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
90
			response.setHeader("Location",_url);
91
		}
92
	}
93

  
83 94
%>
84 95

  
85 96
<html>

Also available in: Unified diff