Re: Wicket 6 Session issue

2014-11-06 Thread Wayne W
Hi Martin,

I think this might have solved it . Many thanks :-)

On Wed, Nov 5, 2014 at 1:49 PM, Martin Grigorov mgrigo...@apache.org
wrote:

 Thanks ! It is more clear now !


 On Wed, Nov 5, 2014 at 3:44 PM, Wayne W waynemailingli...@gmail.com
 wrote:

  Sorry Martin its not clear enough. This any better?
 
 
 1. Tomcat1 / Session A / Thread 1: User goes to :
 my.example.com/login
  (LoginPage.java)
 2. Tomcat1 / Session A / Thread 2: They log in
 3. Tomcat 1 / Session A / Thread 2 : We invalidate the session and do
 a
 redirect to : foo.example.com/login passing some parameters
 4. Tomcat 2 / Session B / Thread 1: In the constructor of LoginPage we
 verify the parameters and if valid setup up the new current session
 with
 the user's details (Session.setUser(user))
 5. Tomcat 2/ Session B / Thread 1: LoginPage then does
 a setResponsePage(Application.get().getHomePage());
 

 try by adding getSession().bind(); at step 5


 6. Tomcat 2/Session B / Thread
 1:  MetaDataRoleAuthorizationStrategy.isInstantiationAuthorized()
 finds
 null in the Session (Session.getUser() )
 
 
 
 
  On Wed, Nov 5, 2014 at 11:22 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   Then your first mail misleads.
   Would you please explain again the steps with more details which step
 on
   which node happens.
  
   Martin Grigorov
   Wicket Training and Consulting
   https://twitter.com/mtgrigorov
  
   On Wed, Nov 5, 2014 at 1:01 PM, Wayne W waynemailingli...@gmail.com
   wrote:
  
Hi Martin,
   
I don't think this is anything to do with session replication, as we
invalidate the session at step 3 and its not about trying to pick the
session up on a different instance. Its about creating a new session
   from a
redirect where the issue seems. We do use sticky session load
 balancing
   via
the JSESSION cookie on apache.
   
   
   
On Wed, Nov 5, 2014 at 10:56 AM, Martin Grigorov 
 mgrigo...@apache.org
  
wrote:
   
 Hi,

 As far as I know the session replication supporting code is the
 same
since
 Wicket 1.4.1 (or 1.4.2).

 The Wicket Session object is saved as an attribute in the
  HttpSession.
The
 HttpSession is replicated by Tomcat itself. What is your Tomcat
  config
 related to replication ?
 Do you use sticky sessions ? It seems you don't but I have to ask.

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Wed, Nov 5, 2014 at 12:43 PM, Wayne W 
  waynemailingli...@gmail.com
 wrote:

  Hi,
 
  we recently migrated to 6.17 from 4.x. Something we are now
experiencing
 is
  an odd session problem in production.
 
  We have 2 tomcats load balance running the front end wicket code.
  We
 have a
  certain flow that goes like this:
 
 
 1. User goes to : my.example.com/login (LoginPage.java)
 2. They log in
 3. We invalidate the session and do a redirect to :
  foo.example.com/login
 passing some parameters
 4. In the constructor of LoginPage we verify the parameters
 and
  if
 valid
 setup up the new current session with the user's details
 5. LoginPage then does
 a setResponsePage(Application.get().getHomePage());
 
  This on a single node/machine/instance of tomcat works great and
  with
  Wicket 4 it also worked great in a 2 node/instance load balanced
 situation
  however we have a problem.
 
  Problem:
  If at step 3 the redirect gets load balances to a different
  instance
   of
  tomcat, step 4 works fine (the request is read the the new
 session
  is
got
  and the user info set on it). But this is when it gets really
 odd.
Step 5
  is executed fine, but when the home page is constructed
  our MetaDataRoleAuthorizationStrategy.isInstantiationAuthorized()
  is
  called as normal, and when we check the session to see if the
 users
 details
  are ok, there is no user in the session at all and we have a
   different
  session !
 
  Any ideas at all what is happening here? Did something change
  around
the
  session handling? I'm wondering if its something to do with the
 302
  redirect to the new URL with parameters?
 
  many thanks
 

   
  
 



ResourceModel with default *key*

2014-11-06 Thread Guillaume Smet
Hi all,

