Hi Servlet folks,

I am wandering if somebody can help me with a piece of code which suppose to
make
applet/servlet communication.

In the applet part I have :

try {
                        String req = URLEncoder.encode("req") + "=" +
URLEncoder.encode(reqLine.toString());
                        URL url = new
URL("http://XXX.XXX.XXX.XXX:8080/examples/servlet/Response");
                        URLConnection urlConn = url.openConnection();
                        urlConn.setDoOutput(true);
                        urlConn.setDoInput(true);
                        urlConn.setUseCaches(false);
                        urlConn.setRequestProperty("Content-type",

"application/x-www-form-urlencoded");

                        DataOutputStream dos = new
DataOutputStream(urlConn.getOutputStream());
                        dos.writeBytes(req);
                        dos.flush();

                        InputStreamReader isrIn = new
InputStreamReader(urlConn.getInputStream());

                        for (int in = isrIn.read(); in != -1; in =
isrIn.read())
                                strResult.append(String.valueOf((char) in));

                        ChoiseList.add(strResult.toString());

                        dos.close();
                        isrIn.close();
                }
                catch (MalformedURLException e) {
                        strResult.append(e.toString());
                        lTest.setText(e.toString());            // Test
                }catch (IOException e) {
                        strResult.append(e.toString());
                        lTest.setText(e.toString());            // Test
                }
        }

This piece of code generate "java.io.FileNotFoundException" even the servlet
file is there, I can reach it by browser.
But the strange thing is in the java.io.FileNotFoundException it refers to
"XXX.XXX.XXX.XXX:8080//examples/servlet/Response" http address with two
slashes "//". Is it my problem?
Could you point me out where I may did something wrong?

Thank you,



Leonid

___________________________________________________________________________
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