01: package phoneList.presentation;
02:
03: import phoneList.spec.*;
04:
05: // Standard imports
06: import java.util.Vector;
07: import java.io.IOException;
08:
09: // Enhydra SuperServlet imports
10: import com.lutris.appserver.server.httpPresentation.HttpPresentation;
11: import com.lutris.appserver.server.httpPresentation.HttpPresentationComms;
12: import com.lutris.appserver.server.httpPresentation.HttpPresentationException;
13: import org.w3c.dom.html.HTMLAnchorElement;
14: import org.w3c.dom.Node;
15:
16: public class ModifyServerPresentation implements HttpPresentation {
17:
18: private static ModifyServerHTML ms;
19:
20: public void run(HttpPresentationComms comms)
21: throws HttpPresentationException, IOException {
22:
23: try {
24: modifyServer(comms);
25: } catch (Exception e) {
26: e.printStackTrace();
27: }
28: }
29:
30: public static void modifyServer(HttpPresentationComms comms)
31: throws Exception {
32: ms = (ModifyServerHTML) comms.xmlcFactory
33: .create(ModifyServerHTML.class);
34: try {
35: PhoneList phoneList = PhoneListFactory
36: .getPhoneList("phoneList.business.PhoneListImpl");
37:
38: String server = phoneList.getServer();
39: String port = phoneList.getPort();
40:
41: ms.getElementPort().setValue(port);
42: ms.getElementServer().setValue(server);
43:
44: /*
45: * Catch Null pointer exception ( we canot make a instances of classes from business layer when we run phoneBookClient_pres )
46: * We need to allow phoneBookClient_pres to be functional ,return default HTML page
47: */
48: } catch (NullPointerException ex) {
49: }
50: comms.response.writeDOM(ms);
51: }
52:
53: }
|