You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Siddhartha Argollo <sl...@tre-ba.gov.br> on 2007/07/06 16:00:25 UTC

[T5.0.5] Contributions to MasterDispatcher not working

Hi all,

I have two submodules, both used by AppModule.

In the first module, I contribute with a "MyFirstDispatcher" to 
MasterDispatcher and the constraint "before:*". In the second module, I 
contribute with "MySecondDispatcher" and the constraint 
"after:MyFirstDispatcher". Although both contributions are correctly 
done, only MyFirstDispatcher.dispatch is called by the application.
The thing is, if I switch the constraints, again only 
MySecondDispatcher.dispatch is called. If I don't use the constraints, 
neither service is called.

I'm returning false in the dispatch method of both services. Am I 
forgetting anything?
What I'm trying to do is wrong in anyway?

I solved my problem contributing to RequestHandler with one of the 
services and leaving the other one with the constraint "before:*", still 
contributing to MasterDispatcher (without this constraint, it doesn't 
work). This way, both dispatches are called by the framework.

Thanks,

Siddhartha Argollo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.0.5] Contributions to MasterDispatcher not working

Posted by Siddhartha Argollo <sl...@tre-ba.gov.br>.
No warnings.

Howard Lewis Ship wrote:
> Sounds like it should work as is, are you getting any warnings in the 
> console?
>
> On 7/6/07, Siddhartha Argollo <sl...@tre-ba.gov.br> wrote:
>> Hi all,
>>
>> I have two submodules, both used by AppModule.
>>
>> In the first module, I contribute with a "MyFirstDispatcher" to
>> MasterDispatcher and the constraint "before:*". In the second module, I
>> contribute with "MySecondDispatcher" and the constraint
>> "after:MyFirstDispatcher". Although both contributions are correctly
>> done, only MyFirstDispatcher.dispatch is called by the application.
>> The thing is, if I switch the constraints, again only
>> MySecondDispatcher.dispatch is called. If I don't use the constraints,
>> neither service is called.
>>
>> I'm returning false in the dispatch method of both services. Am I
>> forgetting anything?
>> What I'm trying to do is wrong in anyway?
>>
>> I solved my problem contributing to RequestHandler with one of the
>> services and leaving the other one with the constraint "before:*", still
>> contributing to MasterDispatcher (without this constraint, it doesn't
>> work). This way, both dispatches are called by the framework.
>>
>> Thanks,
>>
>> Siddhartha Argollo
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>

-- 
Siddhartha Argollo
Técnico Judiciário
TRE-BA
slargollo@tre-ba.gov.br


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.0.5] Contributions to MasterDispatcher not working

Posted by Howard Lewis Ship <hl...@gmail.com>.
Sounds like it should work as is, are you getting any warnings in the console?

On 7/6/07, Siddhartha Argollo <sl...@tre-ba.gov.br> wrote:
> Hi all,
>
> I have two submodules, both used by AppModule.
>
> In the first module, I contribute with a "MyFirstDispatcher" to
> MasterDispatcher and the constraint "before:*". In the second module, I
> contribute with "MySecondDispatcher" and the constraint
> "after:MyFirstDispatcher". Although both contributions are correctly
> done, only MyFirstDispatcher.dispatch is called by the application.
> The thing is, if I switch the constraints, again only
> MySecondDispatcher.dispatch is called. If I don't use the constraints,
> neither service is called.
>
> I'm returning false in the dispatch method of both services. Am I
> forgetting anything?
> What I'm trying to do is wrong in anyway?
>
> I solved my problem contributing to RequestHandler with one of the
> services and leaving the other one with the constraint "before:*", still
> contributing to MasterDispatcher (without this constraint, it doesn't
> work). This way, both dispatches are called by the framework.
>
> Thanks,
>
> Siddhartha Argollo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.0.5] Contributions to MasterDispatcher not working

Posted by Siddhartha Argollo <sl...@tre-ba.gov.br>.
1) Here's the code of the first service

public final class BasicModule
{
    ...
/*
  // It works!
  public static void 
contributeHttpServletRequestHandler(OrderedConfiguration<HttpServletRequestFilter> 
configuration,
      @Symbol(BasicModule.APPLICATION_ENCODING)
      String requestEncoding)
  {
    configuration.add("RequestEncoding", new 
RequestEncodingFilter(requestEncoding));
  }
*/

