1 7 8 package org.enhydra.jivan.test.presentation; 9 10 import com.lutris.appserver.server.httpPresentation.HttpPresentation; 12 import com.lutris.appserver.server.httpPresentation.HttpPresentationComms; 13 import com.lutris.appserver.server.httpPresentation.HttpPresentationException; 14 import java.util.*; 15 import org.enhydra.util.jivan.JivanSimpleXMLObjectImpl; 16 17 import org.jivan.html.document.*; 18 import org.jivan.html.util.DOMUtil; 19 import org.jivan.apache.xerces.xni.parser.XMLInputSource; 20 import org.w3c.dom.html.HTMLAnchorElement; 21 import java.net.URL ; 22 import com.lutris.logging.Logger; 23 import org.enhydra.jivan.test.JivanExample; 24 25 import java.io.File ; 26 27 import org.enhydra.jivan.test.spec.*; 29 30 import java.io.IOException ; 32 33 public class WelcomePresentation implements HttpPresentation { 34 35 36 public void run(HttpPresentationComms comms) 37 throws HttpPresentationException { 38 39 String protocol = ""; 40 try { 41 protocol = JivanExample.rootPath + File.separator + comms.application.getConfig().getString("UserParameter.Jivan.ResourcesPath"); 42 protocol = "file:///" + protocol + "/Welcome.html"; 43 44 47 } 50 catch(Exception ex) { 51 ex.printStackTrace(); 52 } 53 54 comms.jivanFactory.getLogger().write(Logger.INFO, "Loaded resources is: " + protocol); DocumentManager man = comms.jivanFactory.docManFor(protocol); 56 57 String datetime; 58 try { 59 Dater dater = DaterFactory.createDater("org.enhydra.jivan.test.business.DaterImpl"); 60 datetime = dater.getDate(); 61 } 62 catch (Exception ex){ 63 System.out.println("Exception: "+ex); 64 datetime="Could not get business object!!!"; 65 } 66 67 DOMUtil.setTextChild(man.lookup("time"), datetime); 68 HTMLAnchorElement link = (HTMLAnchorElement) man.lookup("link"); 69 link.setHref("RedirectPresentation.po"); 70 71 JivanSimpleXMLObjectImpl xmlObject = new JivanSimpleXMLObjectImpl(); 72 xmlObject.setDocument(man, "UTF-8"); 73 comms.response.writeDOM(xmlObject); 74 } 75 76 } 77 | Popular Tags |