The architecture for my system is as follows:
        An applet invokes a servlet which talks to a database, and then returns an
object to the applet using object serialization (see
http://www.j-nine.com/pubs/index.htm#Applet and Servlet Communication for a
great article and sample source code for how to do this.)

I have the following code in my applet, which works (I can tell because of
the log messages I see):

public void init() {

  com.academic.util.Log theLog = new Log (getClass(), "init", true);
  theLog.show("Objective: " + getParameter("ObjectiveTitle"));

  try {
    java.lang.String theHost = getDocumentBase().getHost();
    theLog.show("theHost: " + theHost);

    int thePort = getDocumentBase().getPort();
    theLog.show("thePort: " + thePort);

    theHost = theHost + ":" + thePort;
    theLog.show("now theHost: " + theHost);
    String servletGET = "http://" + theHost
         + "/servlet/ObjectiveFromDB" + "?"
                                   + URLEncoder.encode("ObjectiveTitle") +
"="
                                                +
URLEncoder.encode(getParameter("ObjectiveTitle"));
    theLog.show("now servletGET: " + servletGET);
    theLog.show("Connecting...");
    URL theObjectiveFromDBServlet = new URL( servletGET );
    URLConnection theServletConnection =
theObjectiveFromDBServlet.openConnection();
    theLog.show("Connection to servlet is open");

    theServletConnection.setDoOutput(false);
    theServletConnection.setUseCaches(false);
    theServletConnection.setDefaultUseCaches(false);
    theLog.show("Getting input stream");

Then when this gets executed:

    ObjectInputStream theInputFromServlet =
        new ObjectInputStream(theServletConnection.getInputStream());
    theLog.show("got the input stream");

I don't get the log message, and I get the following error message:

com.ms.security.SecurityExceptionEx[Host]: cannot access "localhost":8080

I am using the server that came with the JSDK1.2 and opening the html page
which references the applet from Internet Explorer 5.0.  (I would love to
use Apache, but never could get the Jserv module to work.)  I need to be
dialed up to my local ISP in order for http://localhost:8080 to work when I
type it in to my browser.

Bernadette

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to