hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Easy way to use self-defined "Http"-Methods...
Date Sun, 01 May 2005 12:17:46 GMT
Clemens,

It should be perfectly okay to subclass the PostMethod class and
override the getName() method. Otherwise I see no difference between the
plain HTTP POST and WebDav MKCOL methods at least based on the sample
code you have posted

Cheers,

Oleg

On Sat, 2005-04-30 at 19:32 +0000, Linuxhippy wrote:
> Hello!
> 
> First of all let me say that HttpClient is great compared to 
> HttpURLConnection ;-). Its even great not compared to this ugly class *g*
> 
> I am currently writing some code that should connect to a WebDAV server, 
> whereas WebDAV is just a bit extended Http protocol.
> I've already posted on the Slide lists but I think this was defentivly 
> the wrong place since Slide was made to cover WebDav via API and not to 
> send arround raw HTTP-Requests ;-)
> 
> I saw that there are predefined methods like Get/Post and so on in the 
> methods-package, what I need to do is what can be done in C# by the 
> following lines of code:
>    HttpWebRequest HttpWRequest = (HttpWebRequest)WebRequest.Create(myUri);
>         HttpWRequest.KeepAlive = false;
>         HttpWRequest.Headers.Set("Pragma", "no-cache");
>         HttpWRequest.ContentType =  "text/xml";
>         HttpWRequest.ContentLength = sQuery.Length;
>         HttpWRequest.Method = "MKCOL";                       //Howto 
> specify an own Request-Method using HttpClient
>          Stream QueryStream = HttpWRequest.GetRequestStream();
>         // Write the data to be posted to the Request Stream
>         QueryStream.Write(ByteQuery,0,ByteQuery.Length);
> 
> Please don't think I am a MS fan, I even don't speak C#, but this was 
> the only sample I found.
> Basically I think this is either a PUT or POST (does anybody know what 
> HttpWRequest really does?), but I don't know howto archive the same via 
> HttpClient, since I do not want to create a whole new method-class which 
> implements HttpMethod.
> Would it be enough to just overwrite the HttpPost-class  and return 
> "MKCOL" as string?
> 
> Would be really great if somebody could help me...
> 
> Thanks in advance, lg Clemens
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message