KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > enhydraFlash > presentation > ShowName


1 /*
2  *
3  * Enhydra Java Application Server Project
4  *
5  * The contents of this file are subject to the Enhydra Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License on
8  * the Enhydra web site ( http://www.enhydra.org/ ).
9  *
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.2 2004/08/16 10:57:12 slobodan 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 JavaDoc;
31 import java.text.DateFormat JavaDoc;
32
33 import enhydraFlash.presentation.xml.*;
34
35 public class ShowName implements HttpPresentation {
36
37     
38     public void run(HttpPresentationComms comms)
39         throws HttpPresentationException {
40     try {
41         if(comms.request.getParameter("flash") != null) {
42         handleFlash(comms);
43         }
44         else {
45             
46         ShowNamePageHTML page = (ShowNamePageHTML)comms.xmlcFactory.create(ShowNamePageHTML.class);
47         comms.response.writeDOM(page);
48         }
49     } catch (Exception JavaDoc e) {
50         System.out.println("EXCEPTION in ShowPage" + e);
51     }
52     }
53     
54     
55     public void handleFlash(HttpPresentationComms comms) {
56
57     try {
58         String JavaDoc name = comms.session.getSessionData().getString("NAME");
59         if(name == null)
60         name = DateFormat.getTimeInstance(DateFormat.SHORT).format(new Date JavaDoc());
61
62         ShowNameXML page = (ShowNameXML)comms.xmlcFactory.create(ShowNameXML.class);
63         page.setTextName(name);
64         comms.response.setEncoding("ISO8859-1");
65         comms.response.writeDOM(page);
66     } catch (Exception JavaDoc e) {
67         System.out.println("EXCEPTION in ShowPage" + e);
68     }
69     }
70     
71 }
72
Popular Tags