Please post a JIRA. It does seem a good idea. What do you think of the
relationship of it with the BaseURLSource service?
On Thu, 06 Jan 2011 18:39:08 -0200, Kalle Korhonen
<[email protected]> wrote:
Given that it's such a common need to generate an absolute uri
including the hostname (to be used in email links, redirect urls for
extenal apis, etc.) and there's no generic, reliable way to deduce it
on the fly, don't you think it'd make sense if the core reserved the
following symbols and contributed some sensible defaults, such as:
public static void
contributeFactoryDefaults(MappedConfiguration<String, String>
configuration) {
String hostname = null;
try {
hostname = System.getenv("HOSTNAME");
} catch (Exception e) {
}
if (hostname == null) hostname = "localhost"; // or
InetAddress.getLocalHost().getHostName()
configuration.add(HostSymbols.HOSTNAME, hostname);
configuration.add(HostSymbols.BASEURI, "http://" + hostname);
}
Sure it's easy to do this in your own application, but if external
libraries require it (I'm working on a drop-in Oauth module), they
would have to use some custom symbol names especially if they
contribute factory defaults so they wouldn't step on each other. Easy
addition, no drawbacks or what do you think? I'll open an issue if you
agree.
Kalle
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
Coordenador e professor da Especialização em Engenharia de Software com
Ênfase em Java da Faculdade Pitágoras
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]