RE: Q : Calling an action via a java URL ?
if you are getting an error related with FileAccess error,, you can try another HTTP Client Api , if you are using SUN Http Client api , when you want to access some sites such as www.google, www.mdb you would get FileAccess error,, -Original Message- From: Henry Voyer [mailto:[EMAIL PROTECTED] Sent: Sunday, September 14, 2003 6:50 AM To: [EMAIL PROTECTED] Subject: Q : Calling an action via a java URL ? hi fellow programmers im trying to call a struts action via http in a java program. Something like URL (Action to call) http://localhost:8443/printHelloWorld.do this returns a blank page with the text "Hello World" I want to read this input from a java program using something like URL u = new URL(notificationServiceURL); URLConnection uc = u.openConnection(); uc.setDoOutput(true); uc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); PrintWriter pw = new PrintWriter(uc.getOutputStream()); pw.close(); BufferedReader in = new BufferedReader(new InputStreamReader( uc.getInputStream())); String res = in.readLine() .trim(); in.close(); But i keep getting some errors. Has someone tried this before? with parameters, properties, etc etc? Thanks a lot _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Q : Calling an action via a java URL ?
I haven't actually used it, but the Commons HttpClient (http://jakarta.apache.org/commons/httpclient/index.html) might of interest to you. Steve > -Original Message- > From: Henry Voyer [mailto:[EMAIL PROTECTED] > Sent: September 13, 2003 8:50 PM > To: [EMAIL PROTECTED] > Subject: Q : Calling an action via a java URL ? > > > hi fellow programmers > > im trying to call a struts action via http in a java program. > > Something like URL (Action to call) > > http://localhost:8443/printHelloWorld.do > > this returns a blank page with the text "Hello World" > > I want to read this input from a java program using something like > >URL u = new URL(notificationServiceURL); > URLConnection uc = u.openConnection(); > uc.setDoOutput(true); > uc.setRequestProperty("Content-Type", > "application/x-www-form-urlencoded"); > PrintWriter pw = new PrintWriter(uc.getOutputStream()); > > pw.close(); > > BufferedReader in = new BufferedReader(new InputStreamReader( > uc.getInputStream())); > String res = in.readLine() >.trim(); > in.close(); > > But i keep getting some errors. > Has someone tried this before? with parameters, properties, etc etc? > > Thanks a lot > > _ > STOP MORE SPAM with the new MSN 8 and get 2 months FREE* > http://join.msn.com/?page=features/junkmail > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]