Project

General

Profile

metacat / lib / style / skins / knb / index.jsp @ 3015

1
<%@ page    language="java" %>
2
<%
3
/**
4
 *  '$RCSfile$'
5
 *    Copyright: 2000 Regents of the University of California and the
6
 *               National Center for Ecological Analysis and Synthesis
7
 *  For Details: http://www.nceas.ucsb.edu/
8
 *
9
 *   '$Author: sgarg $'
10
 *     '$Date: 2004-07-21 17:58:56 -0700 (Wed, 21 Jul 2004) $'
11
 * '$Revision: 2220 $'
12
 *
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 */
27

    
28
/**
29
 *  Does a redirect to knb homepage at @knb-site-url@
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
      }
66
%>
67
<%=reply%>
68