Maybe we are missing something but we haven't found an elegant way to
have a ResourceModel with a default *key* if the current key doesn't
exist.

There is a mechanism for a default *string* but it's not sufficient
for us (we want to be able to specialize the key if needed but have an
internationalized default if not).

Suggestions welcome!

Thanks.

-- 
Guillaume

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



Re: ResourceModel with default *key*

2014-11-06 Thread Tom Götz
You could try something like this: 
https://gist.github.com/tgoetz/0735b05d47b16acf2fd7 
https://gist.github.com/tgoetz/0735b05d47b16acf2fd7

Cheers,
   -Tom


 On 06.11.2014, at 11:53, Guillaume Smet guillaume.s...@gmail.com wrote:
 
 Hi all,
 
 Maybe we are missing something but we haven't found an elegant way to
 have a ResourceModel with a default *key* if the current key doesn't
 exist.
 
 There is a mechanism for a default *string* but it's not sufficient
 for us (we want to be able to specialize the key if needed but have an
 internationalized default if not).
 
 Suggestions welcome!
 
 Thanks.
 
 -- 
 Guillaume



Re: How to use CSVDataExporter

2014-11-06 Thread suvojit168
Francois Meillet wrote
 try
 Listlt;IExportableColumnlt;AffiliateModel, ?gt; columns = new
 ArrayListlt;IExportableColumnlt;AffiliateModel, ?gt;();

Hi François,

Thanks for reply. I am using wicket 6.16. As per this  Link
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/data/table/export/IExportableColumn.html
   
we have,

Interface IExportableColumnT,S,D

Type Parameters:
T - The type of each row in the table.
S - The type of the sort property of the table.
D - The type of the data displayed by this column.

When I try : 
ListIExportableColumnlt;AffiliateModel, ? columns = new
ArrayListIExportableColumnlt;AffiliateModel, ?(); 

I  get compile time error Incorrect number of arguments for type
IExportableColumnT,S,D; it cannot be parameterized with arguments
AffiliateModel, ?.

Nonetheless, this works :
ListIExportableColumnlt;AffiliateModel, ?, ? columns = new
ArrayListIExportableColumnlt;AffiliateModel, ?, ?();

I am getting a null pointer exception inside exportData (...) now which I am
looking at. Will add reply if I need assistance.

PS: It will be great if you can share some
examples/tutorials/articals/anything on CSVDataExporter ( I am not very much
comfortable with CSVDataExporter as of now).


Thanks,
Suvojit

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-use-CSVDataExporter-tp4668270p4668280.html
Sent from the Users forum mailing list archive at Nabble.com.

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



AjaxFormChoiceComponentUpdatingBehavior for custom CheckGroup and CheckGroupSelector

2014-11-06 Thread lucast
Dear Forum,

Based on wicket examples, I built a custom CheckGroup with added
CheckGroupSelector.
I also want to add an AjaxFormChoiceComponentUpdatingBehavior() instance to
the CheckGroup to update the items selected. And this is where the problem
lies.

I have extended CheckGroup class to make use of  ICheck jquery plugin
http://fronteed.com/iCheck/  .

Because CheckGroupSelector is  JavaScript sugar according to a previous
post
http://apache-wicket.1842946.n4.nabble.com/Wicket-FormTester-not-working-with-CheckGroupSelector-tp4668206p4668217.html
  
(thanks for the reply, Andrea), I had to replace CheckGroupSelector and
AbstractSelector class. For the custom AbstractSelector class, I replaced
the CheckSelector.js to make use of the ICheck functions,
$('#'+checkbox.id).iCheck('check'), $('#'+checkbox.id).iCheck('uncheck'),
etc.

The problem that I have now is that AjaxFormChoiceComponentUpdatingBehavior
no longer picks the click event from the checkboxes.
In order to resolve this problem, I am propagating the click event from
inside  CheckSelector.js  using javascript code from  this stackoverflow
answer http://stackoverflow.com/a/2381862/158499  . But this still doesn't
solve the problem.

My question is, how can I get AjaxFormChoiceComponentUpdatingBehavior to
pick up any event when I select/unselect any checkboxes from the custom
Icheck solution?

Failing that, how can I best create my own implementation of
AjaxFormChoiceComponentUpdatingBehavior to know when a checkbox has been
clicked?

