Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2003

Tip: Looking for answers? Try searching our database.

HTTPClient: specifying url string

Thread view: 
Dale - 10 Nov 2003 04:05 GMT
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--
jock - 10 Nov 2003 08:20 GMT
> I need a little assistance with pulling down a page using HTTPClient,
> if someone with experience has a moment...
[quoted text clipped - 17 lines]
>
> --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
Dale - 11 Nov 2003 00:48 GMT
> > Name value pairs handled through NVPair are fine, but what about if I
> > want to read a page normally reached like this:
[quoted text clipped - 7 lines]
> >
> > But where does "ThisGuy" go?

> GetMethod get = new
> GetMethod("http://some.domain.com/somePath/someProggy.dll?ThisGuy&name1=value1&name2=value2");
[quoted text clipped - 3 lines]
> 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?
Dale - 11 Nov 2003 02:59 GMT
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--


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.