import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import WebFlow.*; import WebFlow.event.*; import WebFlow.Charon.*; import org.omg.CORBA.*; import WebFlow.QS.*; import WebFlow.hashtable.*; import java.lang.reflect.*; import WebFlow.PSEscript; import java.util.*; public class toCharon extends HttpServlet { private ORB orb; private WebFlowContext ws = null; PrintWriter out; private String ior; private WebFlowContext wfs; protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { doPost(req, res); } protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { System.out.println("start servlet"); out = res.getWriter(); res.setContentType("text/html"); out.println(""); out.println("Control Applet toCharon"); out.println(""); out.println(""); out.println("
"); out.println("

toCharon!

"); out.println("
"); out.println("

"); error("start servlet
"); orb = WebFlow.Server.orb; /* String[] args = new String[1]; args[0]="whatever"; Properties props = System.getProperties(); props.put("org.omg.CORBA.ORBClass", "com.ooc.CORBA.ORB"); props.put("org.omg.CORBA.ORBSingletonClass","com.ooc.CORBA.ORBSingleton"); System.setProperties(props); orb = ORB.init(args, props); */ if(orb==null) {error("orb is null
"); return;} String IORfile="/npac/home/webflow/WEBFLOW/JIGSAW/Jigsaw/WWW/IOR/charon.txt"; File iorF= new File(IORfile); if(!iorF.exists()) {error("file "+IORfile+" does not exists
");return;} try { FileReader fr = new FileReader(iorF); BufferedReader in = new BufferedReader(fr); ior = in.readLine(); in.close(); } catch (Exception e) {error("cannot read IORFile
"+e);return;}; wfs = WebFlowContextHelper.narrow(orb.string_to_object(ior)); if(wfs==null) {error("connot contnect to WebFlow server");} org.omg.CORBA.Object ch=wfs.getKeyedChild(wfs.getObjectID()+"/Charon"); if(ch==null) {error("cannot find Charon");return;} CharonServer charon=CharonServerHelper.narrow(ch); out.println(charon.SayHello()); out.println(""); out.println(""); System.out.println("about to flush"); out.flush(); out.close(); } void error(String msg) { out.println(msg); } void status(String msg) { //out.println(msg); } public String getServletInfo() { return "By T. Haupt"; } }