Re: openamf and servlet?
Jason Calabrese <[email protected]>
| Newsgroups | gmane.comp.java.openamf.user |
|---|---|
| Message-ID | <[email protected]> |
For more flexibility try using httpclient, it will let you do a post.
http://jakarta.apache.org/commons/httpclient/
Here's a quick example:
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(url);
method.addParameter("param_name", "param_value");
method.addParameter("param2_name", "param2_value");
int statusCode = -1;
// retry up to 3 times.
for (int attempt = 0; statusCode == -1 && attempt < 3; attempt++) {
try {
statusCode = client.executeMethod(method);
} catch (HttpRecoverableException e) {
log.warn("A recoverable exception occurred, retrying. ", e);
} catch (Exception e) {
log.error("Failed to connect: " + method, e);
break;
}
}
// Check that we didn't run out of retries.
if (statusCode == -1) {
throw new Exception("Failed to recover from exception.");
}
--jason
On Friday 21 January 2005 7:05 pm, Cai Peng wrote:
> Hi,
> I tried to call servlet from java servlet but keep
> getting a "NetConnection.call.BadVersion" error. And
> I still cannot find the reason that caused the error.
> Among openamf examples, there is one clalled
> SubmitToURL to subscribe mailing list. It just create
> an URLConnection to the app server:
> URL url = new
> URL("http://lists.sourceforge.net/lists/subscribe/openamf-user?email=jasonc
>@missionvi.com&pw=test&pw-conf=test")); );
> URLConnection conn = url.openConnection();
> result = conn.getContent().toString();
>
>
> If I wasnot wrong, I can replace part of the url
> string with my servlet name. But does this mean I have
> to pass parameters through url string? Is there any
> othere way to pass the parameters like use post method
> instead of get method for normal html page?
>
> I know flash remoting can get parameters using
> "FLASH.PARAMS" and set parameters using "FLASH.RESULT"
> in servlet. Does openAMF has any feature like that?
>
> Thanks a lot!
>
> sunonepp
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Openamf-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openamf-user
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl