Bug 28241 - need a way to customize the http headers sent in a webDAV GET request
Summary: need a way to customize the http headers sent in a webDAV GET request
Status: RESOLVED INVALID
Alias: None
Product: Slide
Classification: Unclassified
Component: WebDAV client (show other bugs)
Version: 1.0.11
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Slide Developer List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-06 21:28 UTC by Andrew Lawrence
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
patch to allow access to a WebdavResource's GetMethod object to allow setting custom headers. (1.58 KB, patch)
2004-04-06 21:35 UTC, Andrew Lawrence
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Lawrence 2004-04-06 21:28:42 UTC
I need a way to customize the http headers sent in a webDAV GET request.
Specifically, in order to use Microsoft Exchange Server's (slightly extended)
webDAV, you have to pass a header of "Translate: f" to get the non-html version
of an email (you get an rfc822 message instead). 

URL for more info: 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_exch2k_getting_an_items_stream_http.asp

You can do this easily via HttpMethodBase.addRequestHeader(), but I didnt have
access to the GetMethod object in order to call this function. To resolve this,
I added a method to WebdavResource.java to return a new GetMethod, and another
to execute it. Will attach a patch shortly.  If I need to submit this another
way, make changes, or discuss, please contact me. Thanks.
Comment 1 Andrew Lawrence 2004-04-06 21:35:21 UTC
Created attachment 11158 [details]
patch to allow access to a WebdavResource's GetMethod object to allow setting custom headers.
Comment 2 Andrew Lawrence 2004-04-06 21:40:11 UTC
Sample code for how I intend to use this:

WebdavResource wdr = new WebdavResource(myURL);
GetMethod gm = wdr.getGetMethod();
gm.addRequestHeader("Translate", "f");

int status = wdr.executeHttpRequestMethod(gm);

if (status == 200) {
    String str = gm.getResponseBodyAsString();
}
Comment 3 Ingo Brunberg 2004-04-07 07:27:08 UTC
There already is a way in WebdavResource to execute a customized method.
Call webdavResource.retrieveSessionInstance().executeMethod(myMethod).

Your solution is not feasible, as it would require a getXXXMethod() for every
method used in WebdavResource.
Comment 4 Andrew Lawrence 2004-04-07 13:03:54 UTC
ahh! You are absolutely right. I didn't see that method. Sorry for using
Bugzilla for a support line.