HTTPClient: specifying url string

D

Dale

I need a little assistance with pulling down a page using HTTPClient,
if someone with experience has a moment...

Name value pairs handled through NVPair are fine, but what about if I
want to read a page normally reached like this:

http://some.domain.com/somePath/someProggy.dll?ThisGuy&name1=value1&name2=value2

domain = "some.domain.com";
page = "somePath/someProggy.dll";
formData = new NVPair[] {new NVPair("name1", "value1"),new
NVPair("name2", "value2")};

But where does "ThisGuy" go?

I tried NVPair with "" and null - no-go. That emulates "ThisGuy=",
and the page I'm going after doesn't like that.

Thanks for reading!

--Dale--
 
J

jock

Dale said:
I need a little assistance with pulling down a page using HTTPClient,
if someone with experience has a moment...

Name value pairs handled through NVPair are fine, but what about if I
want to read a page normally reached like this:

http://some.domain.com/somePath/someProggy.dll?ThisGuy&name1=value1&name2=value2

domain = "some.domain.com";
page = "somePath/someProggy.dll";
formData = new NVPair[] {new NVPair("name1", "value1"),new
NVPair("name2", "value2")};

But where does "ThisGuy" go?

I tried NVPair with "" and null - no-go. That emulates "ThisGuy=",
and the page I'm going after doesn't like that.

Thanks for reading!

--Dale--

I'm not sure about that (I worked a lot with POST method),
but you could allocate a GetMethod object like

GetMethod get = new
GetMethod("http://some.domain.com/somePath/someProggy.dll?ThisGuy&name1=value1&name2=value2");

and than do something like that

HttpClient client=new HttpClient();
client.executeMethod(get);

Let me know if it work
Cheers
jock
 
D

Dale

jock said:
Dale said:
Name value pairs handled through NVPair are fine, but what about if I
want to read a page normally reached like this:

http://some.domain.com/somePath/someProggy.dll?ThisGuy&name1=value1&name2=value2

domain = "some.domain.com";
page = "somePath/someProggy.dll";
formData = new NVPair[] {new NVPair("name1", "value1"),new
NVPair("name2", "value2")};

But where does "ThisGuy" go?
GetMethod get = new
GetMethod("http://some.domain.com/somePath/someProggy.dll?ThisGuy&name1=value1&name2=value2");

and than do something like that

HttpClient client=new HttpClient();
client.executeMethod(get);

jock, Thanks for the advice, but I think I must be using an old
version or something. I didn't go into it, but I create an
HTTPConnection with a domain and port, then call the Get method with a
page and formData. The documentation doesn't say anything about
"GetMethod" or "executeMethod". The version I have came with a GNU
license dated 1999 and "Copyright (c) 1996-2001 Ronald Tschalär"-
maybe there's an update?
 
D

Dale

I found the latest version at
http://jakarta.apache.org/commons/httpclient/downloads.html

As usual with these things, the old usable version has been picked-up
and changed to such an extent that my old code won't run with the new
stuff (even if I could figure out exactly what to download,
dependencies and all). I noticed that NVPair is gone. So, one day
when I have plenty of time, I'll think about switching over (sigh).

--Dale--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top