Re: change session id after login

2010-10-25 Thread Mike Oestereter
Hi

In my mind it is not a peculiar requirement but a basic security 101
requirement.
Session ID should change after login, after logoff and after reauth
(for sensitive operations).


On Wed, Oct 20, 2010 at 1:51 AM, Kalle Korhonen
kalle.o.korho...@gmail.com wrote:
 That's a rather peculiar requirement. Sessions are semi-managed by the
 container and I don't know of a container that would allow you to do
 that. If you used Shiro in native session mode, you could probably
 change the id but even then, you'd need to cast and use the
 implementation classes directly.

 Kalle


 On Tue, Oct 19, 2010 at 2:40 PM, Mike Oestereter
 mike.oestere...@gmail.com wrote:
 The problem is that I don't want to invalidate the session from an
 application point of view.

 After successful login I want to store details about the authenticated
 user in the user session.

 I just want to kill the existing cookie and associate a new (and
 different cookie) with the current session.


 On Mon, Oct 18, 2010 at 3:13 PM, Thiago H. de Paula Figueiredo
 thiag...@gmail.com wrote:
 Grabbing the session and invalidating directly does the trick but
 you have to be sure this occurs at the end of the request - otherwise
 Tapestry may try to reuse the session and because that has been
 invalidated you'd get exceptions.

 As long as you invalidate it through Tapestry (Session.invalidate()) instead
 of directly through HttpSession.invalidate(), I don't think exceptions will
 be thrown.

 -
 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: On EventBubbling

2010-10-25 Thread Alessio Gambi

Hi,
FYI.

In the end I managed to have a working solution for altering the  
behaviour of event bubbling (limited to void,  boolean and null values).


My solution that I really do not appreciate so much... consists in:

- Provide an annotation: @StopBubbling

- Copy+Paste+Modify the OnEventWorker and do the following mods:
	- at the beginning recover all the methods with the annotation  
(blocked methods)
	- for all the blocked methods wrap the contextEvent in a new class to  
force the event.isAborted to a true value, and the storeResult to  
store a wrapped Boolean, Null or Void.


- Provide a contribution to ComponentEventProcessor to deal with the  
new types of objects



On Oct 24, 2010, at 7:54 PM, Howard Lewis Ship wrote:


The boolean logic is hard coded; perhaps you should think in terms of
a enum to return instead.

On Sat, Oct 23, 2010 at 11:29 PM, Alessio Gambi agamb...@gmail.com  
wrote:

Hi,

I would like to return a boolean value form the handler instead of  
using the
value of the boolean itself to control the bubbling process  
(actually the

same applies to void).
For this purpose, I defined an annotation to prevent events to  
bubble for

the annotated event handler methods, and a
ComponentClassTransformationWorker.

The first idea was to let the worker to modify the return value of  
the

original method to something wrapping the boolean (and the void) and
override its result. Unfortunately I did not find a way to do that.
The next idea is to add a new eventHandler method that listen for  
the same
events/components of the original one, it basically wraps the body  
of the

original method using an advide.
The problem now is to register this new method with the  
dispatcherMethod.
I think the best way is to annotate the method with the OnEvent  
annotation

and name it something like:

_+originalMethod name

In this way, this method should be always called before the  
original one,
always produces an Object that stops the bubbling, and always  
invoke the

same logic as the original method.

The problem: I cannot find a way to add the annotation to a generated
method.


In another possibility, I can name the new method with something like
on+MethodName. But, I do not remember if the annotation takes  
precedence

over the naming convention.
Anyway, this solution is not so clean (and there may be clashes or  
method

duplications).

Any advice ?

BTW, I am using 5.2

Thank you.

-- Alessio

PS: As far as possible, I would like the OnEventWorker to register  
handler

methods in the component event dispatcher.







--
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: 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



tynamo-security (shiro) exception

2010-10-25 Thread Anton Mezerny
Hi all,
I am playing with hotel booking application and trying to use some examples
from it in my project. Now I have a problem in login page - when I try to
login, I got
shiro's cipher exception, like here:
https://issues.apache.org/jira/browse/SHIRO-183
Is it fixed now? How can I upgrade to fixed version of
shiro/tynamo-security?
Thanks in advance.
Anton


Re: Annotations and ComponentRequestFilter Problem

2010-10-25 Thread shinlang

Hi Taha, Hi Thiago,

Thanks a lot for your reply, it's working perfectly! And besides, this
surely gave me some more basic understanding on how tapestry works.

Have a nice day,
cheers,
Sascha
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Annotations-and-ComponentRequestFilter-Problem-tp3232159p3235337.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



Re: tynamo-security (shiro) exception

2010-10-25 Thread Mark Shead
What version of tapestry-security are you using in your pom.xml?

On Mon, Oct 25, 2010 at 7:27 AM, Anton Mezerny anton.meze...@gmail.comwrote:

 Hi all,
 I am playing with hotel booking application and trying to use some examples
 from it in my project. Now I have a problem in login page - when I try to
 login, I got
 shiro's cipher exception, like here:
 https://issues.apache.org/jira/browse/SHIRO-183
 Is it fixed now? How can I upgrade to fixed version of
 shiro/tynamo-security?
 Thanks in advance.
 Anton



Re: Objects session persistance and validation

2010-10-25 Thread Mark
Do all the other validations perform as expected other than email? Does the
required validation on email work correctly and give you an error when you
try to submit. Also do you have any types of constraints on the email field
in the database? Is it possible that what you are entering in the email
fields is passing the email validation, but getting rejected by the
database?

I don't remember what Tapestry uses to determine whether or not something is
a valid email address, but I do know that the actual spec for email
addresses is a lot more permissive than you'd think.

Mark

On Mon, Oct 25, 2010 at 6:35 AM, Anton Mezerny anton.meze...@gmail.comwrote:

 So, I removed initializeNewUser() from Registration.java and added @Inject
 annotation to User.java and Customer.java (I also made user and customer
 separate, not nested one into another and I nest user into customer just
 before saving to DB). Now page renders well, but when I try to save user
 and
 customer (and email is invalid) - email validation does not occurs - I just
 have email = null in my customer.email field (even if i set some incorrect
 value, for exapmle 'test_email'). There is no redirect to the registration
 page with error message - program continues execution and tries to save
 data
 to DB.

 2010/10/23 Mark W. Shead mwsh...@gmail.com

  I don't think you want to use flash persistence for this.  Try just
  using @Persist. It looks like you are creating a new user every time
  the page renders.
 
  Mark
 
  On Sat, Oct 23, 2010 at 3:08 PM, Jim O'Callaghan jc1000...@yahoo.co.uk
  wrote:
   I'm not sure if this is relevant to your current problem, but to tell
   Tapestry which constructor to use for the bean editor, you should
  annotate
   the default (no args) constructor with @Inject - this will allow the
 BEF
  to
   create the relevant entity if none if present.  Hope this helps.
  
   Regards,
   Jim.
  
   -Original Message-
   From: Anton Mezerny [mailto:anton.meze...@gmail.com]
   Sent: 23 October 2010 17:02
   To: Tapestry users
   Subject: Objects session persistance and validation
  
   Hi all,
   I'm trying to write simple registration form using beaneditor
 component.
   If I fullfill all reqired fields in the form and submit it - everything
   works fine, but if server validation occurs (for example passwords
 don't
   match), then all data is lost and Registration page renders with
  validation
   errors, but without user data (input values).
   I think the reason for this behaviour is the initializeNewUser()
 method,
   wich rewrites all data if user field is null. But if I delete this
 method
   from code, tapestry throws exception - User can't be instantiated
  (tapestry
   tries to use constructor with most parameters, which has custom
 objects,
  not
   only String, Integer, etc). So how can resolve this problem?
   Thanks in advance.
  
