1 4 5 9 10 package org.openlaszlo.test.xmlrpc; 11 12 import java.io.*; 14 import java.net.*; 15 import java.util.*; 16 import javax.servlet.*; 17 import javax.servlet.http.*; 18 import org.apache.log4j.*; 19 20 public class SignMeUp 21 { 22 private static Logger mLogger = Logger.getLogger(SignMeUp.class); 23 24 private String mAlias = "SignMeUp"; 25 26 public String [] getUniqueUsername(String username, String first, String last, 27 HttpServletRequest req, HttpServletResponse res) { 28 mLogger.debug("getUniqueUsername"); 29 String [] names = { "one", "two", "three", "four", "five", "six" }; 30 return names; 31 } 32 33 public int register(String username, String password, String name, 34 String occupation, String email, 35 HttpServletRequest req, HttpServletResponse res) { 36 mLogger.debug("register"); 37 req.getSession().setAttribute("sessioned", "true"); 38 return 1; 39 } 40 41 public boolean isEmailRegistered(String email, HttpServletRequest req, 42 HttpServletResponse res) { 43 mLogger.debug("isEmailRegistered"); 44 return ("one@foo.com".equals(email)); 45 } 46 47 public boolean isSessioned(HttpServletRequest req, HttpServletResponse res) { 48 return "true".equals(req.getSession().getAttribute("sessioned")); 49 } 50 51 52 public boolean logout(HttpServletRequest req, HttpServletResponse res) 53 throws IllegalStateException { 54 req.getSession().invalidate(); 55 return true; 56 } 57 58 public boolean login(String username, String password, 59 HttpServletRequest req, HttpServletResponse res) { 60 mLogger.debug("login"); 61 boolean ok = ("fluffy".equals(username) && "pass1".equals(password)); 62 if (ok) { 63 req.getSession().setAttribute("sessioned", "true"); 64 } 65 return ok; 66 } 67 68 public boolean getUsernamePassword(String email, HttpServletRequest req, 69 HttpServletResponse res) { 70 mLogger.debug("getUsernamePassword"); 71 return false; 72 } 73 74 public void initialize(Properties prop) 75 { 76 mLogger.debug("initialize"); 77 } 78 } 79 | Popular Tags |