cancel
Showing results for 
Search instead for 
Did you mean: 

Open URL connection within applet to BSP page

Former Member
0 Kudos

Hi,

i have the following scenario:

- A BSP page contains an applet with use a jar-archive.

- The user enter some messages on the applet.

- A java class (of the jar archive) tries to open the URL of the applet to send the user input for further processing.

The last step fails without an error message.

I've activate debug modus on the server but nothing happened. Only at the beginning when the HTML page is loaded the debug window opens. (Each request to this page will switch to debug mode.)

If I copy myURL into a browser then it functioned.

Any thoughts are appreciated,

Andy

____________________________

A snippet of my code:

try {

myConnection = (HttpURLConnection)myURL.openConnection();

} catch (IOException e1) {

//do error handling

return false;

}

//configure connection

myConnection.setDoOutput(true);

myConnection.setDoInput(true);

try {

gcaConnection.connect();

out = gcaConnection.getOutputStream();

} catch (IOException e1) {

//do error handling

return false;

}

String send = "Hallo";

try {

out.write(send.getBytes());

out.flush();

out.close();

} catch (IOException e1) {

//do error handling

return false;

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I've found a solution for my own.

Add this block to the end:

//send data thru reading input stream !!!

try {

InputStream in = myConnection.getInputStream();

in.close();

} catch (IOException e1) {

//do some error handling

return false;

}

A more detailed explanation can be found here:

http://www.javaworld.com/javaworld/jw-03-2001/jw-0323-traps.html