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.
Created attachment 11158 [details] patch to allow access to a WebdavResource's GetMethod object to allow setting custom headers.
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(); }
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.
ahh! You are absolutely right. I didn't see that method. Sorry for using Bugzilla for a support line.