Sorry for the long post.

Thanks,
Lucas



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxFormChoiceComponentUpdatingBehavior-for-custom-CheckGroup-and-CheckGroupSelector-tp4668281.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: ResourceModel with default *key*

2014-11-06 Thread Guillaume Smet
Hi Tom,

Thanks for your suggestion!

That's the kind of thing I had in mind if we haven't missed anything
in the API but I was hoping we have missed something as it seems
generally useful!

On Thu, Nov 6, 2014 at 12:49 PM, Tom Götz t...@decoded.de wrote:
 You could try something like this: 
 https://gist.github.com/tgoetz/0735b05d47b16acf2fd7 
 https://gist.github.com/tgoetz/0735b05d47b16acf2fd7

 Cheers,
-Tom


 On 06.11.2014, at 11:53, Guillaume Smet guillaume.s...@gmail.com wrote:

 Hi all,

 Maybe we are missing something but we haven't found an elegant way to
 have a ResourceModel with a default *key* if the current key doesn't
 exist.

 There is a mechanism for a default *string* but it's not sufficient
 for us (we want to be able to specialize the key if needed but have an
 internationalized default if not).

 Suggestions welcome!

 Thanks.

 --
 Guillaume


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



Re: How to use CSVDataExporter

2014-11-06 Thread Francois Meillet
Hi Suvojit,

I don't know CSVDataExporter but I noticed that the second bounded type 
parameter was a 
wildcard and not a defined type.

I use Wicket 7 where there are only 2 parameters.

See some examples:
http://www.7thweb.net/wicket-jquery-ui/kendo/datatable/CommandsDataTablePage;jsessionid=2926A68F12DAE4CAC910C18699676209?0
https://doc.codelutin.com/cantharella/xref/nc/ird/cantharella/web/utils/data/TableExportToolbar.html


François


François Meillet
Formation Wicket - Développement Wicket





Le 6 nov. 2014 à 13:07, suvojit168 suvojit...@gmail.com a écrit :

 Francois Meillet wrote
 try
 Listlt;IExportableColumnlt;AffiliateModel, ?gt; columns = new
 ArrayListlt;IExportableColumnlt;AffiliateModel, ?gt;();
 
 Hi François,
 
 Thanks for reply. I am using wicket 6.16. As per this  Link
 http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/data/table/export/IExportableColumn.html

 we have,
 
 Interface IExportableColumnT,S,D
 
 Type Parameters:
 T - The type of each row in the table.
 S - The type of the sort property of the table.
 D - The type of the data displayed by this column.
 
 When I try : 
 ListIExportableColumnlt;AffiliateModel, ? columns = new
 ArrayListIExportableColumnlt;AffiliateModel, ?(); 
 
 I  get compile time error Incorrect number of arguments for type
 IExportableColumnT,S,D; it cannot be parameterized with arguments
 AffiliateModel, ?.
 
 Nonetheless, this works :
 ListIExportableColumnlt;AffiliateModel, ?, ? columns = new
 ArrayListIExportableColumnlt;AffiliateModel, ?, ?();
 
 I am getting a null pointer exception inside exportData (...) now which I am
 looking at. Will add reply if I need assistance.
 
 PS: It will be great if you can share some
 examples/tutorials/articals/anything on CSVDataExporter ( I am not very much
 comfortable with CSVDataExporter as of now).
 
 
 Thanks,
 Suvojit
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/How-to-use-CSVDataExporter-tp4668270p4668280.html
 Sent from the Users forum mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 



Re: How to use CSVDataExporter

2014-11-06 Thread Sebastien
Hi François, Suvojit

Actually the Wicket Kendo UI's DataTable (first example) is using a custom
CSVDataExporter (largely inspired - not to say copy/paste - from the
original). But it can still itself be used for inspiration...

Source:
https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-kendo-ui/src/main/java/com/googlecode/wicket/kendo/ui/datatable/export/CSVDataExporter.java

Best regards,
Sebastien