  // Doesn't work...
  public static void 
contributeMasterDispatcher(OrderedConfiguration<HttpServletRequestFilter> 
configuration,
      @Symbol(BasicModule.APPLICATION_ENCODING)
      String requestEncoding)
  {
    configuration.add("RequestEncoding", new 
RequestEncodingFilter(requestEncoding));
  }
    ...
}


2) Here's the code of the second service

public class SecurityModule
{
    ...

  public static void bind(ServiceBinder binder)
  {
    binder.bind(Dispatcher.class, 
SecurityDispatcher.class).withId("SecurityDispatcher");
  }

  public void contributeSecurityDispatcher(Configuration<String> 
unsecurePaths)
  {
    unsecurePaths.add("/");
    unsecurePaths.add("Start");
    unsecurePaths.add("assets");
  }

  public void 
contributeMasterDispatcher(OrderedConfiguration<Dispatcher> configuration,
      @InjectService("SecurityDispatcher")
      Dispatcher securityDispatcher)
  {
    configuration.add("SecurityDispatcher", securityDispatcher, "before:*");
  }
    ...
}

3) My AppModule

@SubModule({
  BasicModule.class,
  SecurityModule.class
})
public class AppModule
{
  public void contributeApplicationDefaults(MappedConfiguration<String, 
String> configuration)
  {
    configuration.add(BasicModule.APPLICATION_ENCODING, "utf-8");
  }
}


Only the dispather with  "before:*"  is called.
I´m running with JBoss 4.2.0-GA.

Howard Lewis Ship wrote:
> Going to need to see the code for this.
>
> On 7/6/07, Siddhartha Argollo <sl...@tre-ba.gov.br> wrote:
>> Hi all,
>>
>> I have two submodules, both used by AppModule.
>>
>> In the first module, I contribute with a "MyFirstDispatcher" to
>> MasterDispatcher and the constraint "before:*". In the second module, I
>> contribute with "MySecondDispatcher" and the constraint
>> "after:MyFirstDispatcher". Although both contributions are correctly
>> done, only MyFirstDispatcher.dispatch is called by the application.
>> The thing is, if I switch the constraints, again only
>> MySecondDispatcher.dispatch is called. If I don't use the constraints,
>> neither service is called.
>>
>> I'm returning false in the dispatch method of both services. Am I
>> forgetting anything?
>> What I'm trying to do is wrong in anyway?
>>
>> I solved my problem contributing to RequestHandler with one of the
>> services and leaving the other one with the constraint "before:*", still
>> contributing to MasterDispatcher (without this constraint, it doesn't
>> work). This way, both dispatches are called by the framework.
>>
>> Thanks,
>>
>> Siddhartha Argollo
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>

-- 
Siddhartha Argollo
Técnico Judiciário
TRE-BA
slargollo@tre-ba.gov.br


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.0.5] Contributions to MasterDispatcher not working

Posted by Howard Lewis Ship <hl...@gmail.com>.
Going to need to see the code for this.

On 7/6/07, Siddhartha Argollo <sl...@tre-ba.gov.br> wrote:
> Hi all,
>
> I have two submodules, both used by AppModule.
>
> In the first module, I contribute with a "MyFirstDispatcher" to
> MasterDispatcher and the constraint "before:*". In the second module, I
> contribute with "MySecondDispatcher" and the constraint
> "after:MyFirstDispatcher". Although both contributions are correctly
> done, only MyFirstDispatcher.dispatch is called by the application.
> The thing is, if I switch the constraints, again only
> MySecondDispatcher.dispatch is called. If I don't use the constraints,
> neither service is called.
>
> I'm returning false in the dispatch method of both services. Am I
> forgetting anything?
> What I'm trying to do is wrong in anyway?
>
> I solved my problem contributing to RequestHandler with one of the
> services and leaving the other one with the constraint "before:*", still
> contributing to MasterDispatcher (without this constraint, it doesn't
> work). This way, both dispatches are called by the framework.
>
> Thanks,
>
> Siddhartha Argollo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org