My code (some code is token from Tapestry5 Hotel Booking example):
  
 
 -Registration.java:-
   ---
  
   public class Registration {
  
  @Property
  @Persist(PersistenceConstants.FLASH)
  private User user;
  
  @OnEvent(value = EventConstants.PREPARE, component = registerForm)
  private void initializeNewUser() {
  if (this.user == null) {
  this.user = new User();
  this.user.setCustomer(new Customer());
  } else {
  if (this.user.getCustomer() == null) {
  this.user.setCustomer(new Customer());
  }
  }
  }
  
  
  @Property
  private String verifyPassword;
  
  @Inject
  private UserService userService;
  
  @Component
  private Form registerForm;
  
  @Inject
  private Messages messages;
  
  public Object onSubmitFromRegisterForm() {
  
  if (!verifyPassword.equals(user.getPassword())) {
  
   registerForm.recordError(messages.get(error.verify.password));
  
  return null;
  }
  
  if (userService.getUserByLogin(user.getLogin()) != null) {
  
   registerForm.recordError(messages.get(error.user.already.exists));
  
  return null;
  }
  
  userService.save(user);
  
  return Index.class;
  
  }
   }
  
  
   --Registration.tml
  
  
   html t:type=layout title=Customer registration
t:sidebarTitle=Current Time
t:pageTitle=Register
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
xmlns:p=tapestry:parameter
  
   fieldset id=register
  form class=full-form t:id=registerForm
  t:errors/
  
  fieldset
  legendCustomer registration(company or private
   person)/legend
  
  t:beaneditor object=user.customer
   exclude=literal:id,users
  p:businessName
  t:label for=businessName/
 

dynamically reload a select control

2010-10-25 Thread hese

Hi,

I have a select box in my tml -

select t:type=Select t:id=adv1  model=brandModel value=brandId1 /

I also have an option where values can be added to this select box from that
page.  After the user adds a value I want the select box to repopulate and
display the new value as well.

