Thank you François!
This did the trick. Here's the code so that others may learn from this:
@Match("AssetPathConverter")
@SuppressWarnings("unchecked")
public void adviseJsPathMethod(MethodAdviceReceiver receiver)
throws SecurityException, NoSuchMethodException
{
MethodAdvice advice = new MethodAdvice()
{
@Override
public void advise(MethodInvocation invocation)
{
invocation.proceed();
if(invocation.getReturnType().equals(String.class))
{
String result = invocation.getReturnValue().toString();
if (result.matches(".*\\.nocache\\.js"))
{
log.fine(String.format("Converting GWT Path: %s",
result));
// remove assets/<version>/ctx from GWT path -
interferes with servlets
invocation.setReturnValue(result.replaceFirst("\\/assets\\/.*\\/ctx", ""));
}
}
}
};
receiver.adviseMethod(receiver.getInterface().getMethod("convertAssetPath",
String.class), advice);
}
On Aug 16, 2011, at 5:10 AM, françois facon wrote:
> Hi Lenny,
>
> Did you try to advise the method convertAssetPath of AssetPathConverter
> service?
>
>
> public class AppModule
> {
> @Match("AssetPathConverter")
> public void adviseJsPathMethod(MethodAdviceReceiver receiver)
> throws SecurityException, NoSuchMothodException{
>
> MethodAdvice advice = new MethodAdvice(){
> public void advise(invocation invocation){
> invocation.proceed();
> if(invocation.getResult().toString().match(gwtpattern);
> invocation.overrideResult(gwturl);
> }
> };
>
> receiver.adviseMethod(receiver.getInterface().getMethod("convertAssetPath",String.class),advice);
> }
> }
>
> Regards
> François
>
>
> 2011/8/16 Lenny Primak <[email protected]>:
>> I am trying to get GWT-RPC to work inside a GWT component that's a Tapestry
>> component itself.
>> It works for the most part, the problem I am getting is this:
>> GWT tries to call a servlet, ex. /gwtServlets/rowCount, which exists on the
>> server.
>> Since Javascript lives inside Tapestry, its rewriting the request like this:
>> .../assets/fabdee74c434+/ctx/gwt.module/gwtServlets/rowCount
>>
>> I tried
>>
>> public static void contributeIgnoredPathsFilter(Configuration<String>
>> configuration)
>> {
>> configuration.add("/gwtServlets/.*");
>> }
>> to no avail.
>>
>> What can I do to stop Tapestry from rewriting the GWT JavaScript requests?
>> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]