Hello Thierry, I've just found again the Mapping HTTP semantics page and was reading it :-)
The idea is to try to get the original host:port requested by the client, and if the redirection engine is before the Restlet application, the HTTP Host header for requests hitting the Restlet app are already redirected. However, WebDAV needs (or at least all the implementations I've seen so far do it like this) the URL of the original call, not the redirected URL, in the <href> element of some DAV responses. So I think I'll get the Via header and parse it to get the 1st host:port pair in the Via 'chain' to get the original host:port requested (that is, before all redirections/proxies 'in the middle', between the client and my Restlet server). Thanks. On Mon, Feb 22, 2010 at 2:11 PM, Thierry Boileau <[email protected]> wrote: > Hello Fabian, > > regarding the support of HTTP headers, you can have a look at the user guide > here: http://wiki.restlet.org/docs_2.0/130-restlet.html. The via header is > not supported yet. > Thus, you will to get the "org.restlet.http.headers" reques's attribute... > > I see a problem if the rewriting rule is also based on the path. > > Best regards, > Thierry Boileau > > Hello there, > > one of the elements needed in a WebDAV response for the PROPFIND > method is the href (full URI) of the resource in question. For > example: > > <d:href>http://host:port/path/to/the/resource</d:href> > > Now, if my Restlet application is 'behind' an URL redirect engine, for > example Apache's mod_rewrite, and the client makes the request to: > > http://redirected.uri/path/to/the/resource > > using something like: > > String hrefs = String.format("%s%s", getHostRef().toString(false, > false), Reference.decode(fragment)); // NOI18N > > to compute the text node's value inside <d:href> I get: > > <d:href>http://inside.host:port/path/to/the/resource</d:href> > > instead of (the expected by the client which doesn't need to know > anything about proxies and redirection): > > <d:href>http://redirected.uri/path/to/the/resource</d:href> > > So, I was wondering if getting the HTTP standard "Via" header's first > value (ex: Via: 1.1 redirected.uri 1.1 internal.first.host 1.1 > inside.host:port) to build the URI's value is the right thing to do to > get http://redirected.uri/path/to/the/resource, and if restlet has a > mapped method to get the Via header's value, or I'll have to use the > getRequest().getAttributes().get("org.restlet.http.headers") method > and some String manipulation magic to get the 1st value. > > I hope to have been clear enough, thanks in advance for your prompt > and accurate answer. > > -- Fabián Mandelbaum IS Engineer ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2450553

