01: /*
02: *
03: * Enhydra Java Application Server Project
04: *
05: * The contents of this file are subject to the Enhydra Public License
06: * Version 1.1 (the "License"); you may not use this file except in
07: * compliance with the License. You may obtain a copy of the License on
08: * the Enhydra web site ( http://www.enhydra.org/ ).
09: *
10: * Software distributed under the License is distributed on an "AS IS"
11: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12: * the License for the specific terms governing rights and limitations
13: * under the License.
14: *
15: * The Initial Developer of the Enhydra Application Server is Lutris
16: * Technologies, Inc. The Enhydra Application Server and portions created
17: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
18: * All Rights Reserved.
19: *
20: * Contributor(s):
21: *
22: * $Id: ShowName.java,v 1.1 2006-09-11 12:32:47 sinisa Exp $
23: */
24:
25: package enhydraFlash.presentation;
26:
27: //import com.lutris.xml.xmlc.*;
28: import com.lutris.appserver.server.httpPresentation.*;
29:
30: import java.util.Date;
31: import java.text.DateFormat;
32:
33: import enhydraFlash.presentation.xml.*;
34:
35: public class ShowName implements HttpPresentation {
36:
37: public void run(HttpPresentationComms comms)
38: throws HttpPresentationException {
39: try {
40: if (comms.request.getParameter("flash") != null) {
41: handleFlash(comms);
42: } else {
43:
44: ShowNamePageHTML page = (ShowNamePageHTML) comms.xmlcFactory
45: .create(ShowNamePageHTML.class);
46: comms.response.writeDOM(page);
47: }
48: } catch (Exception e) {
49: System.out.println("EXCEPTION in ShowPage" + e);
50: }
51: }
52:
53: public void handleFlash(HttpPresentationComms comms) {
54:
55: try {
56: String name = comms.session.getSessionData().getString(
57: "NAME");
58: if (name == null)
59: name = DateFormat.getTimeInstance(DateFormat.SHORT)
60: .format(new Date());
61:
62: ShowNameXML page = (ShowNameXML) comms.xmlcFactory
63: .create(ShowNameXML.class);
64: page.setTextName(name);
65: comms.response.setEncoding("ISO8859-1");
66: comms.response.writeDOM(page);
67: } catch (Exception e) {
68: System.out.println("EXCEPTION in ShowPage" + e);
69: }
70: }
71:
72: }
|