Revision 1738
Added by skrish over 21 years ago
src/edu/ucsb/nceas/metacat/harvesterClient/LoginServlet.java | ||
---|---|---|
1 |
import java.io.PrintWriter; |
|
2 |
|
|
3 |
|
|
4 |
import javax.servlet.ServletConfig; |
|
5 |
import javax.servlet.ServletContext; |
|
6 |
import javax.servlet.ServletException; |
|
7 |
import javax.servlet.ServletInputStream; |
|
8 |
import javax.servlet.http.HttpServlet; |
|
9 |
import javax.servlet.http.HttpServletRequest; |
|
10 |
import javax.servlet.http.HttpServletResponse; |
|
11 |
import javax.servlet.http.HttpSession; |
|
12 |
import javax.servlet.http.HttpUtils; |
|
13 |
import javax.servlet.ServletOutputStream; |
|
14 |
|
|
15 |
public class LoginServlet extends HttpServlet { |
|
16 |
|
|
17 |
|
|
18 |
public void destroy() { |
|
19 |
// Close all connections |
|
20 |
System.out.println("Destroying LoginServlet"); |
|
21 |
} |
|
22 |
|
|
23 |
/** Handle "GET" method requests from HTTP clients */ |
|
24 |
public void doGet (HttpServletRequest request, HttpServletResponse response) |
|
25 |
throws ServletException,java.io.IOException{ |
|
26 |
|
|
27 |
// Process the data and send back the response |
|
28 |
handleGetOrPost(request, response); |
|
29 |
} |
|
30 |
|
|
31 |
|
|
32 |
/** Handle "POST" method requests from HTTP clients */ |
|
33 |
public void doPost( HttpServletRequest request, HttpServletResponse response) |
|
34 |
throws ServletException,java.io.IOException{ |
|
35 |
|
|
36 |
// Process the data and send back the response |
|
37 |
handleGetOrPost(request, response); |
|
38 |
} |
|
39 |
|
|
40 |
private void handleGetOrPost(HttpServletRequest request, |
|
41 |
HttpServletResponse response) |
|
42 |
throws ServletException,java.io.IOException |
|
43 |
{ |
|
44 |
|
|
45 |
String user="skr"; |
|
46 |
String group="skr"; |
|
47 |
String passwd="skr"; |
|
48 |
|
|
49 |
user = request.getParameter("user"); |
|
50 |
group = request.getParameter("group"); |
|
51 |
passwd = request.getParameter("passwd"); |
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
HttpSession sess = request.getSession(true); |
|
56 |
|
|
57 |
/*if (sess.isNew()) {*/ |
|
58 |
sess.putValue("username",user); |
|
59 |
sess.putValue("password",passwd); |
|
60 |
sess.putValue("groupnames", group); |
|
61 |
|
|
62 |
//} |
|
63 |
|
|
64 |
|
|
65 |
// PrintWriter out = response.getWriter(); |
|
66 |
// out.println(sess.getValue("username")); |
|
67 |
response.sendRedirect("../uploademl.html"); |
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
} |
|
72 |
} |
|
0 | 73 |
Also available in: Unified diff
EML interface Login Servlet