https://issues.apache.org/jira/browse/TAP5-1414
On Thu, Jan 6, 2011 at 1:24 PM, Kalle Korhonen <[email protected]> wrote: > Yes, perhaps BaseURLSource shouldn't call Request.getServerName() (as > documented) but use the HOSTNAME instead. Will open an issue. > > Kalle > > > On Thu, Jan 6, 2011 at 1:17 PM, Howard Lewis Ship <[email protected]> wrote: >> Seems like BaseURLSource would change to make use of those symbols. >> >> On Thu, Jan 6, 2011 at 1:05 PM, Thiago H. de Paula Figueiredo < >> [email protected]> wrote: >> >>> 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] >>> >>> >> >> >> -- >> Howard M. Lewis Ship >> >> Creator of Apache Tapestry >> >> The source for Tapestry training, mentoring and support. Contact me to learn >> how I can get you up and productive in Tapestry fast! >> >> (971) 678-5210 >> http://howardlewisship.com >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
