Re: Advisin Tapestry Session

2012-09-24 Thread Lance Java
As bobharner said, there is a non-tapestry way of doing this with a
HttpSessionListener (although I would synchronize his solution to make it
thread-safe).

Another option is to override / decorate the TapestrySessionFactory [1] to
return a Session instance with the hooks that you want.

[1]
http://tapestry.apache.org/5.3.5/apidocs/org/apache/tapestry5/internal/services/TapestrySessionFactory.html





--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Advisin-Tapestry-Session-tp5716457p5716464.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



Tapestry-Security : Filter settings

2012-09-24 Thread indiancomet
Hi,
I am trying to use Shiro via tapestry-security. It has been a hits-n-misses
so far. 
Nevertheless, it has been a good learning experience.
However, I have run into one specific case with filters which i thought
would post here for insight.

When i use the following filter:
code
configuration.add(factory.createChain(/**).add(factory.authc()).build());
/code

I get stuck in a loop on the login form.

However, if i add page specific filters like:
code
configuration.add(factory.createChain(/page1).add(factory.authc()).build());
/code

and then try to access page1, i get the login form. On putting correct login
values i am taken to page1.

Can someone explain this behaviour?




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Tapestry-Security-Filter-settings-tp5716466.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: Tapestry-Security : Filter settings

2012-09-24 Thread Alex Kotchnev
The problem w/ the wildcard statement is that when Shiro tries to redirect
it to the login page, the login page ends up requiring authentication
(because it matches the /* wildcard pattern), etc. In order to make it do
what you want, you'll need to allow the login page to be accessed w/o
authentication (which makes sense) before you declare the filter for /*,
e.g.

code
configuration.add(factory.createChain(/login).add(factory.anon()).build());
configuration.add(factory.createChain(/**).add(factory.authc()).build());
/code

Cheers,

Alex K

On Mon, Sep 24, 2012 at 6:20 AM, indiancomet fauj...@gmail.com wrote:

 Hi,
 I am trying to use Shiro via tapestry-security. It has been a hits-n-misses
 so far.
 Nevertheless, it has been a good learning experience.
 However, I have run into one specific case with filters which i thought
 would post here for insight.

 When i use the following filter:
 code
 configuration.add(factory.createChain(/**).add(factory.authc()).build());
 /code

 I get stuck in a loop on the login form.

 However, if i add page specific filters like:
 code

 configuration.add(factory.createChain(/page1).add(factory.authc()).build());
 /code

 and then try to access page1, i get the login form. On putting correct
 login
 values i am taken to page1.

 Can someone explain this behaviour?




 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/Tapestry-Security-Filter-settings-tp5716466.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: Tapestry-Security : Filter settings

2012-09-24 Thread Kalle Korhonen
It's a well known gotcha but nothing we can or plan to do about except
to improve documentation. Also note that the order in which the rules
are contributed is significant.

Kalle


On Mon, Sep 24, 2012 at 9:11 AM, Alex Kotchnev akoch...@gmail.com wrote:
 The problem w/ the wildcard statement is that when Shiro tries to redirect
 it to the login page, the login page ends up requiring authentication
 (because it matches the /* wildcard pattern), etc. In order to make it do
 what you want, you'll need to allow the login page to be accessed w/o
 authentication (which makes sense) before you declare the filter for /*,
 e.g.

 code
 configuration.add(factory.createChain(/login).add(factory.anon()).build());
 configuration.add(factory.createChain(/**).add(factory.authc()).build());
 /code

 Cheers,

 Alex K

 On Mon, Sep 24, 2012 at 6:20 AM, indiancomet fauj...@gmail.com wrote:

 Hi,
 I am trying to use Shiro via tapestry-security. It has been a hits-n-misses
 so far.
 Nevertheless, it has been a good learning experience.
 However, I have run into one specific case with filters which i thought
 would post here for insight.

 When i use the following filter:
 code
 configuration.add(factory.createChain(/**).add(factory.authc()).build());
 /code

 I get stuck in a loop on the login form.

 However, if i add page specific filters like:
 code

 configuration.add(factory.createChain(/page1).add(factory.authc()).build());
 /code

 and then try to access page1, i get the login form. On putting correct
 login
 values i am taken to page1.

 Can someone explain this behaviour?




 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/Tapestry-Security-Filter-settings-tp5716466.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



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



Validate form field in component class from page class

2012-09-24 Thread George Christman
Hello

I have a component called program that is called from my page template
called purchaseRequest. Within program, I have a field called evaluators and
within the component class I'm @InjectComponent evaluators. I'm trying to do
some field validations on evaluators from within my page validation method.
However I'm not sure how pass the fields around. I tried passing my form
component into my program component and validating using void
onValidateFromEvaluators() however the field value is null even though it's
been populated within the template. Does anybody know how to do this. 

Example

Program.tml
t:TextField t:id=evaluators value=pr.evaluators

Program.class

@Parameter
@Property
private PurchaseRequest pr;

@InjectComponent
@Property
private Field evaluators;


PurcahseRequest.tml

t:Form t:id=PR
t:Program  pr=pr/
/t:Form

PurcahseRequest.class

@Component(id = PR)
@Property
private Form form;   

Object onValidateFromPr() {

for(PrEvaluator evaluator : this.pr.getPrEvaluators()) {
if (evaluator.getEvaluator() != null) {
if(evaluatorUsers.contains(evaluator.getEvaluator())) {

//I can not set this.evaluators field because it's not
contained within the page.
this.form.recordError(this.evaluators, Evaluator(s)
must be unique.);
} 
}
}
}



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Validate-form-field-in-component-class-from-page-class-tp5716469.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: Validate form field in component class from page class

2012-09-24 Thread Thiago H de Paula Figueiredo
On Mon, 24 Sep 2012 14:29:02 -0300, George Christman  
gchrist...@cardaddy.com wrote:



Hi Thiago, I'm not completely following you here. What do you mean by
trigger an event passing to the page?


Something like this (not tested):

@Inject
private ComponentResources resources;

...

resources.triggerEvent(validate, valueToBeValidated, null);


I have all the in formation in the
PurchaseRequest class to do the validation, just no way to mark the field
as having an error with the red border.


So pass the Field itself in the second parameter of triggerEvent().

--
Thiago H. de Paula Figueiredo

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



Re: [T5] Select, palette, multiselect

2012-09-24 Thread nkv1
Martin Grotzke wrote
 On Fri, 2007-07-27 at 17:37 -0300, Thiago H de Paula Figueiredo wrote:
 And has anyone implemented a Select-like component for multiple option  
 selection? It would be very nice to have both multiselect and palette, as  
 T4 has.
 Take a look at this thread, it's really easy to implement multiselect
 with T5:
 http://www.nabble.com/T5%3A-select-component-with-support-for-attribute-%22multiple%22-tf3880056.html#a10996038
 
 Cheers,
 Martin
 
 
 
 Thiago
 
 -
 To unsubscribe, e-mail: 

 users-unsubscribe@.apache

 For additional commands, e-mail: 

 users-help@.apache

 
 
 
 signature.asc (196 bytes)
 lt;http://tapestry.1045711.n5.nabble.com/attachment/2408345/0/signature.ascgt;

link no longer exists



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Select-palette-multiselect-tp2408343p5716472.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



Palette with GenericValueEncoder, GenericMultipleSelectModel

2012-09-24 Thread nkv1
/I am trying to make a palette with using http://chenillekit.codehaus.org/
generics with database entity objects.
This i my page template/
t:layout t:pageTitle=${message:title}
  xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
  xmlns:tx=tapestry-library:tapx
  section
header
  
Detalji o studentu

/header
article 
  t:if test=about
t:beandisplay object=about/
  /t:if
  t:if negate=true test=about
Entitet ${about} does not exist.
br/
br/
  /t:if
/article
header
  
Lista Grupa

/header
t:zone t:id=lista
  t:form t:id=form
  t:Palette t:model=grupaModels
t:selected=paletteSelectedValues t:encoder=grupaEncoder/
t:submit t:id=submit value=message:update/
  /t:form
/t:zone
footer
  t:pagelink page=PageAddStudent
${message:back}
  /t:pagelink
/footer
  /section
/t:layout

/And this is my page class/

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package projekat.pages;

import java.util.ArrayList;
import java.util.List;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.chenillekit.tapestry.core.encoders.GenericValueEncoder;
import org.chenillekit.tapestry.core.models.GenericMultipleSelectModel;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import projekat.entities.Grupa;
import projekat.entities.Korisnik;
import projekat.entities.Student;
import projekat.services.ProtectedPage;

@ProtectedPage
public class PageDetailStudent {

  /**
   * Student
   */
  @Persist
  @Property
  private Student about;
  /**
   * Groups
   */
  @Persist
  @Property
  private Grupa isIn;
  /**
   * List of Groups
   */
  @Persist
  private ListGrupa isInList;
  /**
   * database session
   */
  @Inject
  private Session hibernate;
  /**
   * zone
   */
  @InjectComponent
  private Zone lista;
  /**
   * user
   */
  @SessionState
  @Property
  private Korisnik asoKorisnik;
  /**
   * userexistance
   */
  @Property
  private boolean asoKorisnikExists;
  //editing start
 
/**http://chenillekit.codehaus.org/chenillekit-tapestry/apidocs/org/chenillekit/tapestry/core/encoders/GenericValueEncoder.html*/
  @Persist
  private GenericValueEncoderGrupa grupaEncoder = new
GenericValueEncoderGrupa(isInList, null, null);
 
/**http://chenillekit.codehaus.org/chenillekit-tapestry/apidocs/org/chenillekit/tapestry/core/models/GenericMultipleSelectModel.html*/
  @Persist
  private GenericMultipleSelectModelGrupa grupaModels = new
GenericMultipleSelectModelGrupa(isInList, null, null, null, null);
  /**
   * list of selected values from palette
   */
  @Property
  @Persist
  private ListGrupa paletteSelectedValues;

  void setupRender() {

if (paletteSelectedValues == null) {
  paletteSelectedValues = new ArrayListGrupa();
}
  }
  //editing end

  /**
   * on page activation get student from database
   * with id
   */
  void onActivate(long kljuc) {
this.about = (Student)
hibernate.createCriteria(Student.class).add(Restrictions.eq(kljuc,
kljuc)).uniqueResult();
  }

  /**
   * list all groups from database
   *
   * @return
   */
  public ListGrupa getIsInList() {
return (ListGrupa) hibernate.createCriteria(Grupa.class).list();
  }

  /**
   * add selected groups to student and saves to database
   *
   * @return
   */
  public Object onActionFromSubmit() {
about.getGrupaList().addAll(paletteSelectedValues);
hibernate.persist(about);
return lista;
  }
}

/So my main problem with what to fill null values on class page/



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Palette-with-GenericValueEncoder-GenericMultipleSelectModel-tp5716473.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