Revision 332
Added by bojilova over 24 years ago
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
100 | 100 |
try { |
101 | 101 |
super.init( config ); |
102 | 102 |
this.config = config; |
103 |
this.context = config.getServletContext(); |
|
103 |
this.context = config.getServletContext();
|
|
104 | 104 |
System.out.println("MetaCatServlet Initialize"); |
105 | 105 |
|
106 | 106 |
util = new MetaCatUtil(); |
... | ... | |
226 | 226 |
} else if (action.equals("Logout")) { |
227 | 227 |
HttpSession sess = request.getSession(false); |
228 | 228 |
if (sess != null) { sess.invalidate(); } |
229 |
response.sendRedirect("/xmltodb/login.html"); |
|
229 |
response.sendRedirect("/xmltodb/lib/login.html");
|
|
230 | 230 |
// aware of session expiration on every request |
231 | 231 |
} else { |
232 |
HttpSession sess = request.getSession(false);
|
|
233 |
// if (sess == null) {
|
|
232 |
HttpSession sess = request.getSession(true);
|
|
233 |
if (sess.isNew()) {
|
|
234 | 234 |
// session expired or has not been stored b/w user requests |
235 |
// or anonymous user access with query privs only by default; |
|
236 | 235 |
// redirect to default page for query only access |
237 |
// response.sendRedirect("/xmltodb/index.html");
|
|
238 |
// }
|
|
236 |
response.sendRedirect("/xmltodb/lib/sexpire.html");
|
|
237 |
} |
|
239 | 238 |
} |
240 | 239 |
// End of Jivka added |
241 | 240 |
|
... | ... | |
283 | 282 |
String un = ((String[])params.get("username"))[0]; |
284 | 283 |
String pw = ((String[])params.get("password"))[0]; |
285 | 284 |
String action = ((String[])params.get("action"))[0]; |
286 |
|
|
285 |
|
|
287 | 286 |
try { |
288 | 287 |
sess = new MetaCatSession(request, un, pw); |
289 | 288 |
} catch (Exception e) { |
290 | 289 |
out.println(e.getMessage()); |
291 | 290 |
} |
292 | 291 |
|
292 |
if ( un.equals("anonymous") ) { |
|
293 |
try { |
|
294 |
if (action.equals("Login Client")) { |
|
295 |
out.println("<?xml version=\"1.0\"?>"); |
|
296 |
out.println("<success>"); |
|
297 |
out.println("User Authentication successful."); |
|
298 |
out.println("</success>"); |
|
299 |
return; |
|
300 |
} else { |
|
301 |
response.sendRedirect( |
|
302 |
response.encodeRedirectUrl("/xmltodb/lib/index.html")); |
|
303 |
} |
|
304 |
} catch ( java.io.IOException ioe) { |
|
305 |
sess.disconnect(); |
|
306 |
out.println("<?xml version=\"1.0\"?>"); |
|
307 |
out.println("<error>"); |
|
308 |
out.println("MetaCatServlet.handleLoginAction() - " + |
|
309 |
"Error on redirect of HttpServletResponse: " + |
|
310 |
ioe.getMessage()); |
|
311 |
out.println("</error>"); |
|
312 |
return; |
|
313 |
} |
|
314 |
} |
|
315 |
|
|
293 | 316 |
try { |
294 | 317 |
if (sess.userAuth(un, pw)) { |
295 | 318 |
try { |
... | ... | |
300 | 323 |
out.println("</success>"); |
301 | 324 |
} else { |
302 | 325 |
response.sendRedirect( |
303 |
response.encodeRedirectUrl("/xmltodb/index.html"));
|
|
326 |
response.encodeRedirectUrl("/xmltodb/lib/metacat.html"));
|
|
304 | 327 |
} |
305 | 328 |
} catch ( java.io.IOException ioe) { |
306 | 329 |
sess.disconnect(); |
... | ... | |
784 | 807 |
|
785 | 808 |
/** |
786 | 809 |
* '$Log$ |
810 |
* 'Revision 1.60 2000/08/09 00:39:47 jones |
|
811 |
* '-Reorganized xmltodb module to support new install process for the new |
|
812 |
* 'linux server (dev.nceas.ucsb.edu). Added "build.sh" shell script that |
|
813 |
* 'calls ant withthe proper umask set for installation. Use: |
|
814 |
* ' |
|
815 |
* ' ./build.sh install |
|
816 |
* ' |
|
817 |
* 'to post a new copy of the servlet and its supporting files to the install |
|
818 |
* 'directory defined in build.xml. |
|
819 |
* ' |
|
820 |
* '-Updated the servlet to use a new servlet prefix that we'll use with the |
|
821 |
* 'Tomcat servlet engine. |
|
822 |
* ' |
|
823 |
* '-Update bin dir shell scripts to reflect new locations of relevant jar files. |
|
824 |
* ' |
|
787 | 825 |
* 'Revision 1.59 2000/08/08 00:31:20 bojilova |
788 | 826 |
* 'rearrange html pages for login and metacat access |
789 | 827 |
* ' |
Also available in: Unified diff
added "anonymous" user connection