On Thu, Nov 6, 2014 at 2:37 PM, Francois Meillet francois.meil...@gmail.com
 wrote:

 Hi Suvojit,

 I don't know CSVDataExporter but I noticed that the second bounded type
 parameter was a
 wildcard and not a defined type.

 I use Wicket 7 where there are only 2 parameters.

 See some examples:

 http://www.7thweb.net/wicket-jquery-ui/kendo/datatable/CommandsDataTablePage;jsessionid=2926A68F12DAE4CAC910C18699676209?0

 https://doc.codelutin.com/cantharella/xref/nc/ird/cantharella/web/utils/data/TableExportToolbar.html


 François


 François Meillet
 Formation Wicket - Développement Wicket



PropertyModel / PropertyResolver / Map or List access

2014-11-06 Thread Patrick Davids
Hi all,

the javadoc of PropertyResolver says, map or list access is possible via 
keys or index.
Accessing an map via key is no problem, but I dont get it working for 
lists and index.

for instance:

MyPage extends Page{

   private IModelListAnything list;

   public MyPage(IModelListAnything list){
 super();
 this.list = list;

add(new Label(mylabel, new PropertyModel(MyPage.this, 
list[1].anyProperty)));

   }

}

ends up in a Exception like this:
Last cause: No get method defined for class: class MyPage$1 expression: 1

I also made a try with list.1.anyProperty.
Not working...

Any ideas?

best regards
Patrick

Re: PropertyModel / PropertyResolver / Map or List access

2014-11-06 Thread Paul Bors
I think that should have worked as per:
http://wicket.apache.org/guide/guide/modelsforms.html#modelsforms_2

Label label = new Label(firstChildName, new PropertyModel(person,
children.0.name));

What version of Wicket are you using?



On Thu, Nov 6, 2014 at 11:03 AM, Patrick Davids 
patrick.dav...@nubologic.com wrote:

 Hi all,

 the javadoc of PropertyResolver says, map or list access is possible via
 keys or index.
 Accessing an map via key is no problem, but I dont get it working for
 lists and index.

 for instance:

 MyPage extends Page{

private IModelListAnything list;

public MyPage(IModelListAnything list){
  super();
  this.list = list;

 add(new Label(mylabel, new PropertyModel(MyPage.this,
 list[1].anyProperty)));

}

 }

 ends up in a Exception like this:
 Last cause: No get method defined for class: class MyPage$1 expression: 1

 I also made a try with list.1.anyProperty.
 Not working...

 Any ideas?

 best regards
 Patrick


Re: PropertyModel / PropertyResolver / Map or List access

2014-11-06 Thread Patrick Davids
Hi Paul,
v6.17.0.

Maybe, I made a too reduced example.
My property navigates further... its more like this: 
list[1].anyProperty[key]

Is such a combination allowed?

Patrick

Am 06.11.2014 17:24, schrieb Paul Bors:
 I think that should have worked as per:
 http://wicket.apache.org/guide/guide/modelsforms.html#modelsforms_2

 Label label = new Label(firstChildName, new PropertyModel(person,
 children.0.name));

 What version of Wicket are you using?



 On Thu, Nov 6, 2014 at 11:03 AM, Patrick Davids 
 patrick.dav...@nubologic.com wrote:

 Hi all,

 the javadoc of PropertyResolver says, map or list access is possible via
 keys or index.
 Accessing an map via key is no problem, but I dont get it working for
 lists and index.

 for instance:

 MyPage extends Page{

 private IModelListAnything list;

 public MyPage(IModelListAnything list){
   super();
   this.list = list;

  add(new Label(mylabel, new PropertyModel(MyPage.this,
 list[1].anyProperty)));

 }

 }

 ends up in a Exception like this:
 Last cause: No get method defined for class: class MyPage$1 expression: 1

 I also made a try with list.1.anyProperty.
 Not working...

 Any ideas?

 best regards
 Patrick



Re: PropertyModel / PropertyResolver / Map or List access

2014-11-06 Thread Paul Bors
Create a quick-start, open a Jira ticket and provide a push request fixing
it :)

