  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | JSP - A mailing list about Java Server Pages specification and reference | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Connecting applet with ejb ? | Connecting applet with ejb ? 2004-12-21 - By Partha Ranjan Das
Back Hi, If you need to connect to an EJB from an applet you need to manually create the InitialContext instance usign a code like below: Properties p = new Properties();
p.put(Context.PROVIDER_URL, "<your_url>");
p.put(Context.INITIAL_CONTEXT_FACTORY, "<your _factory_details>");
context = new InitialContext(p);
(See the details of your EJB tier spec for these strings.)
And then use this context to call the lookup() method for getting the ejb home.
But in this way you need to communicate to the EJB using RMI in which case you may have problem with your firewall or similar set-ups. Even the HTTP tunnelling makes certain areas vulnerable to security risks. So I propose you put either a servlet between your applet and ejb or expose the ejb methods through webservices.
Regards,
Partha
-- --Original Message-- -- From: A mailing list for Java(tm) 2 Platform, Enterprise Edition [mailto:J2EE -INTEREST@(protected)]On Behalf Of Dudi Gil Sent: Tuesday, December 21, 2004 10:09 AM To: J2EE-INTEREST@(protected) Subject: Connecting applet with ejb ?
Hellow, Can anyone show me an example of how to connect applet with ejb ? All the JNDI procedure in particular ? If someone can show me an example of how to to it, I'll be very grateful. THankd David =========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) .sun.com and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1255 (See http://ows-1255.ora-code.com)">
<META content="MSHTML 5.00.3700.6699" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT color=#0000ff face=Arial size=2><SPAN class=683285704-21122004>Hi,</SPAN></FONT></DIV> <DIV><FONT color=#0000ff face=Arial size=2><SPAN class=683285704-21122004></SPAN></FONT> </DIV> <DIV><FONT color=#0000ff face=Arial size=2><SPAN class=683285704-21122004>If you need to connect to an EJB from an applet you need to manually create the InitialContext instance usign a code like below:</SPAN></FONT></DIV> <DIV><FONT color=#0000ff><SPAN class=683285704-21122004><FONT face=Arial><FONT color=#000000><FONT size=2> <P>Properties</FONT> <FONT color=#000000>p</FONT> <FONT color=#000000>=</FONT> <FONT color=#000000><SPAN class=683285704-21122004>new </SPAN>Properties();</FONT></FONT></P></FONT> <P><FONT face=Arial><FONT size=2><FONT color=#000000><SPAN class=683285704-21122004>p</SPAN>.put(Context.PROVIDER_URL,</FONT> <FONT color=#000000><SPAN class=683285704-21122004>"<your_url>"</SPAN>);</FONT></FONT></P></FONT> <P><FONT size=2><FONT face=Arial><FONT color=#000000>p.put(Context.INITIAL_CONTEXT_FACTORY,</FONT> <FONT color=#000000><FONT color=#000000><SPAN class=683285704-21122004>"<your _factory_details>"</SPAN></FONT>);</P></FONT></FONT></FONT> <P><FONT size=2><FONT face=Arial><FONT color=#000000>context</FONT> <FONT color=#000000>=</FONT> <FONT color=#000000><SPAN class=683285704-21122004>new</SPAN></FONT> <FONT color=#000000>InitialContext(p);</FONT></FONT></FONT></P> <P><FONT color=#000000 face=Arial size=2><SPAN class=683285704-21122004>(See the details of your EJB tier spec for these strings.)</SPAN></FONT></P> <P><FONT color=#000000 face=Arial size=2><SPAN class=683285704-21122004>And then use this context to call the lookup() method for getting the ejb home.</SPAN></FONT></P> <P><FONT color=#000000 face=Arial size=2><SPAN class=683285704-21122004>But in this way you need to communicate to the EJB using RMI in which case you may have problem with your firewall or similar set-ups. Even the HTTP tunnelling makes certain areas vulnerable to security risks. So I propose you put either a servlet between your applet and ejb or expose the ejb methods through webservices.</SPAN></FONT></P> <P><FONT color=#000000 face=Arial size=2><SPAN class=683285704-21122004>Regards,</SPAN></FONT></P> <P><FONT color=#000000 face=Arial size=2><SPAN class=683285704-21122004>Partha</SPAN></FONT></P></SPAN></FONT></DIV> <BLOCKQUOTE style="MARGIN-RIGHT: 0px"> <DIV align=left class=OutlookMessageHeader dir=ltr><FONT face=Tahoma size=2>-- --Original Message-- --<BR><B>From:</B> A mailing list for Java(tm) 2 Platform, Enterprise Edition [mailto:J2EE-INTEREST@(protected)]<B>On Behalf Of </B>Dudi Gil<BR><B>Sent:</B> Tuesday, December 21, 2004 10:09 AM<BR><B>To:</B> J2EE-INTEREST@(protected)<BR><B>Subject:</B> Connecting applet with ejb ?<BR><BR></DIV></FONT> <DIV><FONT face=Arial size=2>Hellow,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Can anyone show me an example of how to connect applet with ejb ?</FONT></DIV> <DIV><FONT face=Arial size=2>All the JNDI procedure in particular ?</FONT></DIV> <DIV><FONT face=Arial size=2>If someone can show me an example of how to to it, I'll be very grateful.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>THankd</FONT></DIV> <DIV><FONT face=Arial size=2>David</FONT> </DIV>============================================== ============================= To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help". <P></P></BLOCKQUOTE></BODY></HTML> =========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help". <p>
|
|
 |