You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Sukachevin, Stoehr" <st...@commerceone.com> on 2001/04/12 14:43:50 UTC
Use of RequestUtils.absoluteURL() in LinkTag [and RedirectTag]
Is it really necessary to have the LinkTag [and RedirectTag] use the
RequestUtils.absoluteURL() method when the "forward" or "page" attribute is
specified?
Doing so for LinkTag (obviously) causes the generated URL to be an absolute
URL (e.g., "http://jakarta.apache.org/struts/index.html" as opposed to a
relative URL [w.r.t. the web app] like "/struts/index.html"). However, for
web applications deployed with a SSL accelerator, the web container will not
have the correct URL scheme and port. In this case (and in most cases in
general), one would want to keep all links in the HTML within the web
application relative to the scheme, server, and port -- so you would not
want to explicitly specify those in general.
(If you are not familiar with SSL accelerators, they are hardware that sit
in front of your web server and translate HTTPS to HTTP such that your web
server sees the web request as regular HTTP. The HTTP response generated by
the web server is then translated to HTTPS before being send down to the
client. [At least this is how the SSL accelerator that we are using works
(Intel NetStructure 7115).] Purpose of the accelerator is to off-load the
work of SSL encryption/decryption to dedicated hardware as opposed to the
web servers.)
While I can see the benefit of using absolute URLs in a page (say your HTML
<base> tag points to a different scheme, server, port, etc. such that for a
link, you would want to have the URL be absolute since the link's schema,
server, etc. are different), that scenario is probably not the normal case.
So does anyone think I should submit this to
"http://nagoya.apache.org/bugzilla/"?
-- Stoehr
P.S. For the RedirectTag, since the Servlet API spec says that
response.sendRedirect() can accept relative URLs just fine,
RequestUtils.absoluteURL() should not be needed as well -- and for
consistency, should be removed as well if it is removed for LinkTag. This
does not necessarily help when you are using an SSL accelerator because when
the web container via response.sendRedirect() formulates the absolute URL
(since HTTP protocol expects an absolute URL in the redirection response),
the web container is going to think that the scheme is HTTP when in fact we
want it to be HTTPS.
Re: Use of RequestUtils.absoluteURL() in LinkTag [and RedirectTag]
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Thu, 12 Apr 2001, Sukachevin, Stoehr wrote:
> Is it really necessary to have the LinkTag [and RedirectTag] use the
> RequestUtils.absoluteURL() method when the "forward" or "page" attribute is
> specified?
>
There are a couple of issues here:
* For the link tag, the logic is faced with having a context-relative
path (retrieved from struts-config.xml) that it needs to return to
the browser. Browsers have no clue how to understand context-relative
references, so we've only got two choices: (a) translate it to
absolute, or (b) try to figure out a valid relative path to the new
destination. The latter is harder than it looks in the Struts
environment, because the address has to be relative to wherever the
browser submitted the form, not to the page itself.
* For the redirect tag, even if the tag doesn't convert the URL to
absolute, the servlet engine is supposed to -- this is required by
the servlet specification.
Craig McClanahan