On Thu, Nov 6, 2014 at 11:38 AM, Patrick Davids 
patrick.dav...@nubologic.com wrote:

 Hi Paul,
 v6.17.0.

 Maybe, I made a too reduced example.
 My property navigates further... its more like this:
 list[1].anyProperty[key]

 Is such a combination allowed?

 Patrick

 Am 06.11.2014 17:24, schrieb Paul Bors:
  I think that should have worked as per:
  http://wicket.apache.org/guide/guide/modelsforms.html#modelsforms_2
 
  Label label = new Label(firstChildName, new PropertyModel(person,
  children.0.name));
 
  What version of Wicket are you using?
 
 
 
  On Thu, Nov 6, 2014 at 11:03 AM, Patrick Davids 
  patrick.dav...@nubologic.com wrote:
 
  Hi all,
 
  the javadoc of PropertyResolver says, map or list access is possible via
  keys or index.
  Accessing an map via key is no problem, but I dont get it working for
  lists and index.
 
  for instance:
 
  MyPage extends Page{
 
  private IModelListAnything list;
 
  public MyPage(IModelListAnything list){
super();
this.list = list;
 
   add(new Label(mylabel, new PropertyModel(MyPage.this,
  list[1].anyProperty)));
 
  }
 
  }
 
  ends up in a Exception like this:
  Last cause: No get method defined for class: class MyPage$1 expression:
 1
 
  I also made a try with list.1.anyProperty.
  Not working...
 
  Any ideas?
 
  best regards
  Patrick
 



Re: PropertyModel / PropertyResolver / Map or List access

2014-11-06 Thread Sven Meier

Hi,

you're telling PropertyModel to look up property list from MyPage, but 
list is not a list, it's a model, models don't have a property 1.


Use this instead:

  new Label(myLabel, new PropertyModel(list, [1],anyProperty))

... or:

  new Label(myLabel, new PropertyModel(MyPage.this, 
list.object.[1].anyProperty))


Regards
Sven

 


On 11/06/2014 05:03 PM, Patrick Davids wrote:

Hi all,

the javadoc of PropertyResolver says, map or list access is possible via
keys or index.
Accessing an map via key is no problem, but I dont get it working for
lists and index.

for instance:

MyPage extends Page{

private IModelListAnything list;

public MyPage(IModelListAnything list){
  super();
  this.list = list;

 add(new Label(mylabel, new PropertyModel(MyPage.this,
list[1].anyProperty)));

}

}

ends up in a Exception like this:
Last cause: No get method defined for class: class MyPage$1 expression: 1

I also made a try with list.1.anyProperty.
Not working...

Any ideas?

best regards
Patrick
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




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



Re: AjaxFormChoiceComponentUpdatingBehavior for custom CheckGroup and CheckGroupSelector

2014-11-06 Thread Andrea Del Bene
I haven't used this js library, but isn't enough to trigger a click 
event on checkboxes? Like:


$('#'+checkbox.id).iCheck('check');
$('#'+checkbox.id).trigger(click);

Dear Forum,

Based on wicket examples, I built a custom CheckGroup with added
CheckGroupSelector.
I also want to add an AjaxFormChoiceComponentUpdatingBehavior() instance to
the CheckGroup to update the items selected. And this is where the problem
lies.

I have extended CheckGroup class to make use of  ICheck jquery plugin
http://fronteed.com/iCheck/  .

Because CheckGroupSelector is  JavaScript sugar according to a previous
post
http://apache-wicket.1842946.n4.nabble.com/Wicket-FormTester-not-working-with-CheckGroupSelector-tp4668206p4668217.html
(thanks for the reply, Andrea), I had to replace CheckGroupSelector and
AbstractSelector class. For the custom AbstractSelector class, I replaced
the CheckSelector.js to make use of the ICheck functions,
$('#'+checkbox.id).iCheck('check'), $('#'+checkbox.id).iCheck('uncheck'),
etc.

The problem that I have now is that AjaxFormChoiceComponentUpdatingBehavior
no longer picks the click event from the checkboxes.
In order to resolve this problem, I am propagating the click event from
inside  CheckSelector.js  using javascript code from  this stackoverflow
answer http://stackoverflow.com/a/2381862/158499  . But this still doesn't
solve the problem.

My question is, how can I get AjaxFormChoiceComponentUpdatingBehavior to
pick up any event when I select/unselect any checkboxes from the custom
Icheck solution?

Failing that, how can I best create my own implementation of
AjaxFormChoiceComponentUpdatingBehavior to know when a checkbox has been
clicked?

Sorry for the long post.

Thanks,
Lucas



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxFormChoiceComponentUpdatingBehavior-for-custom-CheckGroup-and-CheckGroupSelector-tp4668281.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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