t5: URLWriting, is this correct?

2009-08-08 Thread Angelo Chen

Hi,

in a 5.1.0.5 app, i want to rewrite the url:

http://127.0.0.1:8080/items/123

to 

http://127.0.0.1:8080/itemlist/123

what I did is, adding the following block to AppModule.java, but it is not
working, any idea why?

Thanks,

Angelo

public static void
contributeURLRewriter(OrderedConfiguration configuration) {

   System.out.println("contribute url rewriter");//  i can see this
line in the log
   URLRewriterRule rule = new URLRewriterRule() {

   public Request process(Request request, URLRewriteContext
context) {
   final String path = request.getPath();
   System.out.println("pathxx");// i can not 
see this in the
log
   System.out.println(path);// i 
can not see this in the log
   if (path.equals("/items")) {
   request = new SimpleRequestWrapper(request, "/itemlist");
   }

   return request;

   }

   public RewriteRuleApplicability applicability() {
   return RewriteRuleApplicability.BOTH;
   }

   };

   }

-- 
View this message in context: 
http://www.nabble.com/t5%3A-URLWriting%2C-is-this-correct--tp24884685p24884685.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



redirect from ajax request

2009-08-08 Thread Mario Rabe
Hi,
how can I do a redirect from a XHR-request? Here an example to make clear
what I want to do:

I've got a couter-component which shows a count and 2 links (up and down).
If a link is clicked, the count is changed inPlace. A "ValueChanged"-Event
is triggered on every change.

[Pseudo-Code. won't compile, just to show the intention]
class Counter{
@Property private int count;

EventCallback callback = new EventCallback(){
boolean handleEvent(...){
...
}
};

onUp(){
count++;
resources.triggerEvent("valueChanged", new Object[]{count},
callback);
}
onDown(){
count--;
resources.triggerEvent("valueChanged", new Object[]{count},
callback);
}
}


That counter can be used on pages and the page can do something if user
changes value.

class CounterPage{

 Object onValueChangeFromMyCounter(int count){
  if(count > Oracle.MYSTICAL_VALUE){
System.secretOperation();
  }
 }

}

Now my question is how to do a page-redirect in the EventListener on the
page? I can return an URL from it but to do with it in the callback? Which
service is responsible? And does tapestry.js handle redirects in
XHR-requests as W3C-XHR doesn't?

Greetings

Mario


Re: IOC Problem

2009-08-08 Thread Graham Ford
Thanks for the reply, but it seems I pasted in the wrong error message. 
I ran it with the AppModule commented out. When I put my AppModule back 
in, I get the following error, which is the one I get consistently now:


java.lang.IllegalArgumentException: Contribution 
org.apache.tapestry5.hibernate.HibernateModule.contributePersistentFieldManager(MappedConfiguration) 
(at HibernateModule.java:116) is for service 'PersistentFieldManager', 
which does not exist.


It seems to be a problem loading the HibernateModule but the logging 
shows it is being added to the registry.


Sorry for the confusion!
Graham

Juan E. Maya wrote:

It seems that ur application uses Tapestry-SpringSecurity but that
module is not being loaded. Try to loaded manually when u start the
registry.

On Sat, Aug 8, 2009 at 12:49 AM, Graham
Ford wrote:
  

Hi all,

I am having a weird problem with creating a registry. I am trying to test my
DAOs, and as part of the test I do:

IOCUtilities.buildDefaultRegistry()

when I run the test it print out:

[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.ioc.services.TapestryIOCModule
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.hibernate.HibernateModule
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.hibernate.HibernateCoreModule
[INFO] ioc.RegistryBuilder Adding module definition for class
nu.localhost.tapestry5.springsecurity.services.SecurityModule

which indicates to me it is loading all the modules I have at the moment but
the test then fails saying:

Contribution
nu.localhost.tapestry5.springsecurity.services.SecurityModule.contributeAlias(SaltSourceService,
AuthenticationProcessingFilter, Configuration) (at SecurityModule.java:110)
is for service 'Alias', which does not exist.

what is going on that is stopping the registry starting up?

Thanks,
Graham

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





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


  



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



Re: IOC Problem

2009-08-08 Thread Juan E. Maya
It seems that ur application uses Tapestry-SpringSecurity but that
module is not being loaded. Try to loaded manually when u start the
registry.

On Sat, Aug 8, 2009 at 12:49 AM, Graham
Ford wrote:
> Hi all,
>
> I am having a weird problem with creating a registry. I am trying to test my
> DAOs, and as part of the test I do:
>
> IOCUtilities.buildDefaultRegistry()
>
> when I run the test it print out:
>
> [INFO] ioc.RegistryBuilder Adding module definition for class
> org.apache.tapestry5.ioc.services.TapestryIOCModule
> [INFO] ioc.RegistryBuilder Adding module definition for class
> org.apache.tapestry5.hibernate.HibernateModule
> [INFO] ioc.RegistryBuilder Adding module definition for class
> org.apache.tapestry5.hibernate.HibernateCoreModule
> [INFO] ioc.RegistryBuilder Adding module definition for class
> nu.localhost.tapestry5.springsecurity.services.SecurityModule
>
> which indicates to me it is loading all the modules I have at the moment but
> the test then fails saying:
>
> Contribution
> nu.localhost.tapestry5.springsecurity.services.SecurityModule.contributeAlias(SaltSourceService,
> AuthenticationProcessingFilter, Configuration) (at SecurityModule.java:110)
> is for service 'Alias', which does not exist.
>
> what is going on that is stopping the registry starting up?
>
> Thanks,
> Graham
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

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