Used when switching between normal/insecure (HTTP) and secure (HTTPS) mode. When a switch occurs, it is no longer
possible to use just paths, instead absolute URLs (including the scheme, hostname and possibly port) must be
generated. The default implementation of this is simple-minded: it just tacks the correct scheme in front of
Request.getServerName()
. In production, behind a firewall, it is often
necessary to do a bit more, since
getServerName()
will often be the name of the internal server (not
visible to the client web browser), and a hard-coded name of a server that
is visible to the web browser
is needed. Further, in testing, non-default ports are often used. In those cases, an overriding contribution to the
ServiceOverride
service will allow a custom implementation to supercede the default version. You may also
contribute application specific values for the following
SymbolConstants
:
TapestryHttpSymbolConstants.HOSTNAME
,
TapestryHttpSymbolConstants.HOSTPORT
and
TapestryHttpSymbolConstants.HOSTPORT_SECURE
to alter the behavior of the default BaseURLSource
implementation. The default values for the SymbolConstants require
Request
context to be available. If you contribute specific values for the specified SymbolConstants, it's safe to use
the default implementation of this service outside of request context, for example in a batch job. For
TapestryHttpSymbolConstants.HOSTNAME
, a value starting with a dollar sign ($) will be resolved
using
System.getenv()
- contributing "$HOSTNAME" for
TapestryHttpSymbolConstants.HOSTNAME
is the most sensible choice for a dynamic value that doesn't use
Request.getServerName()
.