Project

General

Profile

« Previous | Next » 

Revision 2220

Added by sgarg about 20 years ago

Changed index.jsp to fix bug 1232 so that it works on knb.ecoinformatics.org.

View differences:

lib/style/skins/knb/index.jsp
1 1
<%@ page    language="java" %>
2
<% 
2
<%
3 3
/**
4 4
 *  '$RCSfile$'
5 5
 *    Copyright: 2000 Regents of the University of California and the
......
9 9
 *   '$Author$'
10 10
 *     '$Date$'
11 11
 * '$Revision$'
12
 * 
12
 *
13 13
 * This program is free software; you can redistribute it and/or modify
14 14
 * it under the terms of the GNU General Public License as published by
15 15
 * the Free Software Foundation; either version 2 of the License, or
......
28 28
/**
29 29
 *  Does a redirect to knb homepage at @knb-site-url@
30 30
 */
31

  
32
       java.util.Properties params = new java.util.Properties();
33
       java.util.Enumeration paramlist = request.getParameterNames();
34

  
35
       String userName = null;
36
       String organization = null;
37
       String password = null;
38

  
39
       while (paramlist.hasMoreElements()) {
40
          String name = (String) paramlist.nextElement();
41
          String[] value = request.getParameterValues(name);
42
            params.put(name, value[0]);
43
       }
44

  
45
       String reply = null;
46
       try{
47

  
48
         java.net.URL url = new java.net.URL("http://knb.ecoinformatics.org/index.jsp");
49
         edu.ucsb.nceas.utilities.HttpMessage msg =
50
                            new edu.ucsb.nceas.utilities.HttpMessage(url);
51
         java.io.InputStream returnStrea = msg.sendPostData(params);
52
         java.io.InputStreamReader returnStream =
53
                            new java.io.InputStreamReader(returnStrea);
54
         java.io.StringWriter sw = new java.io.StringWriter();
55
         int len;
56
         char[] characters = new char[512];
57
         while ((len = returnStream.read(characters, 0, 512)) != -1) {
58
                sw.write(characters, 0, len);
59
         }
60
         returnStream.close();
61
         reply = sw.toString();
62
         sw.close();
63
      } catch(Exception e){
64
         response.sendRedirect("http://knb.ecoinformatics.org/");
65
      }
31 66
%>
32
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
33
<html>
34
<head>
35
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
36
<script language="JavaScript">
37
function doRedirectWithParams() {
38
  var fullURL = unescape(document.location);
39
  var start = fullURL.indexOf("?");
40
  var params = "";
41
  if (start > 0) params = fullURL.substring(start,fullURL.length);
42
  document.location.href="@knb-site-url@" + params;
43
}
44
</script>
45
</head>
46
<body><script language="JavaScript">doRedirectWithParams()</script></body>
47
</html>
67
<%=reply%>
68

  

Also available in: Unified diff