To accomplish this, at the end of the event handler for adding the new
value, I am doing this

 @OnEvent(component = inPlaceEditorBrand, value =
InPlaceEditor.SAVE_EVENT)
Object onAddBrand(Long contextId, String brandName) {
{

...
...

setupBrandModel(); //here I am creating the 'brandModel' with the new value
return this;
}

...returning 'this' expecting the page to reload again  and have the new
value.  but the page is not reloading and the select box does not have the
new value.

What is the mistake?  Is there any other way to reload the select box with
the new values without reloading the page?

Thanks

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/dynamically-reload-a-select-control-tp3235533p3235533.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



Re: tynamo-security (shiro) exception

2010-10-25 Thread Christophe Cordenier
Hi

Yes it's fixed, i have update the pom.xml to use tynamo 0.3.0-SNAPSHOT

2010/10/25 Anton Mezerny anton.meze...@gmail.com

 Hi all,
 I am playing with hotel booking application and trying to use some examples
 from it in my project. Now I have a problem in login page - when I try to
 login, I got
 shiro's cipher exception, like here:
 https://issues.apache.org/jira/browse/SHIRO-183
 Is it fixed now? How can I upgrade to fixed version of
 shiro/tynamo-security?
 Thanks in advance.
 Anton




-- 
Regards,
Christophe Cordenier.

Committer on Apache Tapestry 5
Co-creator of wooki @wookicentral.com


Re: change session id after login

2010-10-25 Thread Kalle Korhonen
But typically, you'd just invalidate the session which of course
forces a new session id.

Kalle


On Mon, Oct 25, 2010 at 12:21 AM, Mike Oestereter
mike.oestere...@gmail.com wrote:
 Hi

 In my mind it is not a peculiar requirement but a basic security 101
 requirement.
 Session ID should change after login, after logoff and after reauth
 (for sensitive operations).


 On Wed, Oct 20, 2010 at 1:51 AM, Kalle Korhonen
 kalle.o.korho...@gmail.com wrote:
 That's a rather peculiar requirement. Sessions are semi-managed by the
 container and I don't know of a container that would allow you to do
 that. If you used Shiro in native session mode, you could probably
 change the id but even then, you'd need to cast and use the
 implementation classes directly.

 Kalle


 On Tue, Oct 19, 2010 at 2:40 PM, Mike Oestereter
 mike.oestere...@gmail.com wrote:
 The problem is that I don't want to invalidate the session from an
 application point of view.

 After successful login I want to store details about the authenticated
 user in the user session.

 I just want to kill the existing cookie and associate a new (and
 different cookie) with the current session.


 On Mon, Oct 18, 2010 at 3:13 PM, Thiago H. de Paula Figueiredo
 thiag...@gmail.com wrote:
 Grabbing the session and invalidating directly does the trick but
 you have to be sure this occurs at the end of the request - otherwise
 Tapestry may try to reuse the session and because that has been
 invalidated you'd get exceptions.

 As long as you invalidate it through Tapestry (Session.invalidate()) 
 instead
 of directly through HttpSession.invalidate(), I don't think exceptions will
 be thrown.

 -
 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



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



Re: dynamically reload a select control

2010-10-25 Thread Mark
Are you sure that OnAddBranding is getting called when they add a brand?
If the page doesn't reload, then it sounds like the form isn't submitting.

Here is an example of a select component being updated via AJAX that might
help if you don't want to reload the page:
http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxselect1
http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxselect1
Mark

On Mon, Oct 25, 2010 at 9:56 AM, hese 1024h...@gmail.com wrote:


 Hi,

 I have a select box in my tml -

 select t:type=Select t:id=adv1  model=brandModel value=brandId1 /

 I also have an option where values can be added to this select box from
 that
 page.  After the user adds a value I want the select box to repopulate and
 display the new value as well.

 To accomplish this, at the end of the event handler for adding the new
 value, I am doing this

  @OnEvent(component = inPlaceEditorBrand, value =
 InPlaceEditor.SAVE_EVENT)
 Object onAddBrand(Long contextId, String brandName) {
 {

 ...
 ...

 setupBrandModel(); //here I am creating the 'brandModel' with the new value
 return this;
 }

 ...returning 'this' expecting the page to reload again  and have the new
 value.  but the page is not reloading and the select box does not have the
 new value.

 What is the mistake?  Is there any other way to reload the select box with
 the new values without reloading the page?

 Thanks

 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/dynamically-reload-a-select-control-tp3235533p3235533.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




Re: Objects session persistance and validation

2010-10-25 Thread Anton Mezerny
Required validation works on client side, so I have not tested it on server.
I can say, that when my custom validation causes error (password and
password verification don't match), then I have 2 error messages on
registration page (if email is also not valid) - email error and password
verification error.

Anton

2010/10/25 Mark mark-li...@xeric.net

 Do all the other validations perform as expected other than email? Does the
 required validation on email work correctly and give you an error when
 you
 try to submit. Also do you have any types of constraints on the email field
 in the database? Is it possible that what you are entering in the email
 fields is passing the email validation, but getting rejected by the
 database?

 I don't remember what Tapestry uses to determine whether or not something
 is
 a valid email address, but I do know that the actual spec for email
 addresses is a lot more permissive than you'd think.

 Mark

 On Mon, Oct 25, 2010 at 6:35 AM, Anton Mezerny anton.meze...@gmail.com
 wrote:

  So, I removed initializeNewUser() from Registration.java and added
 @Inject
  annotation to User.java and Customer.java (I also made user and customer
  separate, not nested one into another and I nest user into customer just
  before saving to DB). Now page renders well, but when I try to save user
  and
  customer (and email is invalid) - email validation does not occurs - I
 just
  have email = null in my customer.email field (even if i set some
 incorrect
  value, for exapmle 'test_email'). There is no redirect to the
 registration
  page with error message - program continues execution and tries to save
  data
  to DB.
 
  2010/10/23 Mark W. Shead mwsh...@gmail.com
 
   I don't think you want to use flash persistence for this.  Try just
   using @Persist. It looks like you are creating a new user every time
   the page renders.
  
   Mark
  
   On Sat, Oct 23, 2010 at 3:08 PM, Jim O'Callaghan 
 jc1000...@yahoo.co.uk
   wrote:
I'm not sure if this is relevant to your current problem, but to tell
Tapestry which constructor to use for the bean editor, you should
   annotate
the default (no args) constructor with @Inject - this will allow the
  BEF
   to
create the relevant entity if none if present.  Hope this helps.
   
Regards,
Jim.
   
-Original Message-
From: Anton Mezerny [mailto:anton.meze...@gmail.com]
Sent: 23 October 2010 17:02
To: Tapestry users
Subject: Objects session persistance and validation
   
Hi all,
I'm trying to write simple registration form using beaneditor
  component.
If I fullfill all reqired fields in the form and submit it -
 everything
works fine, but if server validation occurs (for example passwords
  don't
match), then all data is lost and Registration page renders with
   validation
errors, but without user data (input values).
I think the reason for this behaviour is the initializeNewUser()
  method,
wich rewrites all data if user field is null. But if I delete this
  method
from code, tapestry throws exception - User can't be instantiated
   (tapestry
tries to use constructor with most parameters, which has custom
  objects,
   not
only String, Integer, etc). So how can resolve this problem?
Thanks in advance.
   
 My code (some code is token from Tapestry5 Hotel Booking example):
   
  
 
 -Registration.java:-
---
   
public class Registration {
   
   @Property
   @Persist(PersistenceConstants.FLASH)
   private User user;
   
   @OnEvent(value = EventConstants.PREPARE, component =
 registerForm)
   private void initializeNewUser() {
   if (this.user == null) {
   this.user = new User();
   this.user.setCustomer(new Customer());
   } else {
   if (this.user.getCustomer() == null) {
   this.user.setCustomer(new Customer());
   }
   }
   }
   
   
   @Property
   private String verifyPassword;
   
   @Inject
   private UserService userService;
   
   @Component
   private Form registerForm;
   
   @Inject
   private Messages messages;
   
   public Object onSubmitFromRegisterForm() {
   
   if (!verifyPassword.equals(user.getPassword())) {
   
registerForm.recordError(messages.get(error.verify.password));
   
   return null;
   }
   
   if (userService.getUserByLogin(user.getLogin()) != null) {
   
registerForm.recordError(messages.get(error.user.already.exists));
   
   return null;
   }
   
   userService.save(user);
   
   return Index.class;
   
   }
}
   
   
--Registration.tml
   
   
html t:type=layout title=Customer registration
 t:sidebarTitle=Current Time
 t:pageTitle=Register
  

Re: On EventBubbling

2010-10-25 Thread Josh Canfield
I don't understand the use case. Can you describe why you want to do this?

On Mon, Oct 25, 2010 at 1:13 AM, Alessio Gambi agamb...@gmail.com wrote:
 Hi,
 FYI.

 In the end I managed to have a working solution for altering the behaviour
 of event bubbling (limited to void,  boolean and null values).

 My solution that I really do not appreciate so much... consists in:

 - Provide an annotation: @StopBubbling

 - Copy+Paste+Modify the OnEventWorker and do the following mods:
        - at the beginning recover all the methods with the annotation
 (blocked methods)
        - for all the blocked methods wrap the contextEvent in a new class to
 force the event.isAborted to a true value, and the storeResult to store a
 wrapped Boolean, Null or Void.

 - Provide a contribution to ComponentEventProcessor to deal with the new
 types of objects


 On Oct 24, 2010, at 7:54 PM, Howard Lewis Ship wrote:

 The boolean logic is hard coded; perhaps you should think in terms of
 a enum to return instead.

 On Sat, Oct 23, 2010 at 11:29 PM, Alessio Gambi agamb...@gmail.com
 wrote:

 Hi,

 I would like to return a boolean value form the handler instead of using
 the
 value of the boolean itself to control the bubbling process (actually the
 same applies to void).
 For this purpose, I defined an annotation to prevent events to bubble for
 the annotated event handler methods, and a
 ComponentClassTransformationWorker.

 The first idea was to let the worker to modify the return value of the
 original method to something wrapping the boolean (and the void) and
 override its result. Unfortunately I did not find a way to do that.
 The next idea is to add a new eventHandler method that listen for the
 same
 events/components of the original one, it basically wraps the body of the
 original method using an advide.
 The problem now is to register this new method with the
 dispatcherMethod.
 I think the best way is to annotate the method with the OnEvent
 annotation
 and name it something like:

 _+originalMethod name

 In this way, this method should be always called before the original one,
 always produces an Object that stops the bubbling, and always invoke the
 same logic as the original method.

 The problem: I cannot find a way to add the annotation to a generated
 method.


 In another possibility, I can name the new method with something like
 on+MethodName. But, I do not remember if the annotation takes precedence
 over the naming convention.
 Anyway, this solution is not so clean (and there may be clashes or method
 duplications).

 Any advice ?

 BTW, I am using 5.2

 Thank you.

 -- Alessio

 PS: As far as possible, I would like the OnEventWorker to register
 handler
 methods in the component event dispatcher.






 --
 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: 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: tapestry-resteasy NPE when trying to access session

2010-10-25 Thread Josh Canfield
 I'd like to get access to the current session from inside my resteasy handler 
 methods.
How are you creating your resteasy handler?

On Mon, Oct 25, 2010 at 3:06 AM, Moritz Gmelin moritz.gme...@gmx.de wrote:
 Hi,

 I'd like to get access to the current session from inside my resteasy handler 
 methods. But when I inject the request and call getSession() on it, I get a 
 NullPointerException.
 My original goal was to get access to SessionState objects from tapestry by 
 calling the ApplicationStateManager.get() method with our SessionState 
 object. But this fails for the same reason.
 Why is the session object not accessible from the injected Request object in 
 a ResteasyHandler?

 The code below will throw an exception on the line request.getSession(false).

 @Path(/resttest)
 public class TestResource
 {

       �...@inject
        private Request request;

       �...@inject
        private ApplicationStateManager asm;

       �...@injectresource
        private Logger log;


       �...@get
       �...@produces(text/xml)
        public ListTestEntity getEntityList()
        {

                log.warn(REST Request in request  + request);
                log.warn(REST Request in session2  + 
 request.getSession(false));


 M.




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



Re: On EventBubbling

2010-10-25 Thread Alessio Gambi

Hi,

my use case is to use Tapestry as back end of GWT components, in  
particular the ones that use GWT RPC calls (that may have void and  
boolean as return type).
Tapestry can be used in place of the server side GWT Servlet to  
intercept the calls and route them (as ComponentEvent) to components.


More details can be found here.
http://code.google.com/p/trsvax-gmt/

-- Alessio
On Oct 25, 2010, at 5:59 PM, Josh Canfield wrote:

I don't understand the use case. Can you describe why you want to do  
this?


On Mon, Oct 25, 2010 at 1:13 AM, Alessio Gambi agamb...@gmail.com  
wrote:

Hi,
FYI.

In the end I managed to have a working solution for altering the  
behaviour

of event bubbling (limited to void,  boolean and null values).

My solution that I really do not appreciate so much... consists in:

- Provide an annotation: @StopBubbling

- Copy+Paste+Modify the OnEventWorker and do the following mods:
   - at the beginning recover all the methods with the annotation
(blocked methods)
   - for all the blocked methods wrap the contextEvent in a new  
class to
force the event.isAborted to a true value, and the storeResult to  
store a

wrapped Boolean, Null or Void.

- Provide a contribution to ComponentEventProcessor to deal with  
the new

types of objects


On Oct 24, 2010, at 7:54 PM, Howard Lewis Ship wrote:

The boolean logic is hard coded; perhaps you should think in terms  
of

a enum to return instead.

On Sat, Oct 23, 2010 at 11:29 PM, Alessio Gambi agamb...@gmail.com
wrote:


Hi,

I would like to return a boolean value form the handler instead  
of using

the
value of the boolean itself to control the bubbling process  
(actually the

same applies to void).
For this purpose, I defined an annotation to prevent events to  
bubble for

the annotated event handler methods, and a
ComponentClassTransformationWorker.

The first idea was to let the worker to modify the return value  
of the
original method to something wrapping the boolean (and the void)  
and

override its result. Unfortunately I did not find a way to do that.
The next idea is to add a new eventHandler method that listen for  
the

same
events/components of the original one, it basically wraps the  
body of the

original method using an advide.
The problem now is to register this new method with the
dispatcherMethod.
I think the best way is to annotate the method with the OnEvent
annotation
and name it something like:

_+originalMethod name

In this way, this method should be always called before the  
original one,
always produces an Object that stops the bubbling, and always  
invoke the

same logic as the original method.

The problem: I cannot find a way to add the annotation to a  
generated

method.


In another possibility, I can name the new method with something  
like
on+MethodName. But, I do not remember if the annotation takes  
precedence

over the naming convention.
Anyway, this solution is not so clean (and there may be clashes  
or method

duplications).

Any advice ?

BTW, I am using 5.2

Thank you.

-- Alessio

PS: As far as possible, I would like the OnEventWorker to register
handler
methods in the component event dispatcher.







--
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: 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




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



Re: On EventBubbling

2010-10-25 Thread Thiago H. de Paula Figueiredo
On Mon, 25 Oct 2010 14:53:09 -0200, Alessio Gambi agamb...@gmail.com  
wrote:



Hi,


Hi!

my use case is to use Tapestry as back end of GWT components, in  
particular the ones that use GWT RPC calls (that may have void and  
boolean as return type). Tapestry can be used in place of the server  
side GWT Servlet to intercept the calls and route them (as  
ComponentEvent) to components.

More details can be found here.
http://code.google.com/p/trsvax-gmt/


Reading the project goals page, I've found this: Secondly GWT wants your  
service to implement an interface and that's just not the Tapestry way.  
Defining a service as an interface is the Tapestry and Tapestry-IoC  
recommended way of doing things. ;)


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Form submit conditionally opening new window

2010-10-25 Thread Rich M

Hi,

a while back I built in JasperReports support into my application, and 
on the pages accessing this I had a form with target=_blank to open 
the reports in a new window. I'm now being required to enforce a 
restriction on some parameters feeding into the reports, and I want to 
do this on the server side with onValidateFromXX method(s). The issue 
I'm having is that using the target=_blank in the template means that 
in the event of an error in the form fields, a new window opens 
displaying the form with errors, but the original screen is left 
untouched. The validation works, but this certainly is not going to be 
acceptable application behavior.


Is there a way to get the browser to open a new window from within 
Tapestry, maybe in a StreamResponse (since that I what I'm using to 
render the reports)?


Thanks,
Rich

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



Re: Form submit conditionally opening new window

2010-10-25 Thread Thiago H. de Paula Figueiredo

On Mon, 25 Oct 2010 15:29:52 -0200, Rich M rich...@moremagic.com wrote:


Hi,


Hi!

Is there a way to get the browser to open a new window from within  
Tapestry, maybe in a StreamResponse (since that I what I'm using to  
render the reports)?


AFAIK, no, as this is a purely client behavior. You'll need to solve this  
with a AJAX request just to validate the form before you do an actual form  
submission.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: tynamo-security (shiro) exception

2010-10-25 Thread Anton Mezerny
Checked out new version of Hotel booking application. There is no
tynamo-security dependency in pom.xml at all. Am I doing something wrong?
Anton

2010/10/25 Christophe Cordenier christophe.corden...@gmail.com

 Hi

 Yes it's fixed, i have update the pom.xml to use tynamo 0.3.0-SNAPSHOT

 2010/10/25 Anton Mezerny anton.meze...@gmail.com

  Hi all,
  I am playing with hotel booking application and trying to use some
 examples
  from it in my project. Now I have a problem in login page - when I try to
  login, I got
  shiro's cipher exception, like here:
  https://issues.apache.org/jira/browse/SHIRO-183
  Is it fixed now? How can I upgrade to fixed version of
  shiro/tynamo-security?
  Thanks in advance.
  Anton
 



 --
 Regards,
 Christophe Cordenier.

 Committer on Apache Tapestry 5
 Co-creator of wooki @wookicentral.com



Re: tynamo-security (shiro) exception

2010-10-25 Thread Katia Aresti
Its normal, you have to checkout Tynamo branch ;)


2010/10/25 Anton Mezerny anton.meze...@gmail.com

 Checked out new version of Hotel booking application. There is no
 tynamo-security dependency in pom.xml at all. Am I doing something wrong?
 Anton

 2010/10/25 Christophe Cordenier christophe.corden...@gmail.com

  Hi
 
  Yes it's fixed, i have update the pom.xml to use tynamo 0.3.0-SNAPSHOT
 
  2010/10/25 Anton Mezerny anton.meze...@gmail.com
 
   Hi all,
   I am playing with hotel booking application and trying to use some
  examples
   from it in my project. Now I have a problem in login page - when I try
 to
   login, I got
   shiro's cipher exception, like here:
   https://issues.apache.org/jira/browse/SHIRO-183
   Is it fixed now? How can I upgrade to fixed version of
   shiro/tynamo-security?
   Thanks in advance.
   Anton
  
 
 
 
  --
  Regards,
  Christophe Cordenier.
 
  Committer on Apache Tapestry 5
  Co-creator of wooki @wookicentral.com
 



Re: tapestry-resteasy NPE when trying to access session

2010-10-25 Thread Moritz Gmelin
?? I don't understand your question. I beleive that tapestry-resteasy does this 
for me.

Could it be that since the tapestry-resteasy HttpServletRequestHandler is 
placed before:GZIP, tapestry has not yet initialized its RequestGlobals and 
thus the session information is not yet available where reasteasy handles its 
service methods?

M.


Am 25.10.2010 um 18:30 schrieb Josh Canfield:

 I'd like to get access to the current session from inside my resteasy 
 handler methods.
 How are you creating your resteasy handler?
 
 On Mon, Oct 25, 2010 at 3:06 AM, Moritz Gmelin moritz.gme...@gmx.de wrote:
 Hi,
 
 I'd like to get access to the current session from inside my resteasy 
 handler methods. But when I inject the request and call getSession() on it, 
 I get a NullPointerException.
 My original goal was to get access to SessionState objects from tapestry by 
 calling the ApplicationStateManager.get() method with our SessionState 
 object. But this fails for the same reason.
 Why is the session object not accessible from the injected Request object in 
 a ResteasyHandler?
 
 The code below will throw an exception on the line request.getSession(false).
 
 @Path(/resttest)
 public class TestResource
 {
 
@Inject
private Request request;
 
@Inject
private ApplicationStateManager asm;
 
@InjectResource
private Logger log;
 
 
@GET
@Produces(text/xml)
public ListTestEntity getEntityList()
{
 
log.warn(REST Request in request  + request);
log.warn(REST Request in session2  + 
 request.getSession(false));
 
 
 M.
 
 
 
 
 -
 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: Objects session persistance and validation

2010-10-25 Thread Anton Mezerny
Ok, when i changed order from validation=required,email to
validation=email,required email validation starts to work properly. Looks
like some magic :). However, I get sometimes user data lost. I can't
reproduce this bug with 100% probability, but it occurs sometimes. I tried
also to change @Persist(PersistenceConstants.FLASH) to default @Persist. But
it gives me behavior I don't want - it renders user data even if I refresh
the page (I want to show blank form in that case). So FLASH persistance is
what I want, but sometimes data are lost.

My code now looks like this:
---Registration.java-
public class Registration {

@Property
@Persist(PersistenceConstants.FLASH)
private User user;

@Property
@Persist(PersistenceConstants.FLASH)
private Customer customer;

@Property
private String verifyPassword;

@Inject
private CustomerService customerService;

@Inject
private UserService userService;

@Component
private Form registerForm;

@Inject
private Messages messages;

@OnEvent(value = EventConstants.SUCCESS, component = registerForm)
Object validateAndSave() {

if (errorsDetected()){
return null;
}
user.setPassword(generateHash(user.getPassword()));
customer.addUser(user);
customerService.save(customer);

// redirect with a message parameter
return Index.class;

}

private boolean errorsDetected(){
boolean errorDetected = false;
if (!verifyPassword.equals(user.getPassword())) {
registerForm.recordError(verifyPassword,
messages.get(error.verify.password));
errorDetected = true;
}

if (userService.getUserByLogin(user.getLogin()) != null) {

registerForm.recordError(messages.get(error.user.already.exists));
errorDetected = true;
}

if
(customerService.getCustomerByBusinessName(customer.getBusinessName()) !=
null) {

registerForm.recordError(messages.get(error.customer.already.exists));
errorDetected = true;
}
return errorDetected;
}
}

-Registration.tml
html t:type=layout title=Customer registration
  t:sidebarTitle=Current Time
  t:pageTitle=Register
  xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
  xmlns:p=tapestry:parameter

fieldset id=register
form class=full-form t:id=registerForm
t:errors/

fieldset
legendCustomer registration (company or private
person)/legend

t:beaneditor object=customer exclude=literal:id,users
p:businessName
t:label for=businessName/
t:textfield t:id=businessName
value=customer.businessName validate=required/
/p:businessName
p:contactPhone
t:label for=customer_contactPhone/
t:textfield t:id=customer_contactPhone
value=customer.contactPhone validate=required/
/p:contactPhone
p:contactPerson
t:label for=contactPerson/
t:textfield t:id=contactPerson
value=customer.contactPerson validate=required/
/p:contactPerson
p:businessAddress
t:label for=businessAddress/
t:textfield t:id=businessAddress
value=customer.businessAddress validate=required/
/p:businessAddress
p:email
t:label for=customer_email/
t:textfield t:id=customer_email
value=customer.email validate=email,required/
/p:email
/t:beaneditor
/fieldset

fieldset
legendPersonal registration/legend
t:beaneditor object=user exclude=literal:id,roles
add=verifyPassword


p:firstName
t:label for=firstName/
t:textfield t:id=firstName value=user.firstName
validate=required/
/p:firstName


p:middleName
t:label for=middleName/
t:textfield t:id=middleName value=user.middleName
validate=required/
/p:middleName


p:lastName
t:label for=lastName/
t:textfield t:id=lastName value=user.lastName
validate=required/
/p:lastName


p:contactPhone
t:label for=contactPhone/
t:textfield t:id=contactPhone
value=user.contactPhone validate=required/
/p:contactPhone


p:mobilePhone
t:label for=mobilePhone/
t:textfield t:id=mobilePhone value=user.mobilePhone
validate=required/
/p:mobilePhone


p:address
t:label 

Re: tynamo-security (shiro) exception

2010-10-25 Thread Anton Mezerny
Checked out Tynamo 0.3.0-Snapshot and exception is gone. Thank you.

2010/10/25 Katia Aresti katiaare...@gmail.com

 Its normal, you have to checkout Tynamo branch ;)


 2010/10/25 Anton Mezerny anton.meze...@gmail.com

  Checked out new version of Hotel booking application. There is no
  tynamo-security dependency in pom.xml at all. Am I doing something wrong?
  Anton
 
  2010/10/25 Christophe Cordenier christophe.corden...@gmail.com
 
   Hi
  
   Yes it's fixed, i have update the pom.xml to use tynamo 0.3.0-SNAPSHOT
  
   2010/10/25 Anton Mezerny anton.meze...@gmail.com
  
Hi all,
I am playing with hotel booking application and trying to use some
   examples
from it in my project. Now I have a problem in login page - when I
 try
  to
login, I got
shiro's cipher exception, like here:
https://issues.apache.org/jira/browse/SHIRO-183
Is it fixed now? How can I upgrade to fixed version of
shiro/tynamo-security?
Thanks in advance.
Anton
   
  
  
  
   --
   Regards,
   Christophe Cordenier.
  
   Committer on Apache Tapestry 5
   Co-creator of wooki @wookicentral.com
  
 



Re: Objects session persistance and validation

2010-10-25 Thread Mark Shead
Once it is submitted you may want to set the user back to null, that way you
can start fresh when the page is submitted.

The required,email and email,required things sounds odd. I'm going to see if
I can reproduce that.  What version of tapestry are you using?

Mark

On Mon, Oct 25, 2010 at 2:17 PM, Anton Mezerny anton.meze...@gmail.comwrote:

 Ok, when i changed order from validation=required,email to
 validation=email,required email validation starts to work properly. Looks
 like some magic :). However, I get sometimes user data lost. I can't
 reproduce this bug with 100% probability, but it occurs sometimes. I tried
 also to change @Persist(PersistenceConstants.FLASH) to default @Persist.
 But
 it gives me behavior I don't want - it renders user data even if I refresh
 the page (I want to show blank form in that case). So FLASH persistance is
 what I want, but sometimes data are lost.

 My code now looks like this:

 ---Registration.java-
 public class Registration {

@Property
@Persist(PersistenceConstants.FLASH)
private User user;

@Property
@Persist(PersistenceConstants.FLASH)
 private Customer customer;

@Property
private String verifyPassword;

@Inject
 private CustomerService customerService;

@Inject
private UserService userService;

@Component
private Form registerForm;

@Inject
private Messages messages;

 @OnEvent(value = EventConstants.SUCCESS, component = registerForm)
Object validateAndSave() {

if (errorsDetected()){
return null;
}
user.setPassword(generateHash(user.getPassword()));
customer.addUser(user);
customerService.save(customer);

// redirect with a message parameter
return Index.class;

}

private boolean errorsDetected(){
boolean errorDetected = false;
 if (!verifyPassword.equals(user.getPassword())) {
 registerForm.recordError(verifyPassword,
 messages.get(error.verify.password));
 errorDetected = true;
 }

if (userService.getUserByLogin(user.getLogin()) != null) {

 registerForm.recordError(messages.get(error.user.already.exists));
 errorDetected = true;
}

if
 (customerService.getCustomerByBusinessName(customer.getBusinessName()) !=
 null) {

 registerForm.recordError(messages.get(error.customer.already.exists));
errorDetected = true;
}
return errorDetected;
 }
 }


 -Registration.tml
 html t:type=layout title=Customer registration
  t:sidebarTitle=Current Time
  t:pageTitle=Register
  xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
  xmlns:p=tapestry:parameter

 fieldset id=register
form class=full-form t:id=registerForm
t:errors/

fieldset
legendCustomer registration (company or private
 person)/legend

 t:beaneditor object=customer exclude=literal:id,users
 p:businessName
t:label for=businessName/
t:textfield t:id=businessName
 value=customer.businessName validate=required/
 /p:businessName
p:contactPhone
t:label for=customer_contactPhone/
t:textfield t:id=customer_contactPhone
 value=customer.contactPhone validate=required/
 /p:contactPhone
p:contactPerson
t:label for=contactPerson/
t:textfield t:id=contactPerson
 value=customer.contactPerson validate=required/
 /p:contactPerson
p:businessAddress
t:label for=businessAddress/
t:textfield t:id=businessAddress
 value=customer.businessAddress validate=required/
 /p:businessAddress
p:email
t:label for=customer_email/
t:textfield t:id=customer_email
 value=customer.email validate=email,required/
 /p:email
/t:beaneditor
/fieldset

fieldset
legendPersonal registration/legend
t:beaneditor object=user exclude=literal:id,roles
 add=verifyPassword


p:firstName
t:label for=firstName/
t:textfield t:id=firstName value=user.firstName
 validate=required/
/p:firstName


p:middleName
t:label for=middleName/
t:textfield t:id=middleName value=user.middleName
 validate=required/
/p:middleName


p:lastName
t:label for=lastName/
t:textfield t:id=lastName value=user.lastName
 validate=required/
/p:lastName


p:contactPhone
t:label 

Re: Objects session persistance and validation

2010-10-25 Thread Anton Mezerny
I am using 5.1.0.7. Also I figured how to reproduce such a behavior - if i
fill all fields with proper values, but set not equal passwords - all data
is lost, but if I set invalid email and proper passwords - everything works
fine.

P.S. There is one error in previous code - in recordErrors() method shoud
be:

registerForm.recordError(messages.get(error.verify.password));
instead of
registerForm.recordError(verifyPassword,
messages.get(error.verify.password));

2010/10/25 Mark Shead mark.sh...@xeric.net

 Once it is submitted you may want to set the user back to null, that way
 you
 can start fresh when the page is submitted.

 The required,email and email,required things sounds odd. I'm going to see
 if
 I can reproduce that.  What version of tapestry are you using?

 Mark

 On Mon, Oct 25, 2010 at 2:17 PM, Anton Mezerny anton.meze...@gmail.com
 wrote:

  Ok, when i changed order from validation=required,email to
  validation=email,required email validation starts to work properly.
 Looks
  like some magic :). However, I get sometimes user data lost. I can't
  reproduce this bug with 100% probability, but it occurs sometimes. I
 tried
  also to change @Persist(PersistenceConstants.FLASH) to default @Persist.
  But
  it gives me behavior I don't want - it renders user data even if I
 refresh
  the page (I want to show blank form in that case). So FLASH persistance
 is
  what I want, but sometimes data are lost.
 
  My code now looks like this:
 
 
 ---Registration.java-
  public class Registration {
 
 @Property
 @Persist(PersistenceConstants.FLASH)
 private User user;
 
 @Property
 @Persist(PersistenceConstants.FLASH)
  private Customer customer;
 
 @Property
 private String verifyPassword;
 
 @Inject
  private CustomerService customerService;
 
 @Inject
 private UserService userService;
 
 @Component
 private Form registerForm;
 
 @Inject
 private Messages messages;
 
  @OnEvent(value = EventConstants.SUCCESS, component = registerForm)
 Object validateAndSave() {
 
 if (errorsDetected()){
 return null;
 }
 user.setPassword(generateHash(user.getPassword()));
 customer.addUser(user);
 customerService.save(customer);
 
 // redirect with a message parameter
 return Index.class;
 
 }
 
 private boolean errorsDetected(){
 boolean errorDetected = false;
  if (!verifyPassword.equals(user.getPassword())) {
  registerForm.recordError(verifyPassword,
  messages.get(error.verify.password));
  errorDetected = true;
  }
 
 if (userService.getUserByLogin(user.getLogin()) != null) {
 
  registerForm.recordError(messages.get(error.user.already.exists));
  errorDetected = true;
 }
 
 if
  (customerService.getCustomerByBusinessName(customer.getBusinessName()) !=
  null) {
 
  registerForm.recordError(messages.get(error.customer.already.exists));
 errorDetected = true;
 }
 return errorDetected;
  }
  }
 
 
 
 -Registration.tml
  html t:type=layout title=Customer registration
   t:sidebarTitle=Current Time
   t:pageTitle=Register
   xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
   xmlns:p=tapestry:parameter
 
  fieldset id=register
 form class=full-form t:id=registerForm
 t:errors/
 
 fieldset
 legendCustomer registration (company or private
  person)/legend
 
  t:beaneditor object=customer exclude=literal:id,users
  p:businessName
 t:label for=businessName/
 t:textfield t:id=businessName
  value=customer.businessName validate=required/
  /p:businessName
 p:contactPhone
 t:label for=customer_contactPhone/
 t:textfield t:id=customer_contactPhone
  value=customer.contactPhone validate=required/
  /p:contactPhone
 p:contactPerson
 t:label for=contactPerson/
 t:textfield t:id=contactPerson
  value=customer.contactPerson validate=required/
  /p:contactPerson
 p:businessAddress
 t:label for=businessAddress/
 t:textfield t:id=businessAddress
  value=customer.businessAddress validate=required/
  /p:businessAddress
 p:email
 t:label for=customer_email/
 t:textfield t:id=customer_email
  value=customer.email validate=email,required/
  /p:email
 /t:beaneditor
 /fieldset
 
 fieldset
 legendPersonal registration/legend
 t:beaneditor object=user exclude=literal:id,roles
 

Using T5 and T3 side by side

2010-10-25 Thread Andreas Bohnert

Hi!

We have started to port a fairly big tapestry3 application to tapestry5. 
It works very well, however it will take a while to complete the whole code.
Are there any known issues/pitfalls if we run tapestry 3 and 5 code side 
by side?


We don't want to login twice, so what is the recommended way to share 
the session?


Thanks for your help,
Andreas

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



Re: tapestry-resteasy NPE when trying to access session

2010-10-25 Thread Josh Canfield
 ?? I don't understand your question. I beleive that tapestry-resteasy does 
 this for me.
Hm. RESTEasy is a jboss project, I assumed you were rolling your own
tapestry integration since you didn't mention anything about using a
third party library for doing that integration.

 Could it be that since the tapestry-resteasy HttpServletRequestHandler is 
 placed before:GZIP, tapestry has not yet initialized its RequestGlobals and 
 thus the session information is not yet available where reasteasy handles its 
 service methods?

I don't use tynamo so I don't know what they are doing, but I'd guess
that something like you've suggested is the culprit.

Josh


On Mon, Oct 25, 2010 at 12:15 PM, Moritz Gmelin moritz.gme...@gmx.de wrote:
 ?? I don't understand your question. I beleive that tapestry-resteasy does 
 this for me.

 Could it be that since the tapestry-resteasy HttpServletRequestHandler is 
 placed before:GZIP, tapestry has not yet initialized its RequestGlobals and 
 thus the session information is not yet available where reasteasy handles its 
 service methods?

 M.


 Am 25.10.2010 um 18:30 schrieb Josh Canfield:

 I'd like to get access to the current session from inside my resteasy 
 handler methods.
 How are you creating your resteasy handler?

 On Mon, Oct 25, 2010 at 3:06 AM, Moritz Gmelin moritz.gme...@gmx.de wrote:
 Hi,

 I'd like to get access to the current session from inside my resteasy 
 handler methods. But when I inject the request and call getSession() on it, 
 I get a NullPointerException.
 My original goal was to get access to SessionState objects from tapestry by 
 calling the ApplicationStateManager.get() method with our SessionState 
 object. But this fails for the same reason.
 Why is the session object not accessible from the injected Request object 
 in a ResteasyHandler?

 The code below will throw an exception on the line 
 request.getSession(false).

 @Path(/resttest)
 public class TestResource
 {

       �...@inject
        private Request request;

       �...@inject
        private ApplicationStateManager asm;

       �...@injectresource
        private Logger log;


       �...@get
       �...@produces(text/xml)
        public ListTestEntity getEntityList()
        {

                log.warn(REST Request in request  + request);
                log.warn(REST Request in session2  + 
 request.getSession(false));


 M.




 -
 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



Maven Issues

2010-10-25 Thread Norman Franke
I had a working Tapestry 5.1 project. I restarted Eclipse, and now  
Maven won't include the tapestry JARs when running my app using the  
jetty plugin. Everything compiles fine, but running it leads to a  
class not found for org.apache.tapestry5.TapestryFilter. I'm running  
it in Tomcat from Eclipse. My old Tapestry 4 app works (non-Maven).


Exporting the app to a .WAR file fails to include any maven  
dependency. Any ideas on what could have happened? I've tried updating  
dependencies, purging the .m2 cache of tapestry JARs, and clearing the  
tomcat directory. No difference. How can it compile and not run? It's  
compiling from the Maven dependencies.


I haven't edited my pom.xml in like a year. I also have plenty of disk  
space (100GB). I'm rather baffled.


Norman Franke
Answering Service for Directors, Inc.
www.myasd.com





Re: Maven Issues

2010-10-25 Thread Norman Franke

Here is my pom.xml:

project
	xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd 

	xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://maven.apache.org/POM/4.0.0 


modelVersion4.0.0/modelVersion
groupIdcom.myasd/groupId
artifactIdsales/artifactId
version0.0.1-SNAPSHOT/version
packagingwar/packaging
namesales Tapestry 5 Application/name
dependencies
dependency
groupIdorg.testng/groupId
artifactIdtestng/artifactId
version5.8/version
classifierjdk15/classifier
scopetest/scope
/dependency
dependency
groupIdorg.easymock/groupId
artifactIdeasymock/artifactId
version2.4/version
scopetest/scope
/dependency
dependency
groupIdjavax.servlet/groupId
artifactIdservlet-api/artifactId
version2.5/version
scopeprovided/scope
/dependency
dependency
groupIdorg.apache.tapestry/groupId
artifactIdtapestry-hibernate/artifactId
version5.1.0.5/version
/dependency
dependency
groupIdnu.localhost.tapestry/groupId
artifactIdtapestry-spring-security/artifactId
version2.1.0/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring/artifactId
version2.5.6.SEC01/version
/dependency
dependency
groupIdlog4j/groupId
artifactIdlog4j/artifactId
version1.2.14/version
/dependency
dependency
groupIdhsqldb/groupId
artifactIdhsqldb/artifactId
version1.8.0.7/version
/dependency
dependency
groupIdspring/groupId
artifactIdspring-webmvc/artifactId
version1.0.2/version
/dependency
dependency
groupIdspring/groupId
artifactIdspring-web/artifactId
version1.0.2/version
/dependency
dependency
groupIdorg.apache.tapestry/groupId
artifactIdtapestry-core/artifactId
version5.1.0.5/version
/dependency
dependency
groupIdcommons-configuration/groupId
artifactIdcommons-configuration/artifactId
version1.6/version
/dependency
dependency
groupIdognl/groupId
artifactIdognl/artifactId
version2.7.3/version
/dependency
dependency
groupIdorg.hibernate/groupId
artifactIdhibernate-tools/artifactId
version3.2.3.GA/version
/dependency
dependency
groupIdjoda-time/groupId
artifactIdjoda-time/artifactId
version1.6/version
/dependency

/dependencies
build
finalNamesales/finalName
plugins
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
configuration
source1.5/source
target1.5/target
optimizetrue/optimize
/configuration
/plugin

!-- Run the application using mvn jetty:run --
plugin
groupIdorg.mortbay.jetty/groupId
artifactIdmaven-jetty-plugin/artifactId
version6.1.9/version
configuration
!-- Log to the console. --
requestLog 
implementation=org.mortbay.jetty.NCSARequestLog
!--
This doesn't 

Re: Maven Issues

2010-10-25 Thread Mark
You might try changing the version of tapestry (maybe to 5.1.0.4) and see if
it magically starts working.  It also might be worth trying to rename the
whole .m2 directory and letting Maven create a new one to see if that helps.

Also try running maven clean.

I'm not sure if any of those will help, but they are worth a try.

mark

On Mon, Oct 25, 2010 at 6:32 PM, Norman Franke nor...@myasd.com wrote:

 I had a working Tapestry 5.1 project. I restarted Eclipse, and now Maven
 won't include the tapestry JARs when running my app using the jetty plugin.
 Everything compiles fine, but running it leads to a class not found for
 org.apache.tapestry5.TapestryFilter. I'm running it in Tomcat from Eclipse.
 My old Tapestry 4 app works (non-Maven).

 Exporting the app to a .WAR file fails to include any maven dependency. Any
 ideas on what could have happened? I've tried updating dependencies, purging
 the .m2 cache of tapestry JARs, and clearing the tomcat directory. No
 difference. How can it compile and not run? It's compiling from the Maven
 dependencies.

 I haven't edited my pom.xml in like a year. I also have plenty of disk
 space (100GB). I'm rather baffled.

 Norman Franke
 Answering Service for Directors, Inc.
 www.myasd.com






Re: Using T5 and T3 side by side

2010-10-25 Thread Robert Zeigler
I also had a reasonably large T3 application that I considered porting to T5.  
I wound up adding some new functionality via T5 and running them side-by-side 
without issues.  Since T5 is a servlet filter and T3 is a servlet, they 
actually play(ed) quite nicely together. But. That was with an early 5.0 
release (5.0.13-SNAPSHOT).  Later versions of T5 got a bit greedier about url 
matching, to where any url that looks like /app/* (assuming defaults here) will 
match the index page, if nothing else, unless you explicitly add paths to be 
excluding by T5 processing.  You might be able to play around with using 
different paths for the T5 vs. T3 code, or else you'll need to contribute the 
urls that map to your T3 app to T5's list of urls to ignore/pass through.  

For login, I'm not sure what the recommended way is, but what I did was to 
create a service that mapped from the T3 session-stored values values of 
interest in T5, where values of interest were things like the current user, 
whether the user was authenticated, and so forth.  Basically, it gave me easy 
access to my T3 visit and global objects (as well as the custom Engine that 
the T3 app used).  For me, that worked well.  The trick was mapping the session 
value as required.  So that turned out to be pretty straightforward. T3's 
ApplicationServlet.java stores the engine in the session under the following 
key:

org.apache.tapestry.engine:servletname

And you can, of course, get your visit from the engine.


And the global is at:

org.apache.tapestry.global:servletname

in the ServletContext.

So you can inject the context and the session into your Bridge service and 
then grab the objects from there.
You'll have to duplicate a bit of logic from T3 in that your Bridge service 
needs to check for the existence of the objects, create as required, and stash 
the objects back into the session/servlet context if necessary.

Good luck!

Robert



On Oct 25, 2010, at 10/252:32 PM , Andreas Bohnert wrote:

 Hi!
 
 We have started to port a fairly big tapestry3 application to tapestry5. It 
 works very well, however it will take a while to complete the whole code.
 Are there any known issues/pitfalls if we run tapestry 3 and 5 code side by 
 side?
 
 We don't want to login twice, so what is the recommended way to share the 
 session?
 
 Thanks for your help,
 Andreas
 
 -
 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