1 5 6 7 package phoneList.presentation; 8 9 import com.lutris.appserver.server.httpPresentation.*; 10 import phoneList.spec.*; 11 12 13 15 public class DoServerPresentation 16 implements HttpPresentation { 17 18 public void run (HttpPresentationComms comms) throws Exception { 19 String server = null; 20 try { 21 server = comms.request.getParameter("server"); 22 } catch (Exception e) {} 23 String port = null; 24 try { 25 port = comms.request.getParameter("port"); 26 } catch (Exception e) {} 27 String okTarget = comms.request.getAppFileURIPath("ListPresentation.po"); 28 String errTarget = comms.request.getAppFileURIPath("ErrorPresentation.po"); 29 ClientPageRedirectException err = new ClientPageRedirectException(errTarget); 30 ClientPageRedirectException ok = new ClientPageRedirectException(okTarget); 31 if ((server == null) || (server.length() == 0)) { 32 err.addArgument("err", "Error: no server name specified."); 33 throw err; 34 } 35 if ((port == null) || (port.length() == 0)) { 36 err.addArgument("err", "Error: no port value specified."); 37 throw err; 38 } 39 PhoneList phoneList = PhoneListFactory.getPhoneList("phoneList.business.PhoneListImpl"); 40 try{ 41 phoneList.setServerUrl(server, port); 42 } catch(NullPointerException ex) {} 43 44 throw ok; 45 } 46 } 47 48 49 50 | Popular Tags |