Re: WOHTTPConnection & WORequest
Re: WOHTTPConnection & WORequest
- Subject: Re: WOHTTPConnection & WORequest
- From: David Griffith <email@hidden>
- Date: Fri, 28 Jul 2006 10:09:25 +0200
Thanks, I had actually figured out that much, the problem is how to
specify the form values in the request that is sent... The 'content'
part is the bit I can't figure out.
Regards,
David.
On 27 Jul 2006, at 20:00, Alex Cone wrote:
On Jul 27, 2006, at 12:44 PM, webobjects-dev-
email@hidden wrote:
Subject: Re: WOHTTPConnection & WORequest
To: "Jerry W. Walker" <email@hidden>
Hi Jerry,
Well, I have no control over the other website. What I need to do is
this:
In my own WO App, I have a page which displays some information from
the database about a domain name and who it is associated with.
Before you guys get too carried away...
sounds like what you want to do is submit a "GET" style form
request like:
http://www.someDomain.com/doSomething?arg1=foo&arg2=bar
trivial example off the top of my head...
public String sendUrlToHostOnPort(String urlString, String host,
int port) {
NSData content = null;
WOHTTPConnection connection = new WOHTTPConnection(host,
port));
NSDictionary headers = new NSDictionary(new Object[] {"text/
html", "text/html"},
new Object[]
{"Accept", "Content-Type"});
WORequest request = new WORequest("GET", urlString, "HTTP/
1.0", headers, content, null);
connection.sendRequest(request);
WOResponse response = connection.readResponse();
if (response == null) {
System.out.println("WOResponse object is null");
return null;
}
NSData contentData = = response.content();
if (contentData == null) {
System.out.println("No content in the WOResponse object");
return null;
}
return new String(contentData.bytes(0, contentData.length()));
}
HTH!
abc
__alex cone
ceo c o d e f a b inc
email@hidden
212.465.8484 x101
http://www.codefab.com
If you are not living on the edge, you are taking up too much space.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40infinityspain.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden