On Jul 16, 2010, at 3:26 PM, Michael Young wrote:

> Hi John,
> 
> I've begun doing this, but I ran into a few problems:
> 
> 1) Right now it's not very easy to override the Guice binding to 
> JsUriManager. I had to subclass DefaultGuiceModule and UriModule and copy the 
> configure() methods in my subclasses to swap it out. 
> 

There's an easier way:

  install(Modules.override(new DefaultGuiceModule()).with(new AbstractModule() {
     public void configure() {
        bind(foo.class).to(bar.class);
     }
  }


I need to gather some time together to write up this technique.  It makes 
dealing with shindig guice modules much, much easier..


> 2) DefaultJsUriManager does not like %host%. Specifically, somewhere in 
> Uri.parse(jsHost) it creates a java.net.Uri, and it doesn't like %host% 
> naturally. I can work around this by completely reimplementing 
> DefaultJsUriManager. While possible, it seems to be a lot of bandaging to get 
> some old functionality back.

that's problematic.

> 3) container.js still references %host%. Obviously this must work in 
> somebody's test environnment, but not the sample / default env. 
> 
> You mentioned that in your implementation you have overridden behavior to 
> support %host%. It works for you?
> 
> Thanks again for the help.
> 
> - Mike
> --
> Liferay West Coast Symposium
> September 8-9, 2010
> Anaheim, CA
> www.liferay.com/wcs
> --
> Follow us on Twitter: liferay
> 
> On Jul 9, 2010, at 5:17 PM, John Hjelmstad wrote:
> 
>> %host% is a regression to some degree... though is useful, and is in need of
>> a replacement. Given 2.0 is a breaking API release, it was removed.
>> Rationale is that its logic was being sprinkled throughout the code, with
>> the substitution coming from gadget.getContext().getHost(). IMO better would
>> be to have a more general injected context object that, for instance,
>> ContainerConfig would use.
>> 
>> To support it in the interim, you can subclass DefaultJsUriManager and
>> perform the replacement:
>> Uri uri = super.makeExternJsUri();
>> if (uri.toString().contains("%host%")) {
>> uri = new UriBuilder(uri.replaceAll("%host%",
>> gadget.getContext().getHost())).toUri();
>> }
>> return uri;
>> 
>> %js% was replaced with a better-structured host/path based config mechanism.
>> Let me know if there's a use case its removal breaks.
>> 
>> --j
>> 
>> On Fri, Jul 9, 2010 at 4:29 PM, Michael Young 
>> <[email protected]>wrote:
>> 
>>> DefaultURLGenerator used to substitute these tokens. Is this a regresssion,
>>> or is there an alternative way to specify values for host and js at runtime?
>>> 
>>> 
>>> 
>>> - Mike
>>> --
>>> Liferay West Coast Symposium
>>> September 8-9, 2010
>>> Anaheim, CA
>>> www.liferay.com/wcs
>>> --
>>> Follow us on Twitter: liferay
>>> 
>>> 
> 

Reply via email to