Is there any reason why I could not send a response to another server
without a request by having an automated background servlet do something
akin to the following when something happened? Could this be part of the
business logic of a action in Struts, so that more than one response could
be sent to a request?
String str = "key=value";
URL url = new URL("http://www.otherserver.com/dowacka.do");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
PrintWriter pw = new PrintWriter(conn.getOutputStream());
pw.println(str);
pw.close();
I take it, also, if I am not mistaken, that I could do this securely with
https? And, lastly, I assume that I could then get a confirmation of
receipt, or whatever, with something like:
BufferedReader in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String results = in.readLine();
in.close();
That right? Please correct anything, make any suggestions, etc.
Micae
LEGAL NOTICE
This electronic mail transmission and any accompanying documents contain
information belonging to the sender which may be confidential and legally
privileged. This information is intended only for the use of the
individual or entity to whom this electronic mail transmission was sent as
indicated above. If you are not the intended recipient, any disclosure,
copying, distribution, or action taken in reliance on the contents of the
information contained in this transmission is strictly prohibited. If you
have received this transmission in error, please delete the message. Thank you
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- Re: Responses without Requests Micael
- Re: Responses without Requests Nicolas De Loof