home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / JAVA Utilities / JProxy 1.1.0 / PROXY.EAR / proxyservlet.war / test.jsp < prev   
Encoding:
Text File  |  2003-04-29  |  1.2 KB  |  49 lines

  1. <%@ page
  2.     language="java"
  3.     import="
  4.         java.util.*,
  5.         javax.naming.*,
  6.         com.jproxy.proxy.*,
  7.         com.jproxy.samples.ejb.test.*,
  8.         com.jproxy.samples.interfaces.*
  9.     "
  10. %>
  11.  
  12. <%
  13.     Properties env = new Properties();
  14.     env.put(Context.INITIAL_CONTEXT_FACTORY, "com.jproxy.proxy.NamingContextFactory");
  15.     env.put(Context.PROVIDER_URL, "localhost:"+request.getServerPort());
  16.     Context context = new InitialContext(env);
  17.     ISessionHome sessionHome = (ISessionHome)context.lookup("TestSessionBean");
  18.     ISession ses = sessionHome.create();
  19.     long t = ses.getServerTime();
  20.  
  21. /*
  22.     SessionClient client = new SessionClient();
  23.     client.isStandalone = true;
  24.     String hostUrl = "localhost:"+request.getServerPort();
  25.     client.hostUrl = hostUrl;
  26.     client.init();
  27.     long t = client.session.getServerTime();
  28.     client.destroy();
  29. */
  30. //    long t = System.currentTimeMillis();
  31.     String time = "Time: "+(new Date(t));
  32. %>
  33. <html>
  34. <head>
  35. <title>HTTP-Tunnel ORB Proxy Solution</title>
  36. <link rel="stylesheet" href="main.css" type="text/css">
  37. </head>
  38. <body>
  39. <table border=0 width="100%">
  40.   <tr>
  41.     <td width="100%" valign="top">
  42.       <div align="center">TEST RESULT</div>
  43.       <p><%=time%></p>
  44.     </td>
  45.   </tr>
  46. </table>
  47. </body>
  48. </html>
  49.