Hello, 

I've a xhtml page using a session bean to acces my entities. When I trying to 
access some entities, sometimes, for some entities, I need to be identified ...

When I throw a NotLoggedInException, I get an error on the page. Why is'nt that 
exception caught by seam, to force a redirection to login.xhtml ?

I can't use @Restrict, because I need to execute the method and query the 
entity to know if it is restricted.


  | @Unwrap
  |     public Wedding getWedding() {
  |             if (wedding != null && wedding.getSiteName().equals(name))
  |                     return wedding;
  |             try{
  |                     wedding = (Wedding)em
  |                             .createQuery("from Wedding where siteName like 
:name")
  |                             .setParameter("name", name)
  |                             .getSingleResult();
  |                     
  |                     if (wedding.getIsPrivate()){
  |                             if (currentUser == null || 
  |                                     !currentUser.isAllowedToView(wedding))  
{
  |                                     log.info("must be loggued");
  |                                     throw new 
org.jboss.seam.security.NotLoggedInException();
  |                             }
  |                     }
  |                     
  |                     return wedding;
  |             }
  |             catch (NoResultException e) {
  |                     log.info("no existing wedding");
  |             }
  |             return null;
  |     }
  | 

Is my code/question stupide ?

Thx
Vincent

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128762#4128762

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128762
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to