Re: AuthenticatedWebSession.authenticate() not being called

2014-09-16 Thread Lucio Crusca
 Puzzled. I try to create a quickstart, but the real problem is that I'm
 pretty sure the quickstart will work perfectly. Even my code has worked
 perfectly for the last 2 years...

Here is a quickstart-like piece of code showing the problem (I obtained it
by cutting away unneded pieces from my project):

http://www.sulweb.org/download/sparsi/swquick.zip

any user/password will do (i.e. the code would accept any of them, but
they won't work anyway). I expect this code to login any user with any
password and reach AuthenticatedPage. It reloads the SignInPage instead
and the authenticate() method never gets called.




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



Re: Ajax Post Data

2014-09-16 Thread Tobias Soloschenko
Hi,

I will have a look at it, but I don't want the API to be changed. Thanks anyway 
for the Feedback.

kind regards

Tobias

 Am 15.09.2014 um 21:32 schrieb Ernesto Reinaldo Barreiro reier...@gmail.com:
 
 You can make it abstract with same callback methods as panel. Users can the
 choose between panel or behavior.
 
 On Mon, Sep 15, 2014 at 8:41 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:
 
 Hi,
 
 it is not public static because of the use of ids and because of the
 callback methods.
 
 kind regards
 
 Tobias
 
 2014-09-15 20:37 GMT+02:00 Ernesto Reinaldo Barreiro reier...@gmail.com:
 
 Hi,
 
 Thanks for sharing! Why not make HTML5FilesDropableAjaxEventBehavior
 public
 static so that it can be reused independently of Panel?
 
 On Mon, Sep 15, 2014 at 8:30 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:
 
 Ok I solved my problem with the quickstart and some investigations
 about
 post requests:
 
var reader = new FileReader();
reader.onload = (function(file) {
return function(e) {
Wicket.Ajax.post({'u':'%sfileName=' + encodeURIComponent(
 file.name) + 'dropid='+dropid+'fileid=' + fileid,
ep:{data:btoa(reader.result)}, coh:[function(){
// getFinishedUploadClientScript
%s;
}]});
}
})(file);
reader.readAsBinaryString(file);
 
 I add the content of the file as base64 encoded binary string to the
 variable with the name data. The upload is now working like a charm.
 The
 only thing the developer has to know about is the max of mb (2mb in
 example
 of tomcat) for post requests:
 
 https://github.com/klopfdreh/wicket-components-playground
 
 kind regards
 
 Tobias
 
 
 2014-09-15 15:53 GMT+02:00 Martin Grigorov mgrigo...@apache.org:
 
 Please file a ticket with attached quickstart application.
 
 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov
 
 On Mon, Sep 15, 2014 at 4:44 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:
 
 Let me show an example (%s are going to be replaced with the url /
 callbackscript):
 
$.ajax({
type : 'POST',
url : '%sfileName=' + encodeURIComponent(file.name) +
 'dropid='+dropid+'fileid=' + fileid,
data : file,
contentType : false,
processData : false,
 
success:function(data, textStatus, jqXHR){
var file = this.data
// getFinishedUploadClientScript
%s
}
});
 
 With this code I can invoke this on server side and read the data:
 ((HttpServletRequest)
 RequestCycle.get().getRequest().getContainerRequest()).getInputStream()
 
 ---
 
Wicket.Ajax.post({'u':'%sfileName=' + encodeURIComponent(
 file.name)
 +
 'dropid='+dropid+'fileid=' + fileid, ep:file,sh:function(){
// getFinishedUploadClientScript
%s;
}});
 
 This code is not working with the server side handling of the post
 content
 
 kind regards
 
 Tobias
 
 
 
 
 2014-09-15 15:38 GMT+02:00 Tobias Soloschenko 
 tobiassolosche...@googlemail.com:
 
 No - I'm using Wicket.Ajax.post(...) - but if I do a normal
 $.ajax
 with
 --
 type:post, contentType:false, processData:false --I can read the
 content
 by
 inputstream I saw that the attrs.ep are passed into the data
 property
 but
 they are encoded which is wrong jQuery.param(data) line 634 of
 wicket-ajax-jquery. And how can I set the other both options so
 that
 I
 can
 read the content via stream?
 
 Kind regards
 
 Tobias
 
 Am 15.09.2014 um 15:28 schrieb Martin Grigorov 
 mgrigo...@apache.org
 :
 
 If you use Wicket.Ajax.post() or Wicket.Ajax.ajax({m:post,
 })
 then
 the parameters won't be in the query string.
 
 wicket-ajax.js puts the parameters to $.ajax({data: HERE, ...})
 and
 depending on the used 'method' (GET or POST) they will be in
 the
 query
 string or request body.
 
 Do you say that with method=post you still see the parameter in
 the
 query
 string ?
 
 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov
 
 On Mon, Sep 15, 2014 at 4:24 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:
 
 But they are add to the query string. This is really bad -
 maybe
 it
 would
 be nice to add a new special attribute which is given directly
 to
 the
 jquery's data attribute. It would be possible to get the
 content
 via
 inputstream of the httpservletrequest.
 ((HttpServletRequest)RequestCycle.get().getRequest().getContainerRequest()).getInputStream()
 
 kind regards
 
 Tobias
 
 Am 15.09.2014 um 14:43 schrieb Martin Grigorov 
 mgrigo...@apache.org
 :
 
 With HTTP you can send either string or binary.
 You have to convert at the server side
 On Sep 15, 2014 3:20 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:
 
 And how do I read the ep / dep in the backend if they aren't
 of
 Type
 String but a plain javascript object?
 
 ty for the fast response!
 
 Tobias
 
 Am 15.09.2014 um 14:16 schrieb Martin Grigorov 
 

Re: Ajax Post Data

2014-09-16 Thread Martin Grigorov
Hi Tobias,

On Mon, Sep 15, 2014 at 9:30 PM, Tobias Soloschenko 
tobiassolosche...@googlemail.com wrote:

 Ok I solved my problem with the quickstart and some investigations about
 post requests:

 var reader = new FileReader();
 reader.onload = (function(file) {
 return function(e) {
 Wicket.Ajax.post({'u':'%sfileName=' + encodeURIComponent(
 file.name) + 'dropid='+dropid+'fileid=' + fileid,
 ep:{data:btoa(reader.result)}, coh:[function(){
 // getFinishedUploadClientScript
 %s;
 }]});
 }
 })(file);
 reader.readAsBinaryString(file);

 I add the content of the file as base64 encoded binary string to the


Is the base64 encoded string sent as part of the query string or as request
body ?


 variable with the name data. The upload is now working like a charm. The
 only thing the developer has to know about is the max of mb (2mb in example
 of tomcat) for post requests:

 https://github.com/klopfdreh/wicket-components-playground

 kind regards

 Tobias


 2014-09-15 15:53 GMT+02:00 Martin Grigorov mgrigo...@apache.org:

  Please file a ticket with attached quickstart application.
 
  Martin Grigorov
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Mon, Sep 15, 2014 at 4:44 PM, Tobias Soloschenko 
  tobiassolosche...@googlemail.com wrote:
 
   Let me show an example (%s are going to be replaced with the url /
   callbackscript):
  
   $.ajax({
   type : 'POST',
   url : '%sfileName=' + encodeURIComponent(file.name) +
   'dropid='+dropid+'fileid=' + fileid,
   data : file,
   contentType : false,
   processData : false,
  
   success:function(data, textStatus, jqXHR){
   var file = this.data
   // getFinishedUploadClientScript
   %s
   }
   });
  
   With this code I can invoke this on server side and read the data:
   ((HttpServletRequest)
   RequestCycle.get().getRequest().getContainerRequest()).getInputStream()
  
   ---
  
   Wicket.Ajax.post({'u':'%sfileName=' + encodeURIComponent(
 file.name)
  +
   'dropid='+dropid+'fileid=' + fileid, ep:file,sh:function(){
   // getFinishedUploadClientScript
   %s;
   }});
  
   This code is not working with the server side handling of the post
  content
  
   kind regards
  
   Tobias
  
  
  
  
   2014-09-15 15:38 GMT+02:00 Tobias Soloschenko 
   tobiassolosche...@googlemail.com:
  
No - I'm using Wicket.Ajax.post(...) - but if I do a normal $.ajax
 with
   --
type:post, contentType:false, processData:false --I can read the
  content
   by
inputstream I saw that the attrs.ep are passed into the data property
  but
they are encoded which is wrong jQuery.param(data) line 634 of
wicket-ajax-jquery. And how can I set the other both options so that
 I
   can
read the content via stream?
   
Kind regards
   
Tobias
   
 Am 15.09.2014 um 15:28 schrieb Martin Grigorov 
 mgrigo...@apache.org
  :

 If you use Wicket.Ajax.post() or Wicket.Ajax.ajax({m:post,
 })
then
 the parameters won't be in the query string.

 wicket-ajax.js puts the parameters to $.ajax({data: HERE, ...}) and
 depending on the used 'method' (GET or POST) they will be in the
  query
 string or request body.

 Do you say that with method=post you still see the parameter in the
   query
 string ?

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

 On Mon, Sep 15, 2014 at 4:24 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:

 But they are add to the query string. This is really bad - maybe
 it
would
 be nice to add a new special attribute which is given directly to
  the
 jquery's data attribute. It would be possible to get the content
 via
 inputstream of the httpservletrequest.



   
  
 
 ((HttpServletRequest)RequestCycle.get().getRequest().getContainerRequest()).getInputStream()

 kind regards

 Tobias

 Am 15.09.2014 um 14:43 schrieb Martin Grigorov 
  mgrigo...@apache.org
   :

 With HTTP you can send either string or binary.
 You have to convert at the server side
 On Sep 15, 2014 3:20 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:

 And how do I read the ep / dep in the backend if they aren't of
  Type
 String but a plain javascript object?

 ty for the fast response!

 Tobias

 Am 15.09.2014 um 14:16 schrieb Martin Grigorov 
   mgrigo...@apache.org
:

 http://markmail.org/message/fw7cjfo7bzvkjfdu

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

 On Mon, Sep 15, 2014 at 3:11 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:

 Hi,

 is there a way to process post data 

Re: Ajax Post Data

2014-09-16 Thread Ernesto Reinaldo Barreiro
Hi,

You dont need to change your API: panel will remain the same.

On Tue, Sep 16, 2014 at 8:44 AM, Tobias Soloschenko 
tobiassolosche...@googlemail.com wrote:

 Hi,

 I will have a look at it, but I don't want the API to be changed. Thanks
 anyway for the Feedback.

 kind regards

 Tobias

  Am 15.09.2014 um 21:32 schrieb Ernesto Reinaldo Barreiro 
 reier...@gmail.com:
 
  You can make it abstract with same callback methods as panel. Users can
 the
  choose between panel or behavior.
 
  On Mon, Sep 15, 2014 at 8:41 PM, Tobias Soloschenko 
  tobiassolosche...@googlemail.com wrote:
 
  Hi,
 
  it is not public static because of the use of ids and because of the
  callback methods.
 
  kind regards
 
  Tobias
 
  2014-09-15 20:37 GMT+02:00 Ernesto Reinaldo Barreiro 
 reier...@gmail.com:
 
  Hi,
 
  Thanks for sharing! Why not make HTML5FilesDropableAjaxEventBehavior
  public
  static so that it can be reused independently of Panel?
 
  On Mon, Sep 15, 2014 at 8:30 PM, Tobias Soloschenko 
  tobiassolosche...@googlemail.com wrote:
 
  Ok I solved my problem with the quickstart and some investigations
  about
  post requests:
 
 var reader = new FileReader();
 reader.onload = (function(file) {
 return function(e) {
 Wicket.Ajax.post({'u':'%sfileName=' + encodeURIComponent(
  file.name) + 'dropid='+dropid+'fileid=' + fileid,
 ep:{data:btoa(reader.result)}, coh:[function(){
 // getFinishedUploadClientScript
 %s;
 }]});
 }
 })(file);
 reader.readAsBinaryString(file);
 
  I add the content of the file as base64 encoded binary string to the
  variable with the name data. The upload is now working like a charm.
  The
  only thing the developer has to know about is the max of mb (2mb in
  example
  of tomcat) for post requests:
 
  https://github.com/klopfdreh/wicket-components-playground
 
  kind regards
 
  Tobias
 
 
  2014-09-15 15:53 GMT+02:00 Martin Grigorov mgrigo...@apache.org:
 
  Please file a ticket with attached quickstart application.
 
  Martin Grigorov
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Mon, Sep 15, 2014 at 4:44 PM, Tobias Soloschenko 
  tobiassolosche...@googlemail.com wrote:
 
  Let me show an example (%s are going to be replaced with the url /
  callbackscript):
 
 $.ajax({
 type : 'POST',
 url : '%sfileName=' + encodeURIComponent(file.name) +
  'dropid='+dropid+'fileid=' + fileid,
 data : file,
 contentType : false,
 processData : false,
 
 success:function(data, textStatus, jqXHR){
 var file = this.data
 // getFinishedUploadClientScript
 %s
 }
 });
 
  With this code I can invoke this on server side and read the data:
  ((HttpServletRequest)
  RequestCycle.get().getRequest().getContainerRequest()).getInputStream()
 
  ---
 
 Wicket.Ajax.post({'u':'%sfileName=' + encodeURIComponent(
  file.name)
  +
  'dropid='+dropid+'fileid=' + fileid, ep:file,sh:function(){
 // getFinishedUploadClientScript
 %s;
 }});
 
  This code is not working with the server side handling of the post
  content
 
  kind regards
 
  Tobias
 
 
 
 
  2014-09-15 15:38 GMT+02:00 Tobias Soloschenko 
  tobiassolosche...@googlemail.com:
 
  No - I'm using Wicket.Ajax.post(...) - but if I do a normal
  $.ajax
  with
  --
  type:post, contentType:false, processData:false --I can read the
  content
  by
  inputstream I saw that the attrs.ep are passed into the data
  property
  but
  they are encoded which is wrong jQuery.param(data) line 634 of
  wicket-ajax-jquery. And how can I set the other both options so
  that
  I
  can
  read the content via stream?
 
  Kind regards
 
  Tobias
 
  Am 15.09.2014 um 15:28 schrieb Martin Grigorov 
  mgrigo...@apache.org
  :
 
  If you use Wicket.Ajax.post() or Wicket.Ajax.ajax({m:post,
  })
  then
  the parameters won't be in the query string.
 
  wicket-ajax.js puts the parameters to $.ajax({data: HERE, ...})
  and
  depending on the used 'method' (GET or POST) they will be in
  the
  query
  string or request body.
 
  Do you say that with method=post you still see the parameter in
  the
  query
  string ?
 
  Martin Grigorov
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Mon, Sep 15, 2014 at 4:24 PM, Tobias Soloschenko 
  tobiassolosche...@googlemail.com wrote:
 
  But they are add to the query string. This is really bad -
  maybe
  it
  would
  be nice to add a new special attribute which is given directly
  to
  the
  jquery's data attribute. It would be possible to get the
  content
  via
  inputstream of the httpservletrequest.
 
 ((HttpServletRequest)RequestCycle.get().getRequest().getContainerRequest()).getInputStream()
 
  kind regards
 
  Tobias
 
  Am 15.09.2014 um 14:43 schrieb Martin Grigorov 
  mgrigo...@apache.org
  :
 
  With HTTP you can send either string or binary.
  You have to convert at 

Re: Ajax Post Data

2014-09-16 Thread Tobias Soloschenko
As request-body - everything is ok

kind regards

Tobias

 Am 16.09.2014 um 08:51 schrieb Martin Grigorov mgrigo...@apache.org:
 
 Hi Tobias,
 
 On Mon, Sep 15, 2014 at 9:30 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:
 
 Ok I solved my problem with the quickstart and some investigations about
 post requests:
 
var reader = new FileReader();
reader.onload = (function(file) {
return function(e) {
Wicket.Ajax.post({'u':'%sfileName=' + encodeURIComponent(
 file.name) + 'dropid='+dropid+'fileid=' + fileid,
ep:{data:btoa(reader.result)}, coh:[function(){
// getFinishedUploadClientScript
%s;
}]});
}
})(file);
reader.readAsBinaryString(file);
 
 I add the content of the file as base64 encoded binary string to the
 
 Is the base64 encoded string sent as part of the query string or as request
 body ?
 
 
 variable with the name data. The upload is now working like a charm. The
 only thing the developer has to know about is the max of mb (2mb in example
 of tomcat) for post requests:
 
 https://github.com/klopfdreh/wicket-components-playground
 
 kind regards
 
 Tobias
 
 
 2014-09-15 15:53 GMT+02:00 Martin Grigorov mgrigo...@apache.org:
 
 Please file a ticket with attached quickstart application.
 
 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov
 
 On Mon, Sep 15, 2014 at 4:44 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:
 
 Let me show an example (%s are going to be replaced with the url /
 callbackscript):
 
$.ajax({
type : 'POST',
url : '%sfileName=' + encodeURIComponent(file.name) +
 'dropid='+dropid+'fileid=' + fileid,
data : file,
contentType : false,
processData : false,
 
success:function(data, textStatus, jqXHR){
var file = this.data
// getFinishedUploadClientScript
%s
}
});
 
 With this code I can invoke this on server side and read the data:
 ((HttpServletRequest)
 RequestCycle.get().getRequest().getContainerRequest()).getInputStream()
 
 ---
 
Wicket.Ajax.post({'u':'%sfileName=' + encodeURIComponent(
 file.name)
 +
 'dropid='+dropid+'fileid=' + fileid, ep:file,sh:function(){
// getFinishedUploadClientScript
%s;
}});
 
 This code is not working with the server side handling of the post
 content
 
 kind regards
 
 Tobias
 
 
 
 
 2014-09-15 15:38 GMT+02:00 Tobias Soloschenko 
 tobiassolosche...@googlemail.com:
 
 No - I'm using Wicket.Ajax.post(...) - but if I do a normal $.ajax
 with
 --
 type:post, contentType:false, processData:false --I can read the
 content
 by
 inputstream I saw that the attrs.ep are passed into the data property
 but
 they are encoded which is wrong jQuery.param(data) line 634 of
 wicket-ajax-jquery. And how can I set the other both options so that
 I
 can
 read the content via stream?
 
 Kind regards
 
 Tobias
 
 Am 15.09.2014 um 15:28 schrieb Martin Grigorov 
 mgrigo...@apache.org
 :
 
 If you use Wicket.Ajax.post() or Wicket.Ajax.ajax({m:post,
 })
 then
 the parameters won't be in the query string.
 
 wicket-ajax.js puts the parameters to $.ajax({data: HERE, ...}) and
 depending on the used 'method' (GET or POST) they will be in the
 query
 string or request body.
 
 Do you say that with method=post you still see the parameter in the
 query
 string ?
 
 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov
 
 On Mon, Sep 15, 2014 at 4:24 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:
 
 But they are add to the query string. This is really bad - maybe
 it
 would
 be nice to add a new special attribute which is given directly to
 the
 jquery's data attribute. It would be possible to get the content
 via
 inputstream of the httpservletrequest.
 ((HttpServletRequest)RequestCycle.get().getRequest().getContainerRequest()).getInputStream()
 
 kind regards
 
 Tobias
 
 Am 15.09.2014 um 14:43 schrieb Martin Grigorov 
 mgrigo...@apache.org
 :
 
 With HTTP you can send either string or binary.
 You have to convert at the server side
 On Sep 15, 2014 3:20 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:
 
 And how do I read the ep / dep in the backend if they aren't of
 Type
 String but a plain javascript object?
 
 ty for the fast response!
 
 Tobias
 
 Am 15.09.2014 um 14:16 schrieb Martin Grigorov 
 mgrigo...@apache.org
 :
 
 http://markmail.org/message/fw7cjfo7bzvkjfdu
 
 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov
 
 On Mon, Sep 15, 2014 at 3:11 PM, Tobias Soloschenko 
 tobiassolosche...@googlemail.com wrote:
 
 Hi,
 
 is there a way to process post data with the wicket ajax
 function
 -
 ep
 dep
 are only for strings.
 
 Kind regards and thanks!
 
 Tobias
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For 

ComponentNotFoundException when googlebot scrapes wicket page

2014-09-16 Thread Robert Gründler
Hi,

we’ve a very odd problem and are somewhat stuck, maybe someone here on the list 
has seen this sort of behaviour before.

We’ve deployed a small wicket app (4 pages) to a tomcat7 server and all 4 pages 
work just fine on the live system. 

However, when googlebot scrapes the pages, we see ComponentNotFound exceptions:

ComponentNotFoundException: Could not find component 'titleBar:menu:2:link' on 
page XYZ

We’ve tried to fetch the page as google bot from the webmaster tools, but the 
exception is not being triggered either.

No matter how we request the page, we cannot reproduce this exception. Only 2 
or 3 times a day when the bot 
indexes us, we see this in the logs.

We’ve also made sure the pages are stateless using the @StalessComponent 
annotation in combination with the StatelessChecker listener.

Has anyone an idea what could cause this?

thanks!


-robert





Re: Request for re-opening a Jira issue

2014-09-16 Thread Bernard
Martin,

First I appreciate very much your hard work in the mailing list and
Jira space.

Re 1. I accept this, but before developing ideas, I would want to
reach some consensus that there is a chance of having some change
implemented in wicket core.

Re 2. The use case needs page state because it uses panel replacement
where the last state must be the only available state. The previous
state must be destroyed and not be available to the user even after
reload. That is the whole point, the solution that solves the back
button problem in this use case. I see from your comment that I did
perhaps not explain the use case. But my dilemma is when I write too
much about the use case, then I would lose the compactness and clarity
of the issue. Of course there are potentially other solutions not
involving page state but alternatively session state but these would
depart from wicket patterns. I would feel more like programming Spring
MVC or similar technologies lacking the power of Wicket.

More below inline ...

On Mon, 15 Sep 2014 10:24:41 +0300, you wrote:

Hi,

I think it should not be re-opened!

1. JIRA is not support forum!
If you have questions then you should ask here (at users@ mailing list).
If you have ideas then you should discuss them at dev@ mailing list.

2. If you want to not have the ?pageId in the url then you should stick to
stateless components and behaviors.
This is by design!
Stateful pages cannot work without the pageId parameter!

What if Wicket switches processing in case of setVersion(false)? What
would stop us from letting Wicket use a singleton page version if
setVersion(false), making the version parameter entirely obsolete?
This appears to be very logical to me. As I wrote in the Jira ticket,
setVersioned(false) should just do what the word means. Currently that
is not the case because we are saying Wicket needs the version number.

Solutions like NoVersionRequestMapper are pure hacks. Use them at your own
responsibility! Wicket developers are not responsible for them!


We want to change that. Honestly, this is the whole point. I am sick
of these hacks that get broken because of what they are!


3. Wicket provides some default implementations for IRequestMapper
interface.
But it also allows you to provide your own when you believe the default
ones are not optimal for you.
Same as above if I understand this right. I really don't feel strong
enough about changing low level internals too much - risk of getting
broken.

3.1. Wicket does its best to be backward compatible with previous versions.
Before every release we test the suggested new release with as much
applications as we have. If we find a regression we cancel the release and
cut a new one. You are very welcome to join us with testing your
application, with your custom implementations of Wicket interfaces, and
report regressions !

Thanks for that. I am afraid of getting into some hacking mode where
my custom implementation gets broken and I would just waste your time.



I'll copy my response to the ticket for cross reference.

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

On Sun, Sep 14, 2014 at 10:55 AM, Bernard bht...@gmail.com wrote:

 Hi,

 I created a Jira issue

 https://issues.apache.org/jira/browse/WICKET-5693
 setVersioned(false) should force single Page Version

 Initially information was not sufficient or clear enough so the issue
 was closed.

 Meanwhile I have added the requested information.

 Could this issue please be re-opened.

 Many thanks.

 Bernard

 ---
 This email is free from viruses and malware because avast! Antivirus
 protection is active.
 http://www.avast.com


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




---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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



Re: Programmatic Markup with fallback

2014-09-16 Thread Thibault Kruse
Regarding the markupException, the example I posted was flawed, must
be: return Markup.of(wicket:panelit works/wicket:panel);
But that is not relevant to my report. The example on github had this fixed.

Any other ideas / somewhat clean workaround? SHould I open a JIRA
issue on this, or two?

On Mon, Sep 15, 2014 at 8:01 PM, Thibault Kruse
tibokr...@googlemail.com wrote:
 Sorry, this was wicket 1.6.16 and 1.6.17.
 Here is a quickstart, to reproduce both cases some comments have to be 
 switched:
 https://github.com/tkruse/custommarkup

 On Mon, Sep 15, 2014 at 7:50 PM, Sven Meier s...@meiers.net wrote:
 Hi,

 which Wicket version?

 The first approach leads to a MarkupException here with Wicket 1.6.x.

 Regards
 Sven


 On 09/15/2014 07:37 PM, Thibault Kruse wrote:

 Hi,

 I am trying to create a wicket panel that renders markup from some
 remote source, but if fetching fails, renders some fallback markup. I
 want to achieve this with minimal code.

 I tried two approaches one based on overriding getMarkup(), one based
 on http://wicket.apache.org/guide/guide/advanced.html#advanced_5, both
 fail:

 /**
   * attempts to use custom markup by overriding getMarkup()... but html is
 used
   */
 public class CustomMarkupFallback1Panel extends GenericPanelString {
  @Override
  public IMarkupFragment getMarkup() {
  return Markup.of(it works);
  }
 }

 CustomMarkupFallback1Panel.html:
 wicket:panel
  Fail!
 /wicket:panel


 This first one overrides getMarkup() as suggested in the javadoc of
 IMarkupResourceStreamProvider, but what gets rendered is instead the
 static html (even though the debugger walks through getMarkup().


 The second approach fails using IMarkupResourceStreamProvider works
 for the intended markup, but not for the fallback markup
 public class CustomMarkupFallback2Panel extends GenericPanelString
  IMarkupResourceStreamProvider {

  @Override
  public IResourceStream getMarkupResourceStream(MarkupContainer
 container, Class? containerClass) {
  if (getModelObject() == null) {
  // thows Exception, see below. html file exists
  return getMarkup().getMarkupResourceStream();
  } else {
  // works
  return new StringResourceStream(getModelObject());
  }
  }
 }


 At least the first failure seems like a bug to me, not sure whether
 the second approach is supposed to work, or how else to load markup
 the wicket way.

 Is there maybe a completely different approach to achieve what I try to
 do?

 cheers,
Thibault



 java.io.IOException: Stream closed
   at
 java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:162)
   at java.io.BufferedInputStream.read(BufferedInputStream.java:325)
   at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
   at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
   at
 org.apache.wicket.util.io.BOMInputStream.getBOM(BOMInputStream.java:217)
   at
 org.apache.wicket.util.io.BOMInputStream.readFirstBytes(BOMInputStream.java:261)
   at
 org.apache.wicket.util.io.BOMInputStream.read(BOMInputStream.java:312)
   at
 org.apache.wicket.util.io.XmlReader.getXmlDeclaration(XmlReader.java:183)
   at org.apache.wicket.util.io.XmlReader.init(XmlReader.java:106)
   at org.apache.wicket.util.io.XmlReader.init(XmlReader.java:81)
   at
 org.apache.wicket.markup.parser.XmlPullParser.parse(XmlPullParser.java:605)
   at
 org.apache.wicket.markup.AbstractMarkupParser.parse(AbstractMarkupParser.java:178)
   at
 org.apache.wicket.markup.loader.SimpleMarkupLoader.loadMarkup(SimpleMarkupLoader.java:51)
   at
 org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.loadMarkup(InheritedMarkupMarkupLoader.java:57)
   at
 org.apache.wicket.markup.loader.DefaultMarkupLoader.loadMarkup(DefaultMarkupLoader.java:52)
   at
 org.apache.wicket.markup.MarkupFactory.loadMarkup(MarkupFactory.java:412)
   at
 org.apache.wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:448)
   at
 org.apache.wicket.markup.MarkupCache.loadMarkupAndWatchForChanges(MarkupCache.java:544)
   at
 org.apache.wicket.markup.MarkupCache.getMarkup(MarkupCache.java:305)
   at
 org.apache.wicket.markup.MarkupFactory.getMarkup(MarkupFactory.java:236)
   at
 org.apache.wicket.markup.MarkupFactory.getMarkup(MarkupFactory.java:194)
   at
 org.apache.wicket.MarkupContainer.getAssociatedMarkup(MarkupContainer.java:405)
   at
 org.apache.wicket.MarkupContainer.getAssociatedMarkupStream(MarkupContainer.java:372)
   at
 org.apache.wicket.markup.html.panel.AssociatedMarkupSourcingStrategy.renderHeadFromAssociatedMarkupFile(AssociatedMarkupSourcingStrategy.java:244)
   at
 org.apache.wicket.markup.html.panel.AssociatedMarkupSourcingStrategy.renderHead(AssociatedMarkupSourcingStrategy.java:220)
   at org.apache.wicket.Component.renderHead(Component.java:2652)
   at
 

Re: Programmatic Markup with fallback

2014-09-16 Thread Thibault Kruse
So debugging a bit, I find that I get hit by the
PanelMarkupSourcingStrategy. It seems it throws away the body markup
in favcor of the associated Markup. So I could advance one step by
extending WebMarkupContainer instead of Panel.

I notice that when extending Panel, getMarkup() is being called 3
times in my example, before the result is being discarded.

That seems like design smell. If users override getMarkup() with some
expensive operation, they should be able to rely on this being called
just once, and this only if the result is actually being used.

On Tue, Sep 16, 2014 at 11:24 AM, Thibault Kruse
tibokr...@googlemail.com wrote:
 Regarding the markupException, the example I posted was flawed, must
 be: return Markup.of(wicket:panelit works/wicket:panel);
 But that is not relevant to my report. The example on github had this fixed.

 Any other ideas / somewhat clean workaround? SHould I open a JIRA
 issue on this, or two?

 On Mon, Sep 15, 2014 at 8:01 PM, Thibault Kruse
 tibokr...@googlemail.com wrote:
 Sorry, this was wicket 1.6.16 and 1.6.17.
 Here is a quickstart, to reproduce both cases some comments have to be 
 switched:
 https://github.com/tkruse/custommarkup

 On Mon, Sep 15, 2014 at 7:50 PM, Sven Meier s...@meiers.net wrote:
 Hi,

 which Wicket version?

 The first approach leads to a MarkupException here with Wicket 1.6.x.

 Regards
 Sven


 On 09/15/2014 07:37 PM, Thibault Kruse wrote:

 Hi,

 I am trying to create a wicket panel that renders markup from some
 remote source, but if fetching fails, renders some fallback markup. I
 want to achieve this with minimal code.

 I tried two approaches one based on overriding getMarkup(), one based
 on http://wicket.apache.org/guide/guide/advanced.html#advanced_5, both
 fail:

 /**
   * attempts to use custom markup by overriding getMarkup()... but html is
 used
   */
 public class CustomMarkupFallback1Panel extends GenericPanelString {
  @Override
  public IMarkupFragment getMarkup() {
  return Markup.of(it works);
  }
 }

 CustomMarkupFallback1Panel.html:
 wicket:panel
  Fail!
 /wicket:panel


 This first one overrides getMarkup() as suggested in the javadoc of
 IMarkupResourceStreamProvider, but what gets rendered is instead the
 static html (even though the debugger walks through getMarkup().


 The second approach fails using IMarkupResourceStreamProvider works
 for the intended markup, but not for the fallback markup
 public class CustomMarkupFallback2Panel extends GenericPanelString
  IMarkupResourceStreamProvider {

  @Override
  public IResourceStream getMarkupResourceStream(MarkupContainer
 container, Class? containerClass) {
  if (getModelObject() == null) {
  // thows Exception, see below. html file exists
  return getMarkup().getMarkupResourceStream();
  } else {
  // works
  return new StringResourceStream(getModelObject());
  }
  }
 }


 At least the first failure seems like a bug to me, not sure whether
 the second approach is supposed to work, or how else to load markup
 the wicket way.

 Is there maybe a completely different approach to achieve what I try to
 do?

 cheers,
Thibault



 java.io.IOException: Stream closed
   at
 java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:162)
   at java.io.BufferedInputStream.read(BufferedInputStream.java:325)
   at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
   at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
   at
 org.apache.wicket.util.io.BOMInputStream.getBOM(BOMInputStream.java:217)
   at
 org.apache.wicket.util.io.BOMInputStream.readFirstBytes(BOMInputStream.java:261)
   at
 org.apache.wicket.util.io.BOMInputStream.read(BOMInputStream.java:312)
   at
 org.apache.wicket.util.io.XmlReader.getXmlDeclaration(XmlReader.java:183)
   at org.apache.wicket.util.io.XmlReader.init(XmlReader.java:106)
   at org.apache.wicket.util.io.XmlReader.init(XmlReader.java:81)
   at
 org.apache.wicket.markup.parser.XmlPullParser.parse(XmlPullParser.java:605)
   at
 org.apache.wicket.markup.AbstractMarkupParser.parse(AbstractMarkupParser.java:178)
   at
 org.apache.wicket.markup.loader.SimpleMarkupLoader.loadMarkup(SimpleMarkupLoader.java:51)
   at
 org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.loadMarkup(InheritedMarkupMarkupLoader.java:57)
   at
 org.apache.wicket.markup.loader.DefaultMarkupLoader.loadMarkup(DefaultMarkupLoader.java:52)
   at
 org.apache.wicket.markup.MarkupFactory.loadMarkup(MarkupFactory.java:412)
   at
 org.apache.wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:448)
   at
 org.apache.wicket.markup.MarkupCache.loadMarkupAndWatchForChanges(MarkupCache.java:544)
   at
 org.apache.wicket.markup.MarkupCache.getMarkup(MarkupCache.java:305)
   at
 org.apache.wicket.markup.MarkupFactory.getMarkup(MarkupFactory.java:236)
   

Re: Programmatic Markup with fallback

2014-09-16 Thread Andrea Del Bene

Hi,

I didn't dig to much into the code, but keep in mind that you are 
disabling markup caching in your example. This might explain why 
getMarkup is called three times.
Anyway, in your specific case it might be better not to implement 
IMarkupCacheKeyProvider and IMarkupResourceStreamProvider, but simply 
override onComponentTagBody like this:


@Override
public void onComponentTagBody(MarkupStream markupStream, 
ComponentTag openTag) {

if (getDefaultModelObject() == null) {
super.onComponentTagBody(markupStream, openTag);
}
else {

replaceComponentTagBody(markupStream, openTag, 
wicket:panelit works/wicket:panel);

}
}

So debugging a bit, I find that I get hit by the
PanelMarkupSourcingStrategy. It seems it throws away the body markup
in favcor of the associated Markup. So I could advance one step by
extending WebMarkupContainer instead of Panel.

I notice that when extending Panel, getMarkup() is being called 3
times in my example, before the result is being discarded.

That seems like design smell. If users override getMarkup() with some
expensive operation, they should be able to rely on this being called
just once, and this only if the result is actually being used.

On Tue, Sep 16, 2014 at 11:24 AM, Thibault Kruse
tibokr...@googlemail.com wrote:




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



Re: Programmatic Markup with fallback

2014-09-16 Thread Thibault Kruse
So, I have a working solution like this:

public class CustomMarkupFallbackMarkupContainer extends
WebMarkupContainer implements IMarkupCacheKeyProvider {
public CustomMarkupFallbackMarkupContainer(String id,
IModelString model) {super(id, model);}

@Override
public IMarkupFragment getMarkup() {
String markupString = (String) getDefaultModelObject();
if (markupString == null) {
return getAssociatedMarkup();
} else {
return Markup.of(markupString);
}
}

@Override public String getCacheKey(MarkupContainer container,
Class? containerClass) {return null;}
}

Regarding the multiple invocations of getMarkup(), they also occur
when caching, and indeed they occur on every request (caching happens
only for the associated markup, I assume). The calls all happen inside
the same call to Component.internalRender()

Invocations are:
1: Component.internalRender():2309 // creating a MarkupStream only
used inside if block

2:
Component.internalRenderComponent():2472 // some duplicate code with
internalRender()
MarkupContainer.onRender(): 1496
Component.internalRender():2344

3:
Component.renderComponentTag():3961
Component.internalRenderComponent():2505
MarkupContainer.onRender(): 1496
Component.internalRender():2344

4:
Component.renderComponentTag():3961
AssociatedMarkupSourcingStrategy.renderAssociatedMarkup()
AssociatedMarkupSourcingStrategy.renderAssociatedMarkup()
PanelMarkupSourcingStrategy.onComponentTagBody():112
Component.internalRenderComponent():2514
MarkupContainer.onRender(): 1496
Component.internalRender():2344



Regarding usage of onComponentTagBody(), that seems also valid, but
much deeper into the Wicket API than I would want to go, in particular
given there are recommended solutions in
http://wicket.apache.org/guide/guide/advanced.html#advanced_5 and the
javadoc.

On Tue, Sep 16, 2014 at 12:00 PM, Andrea Del Bene an.delb...@gmail.com wrote:
 Hi,

 I didn't dig to much into the code, but keep in mind that you are disabling
 markup caching in your example. This might explain why getMarkup is called
 three times.
 Anyway, in your specific case it might be better not to implement
 IMarkupCacheKeyProvider and IMarkupResourceStreamProvider, but simply
 override onComponentTagBody like this:

 @Override
 public void onComponentTagBody(MarkupStream markupStream, ComponentTag
 openTag) {
 if (getDefaultModelObject() == null) {
 super.onComponentTagBody(markupStream, openTag);
 }
 else {

 replaceComponentTagBody(markupStream, openTag, wicket:panelit
 works/wicket:panel);
 }
 }

 So debugging a bit, I find that I get hit by the
 PanelMarkupSourcingStrategy. It seems it throws away the body markup
 in favcor of the associated Markup. So I could advance one step by
 extending WebMarkupContainer instead of Panel.

 I notice that when extending Panel, getMarkup() is being called 3
 times in my example, before the result is being discarded.

 That seems like design smell. If users override getMarkup() with some
 expensive operation, they should be able to rely on this being called
 just once, and this only if the result is actually being used.

 On Tue, Sep 16, 2014 at 11:24 AM, Thibault Kruse
 tibokr...@googlemail.com wrote:



 -
 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: Programmatic Markup with fallback

2014-09-16 Thread Thibault Kruse
I forgot to mention, for my solution to work, the associated markup
file must not have tags outside the wicket:panel tags:
wicket:panel
Fallback works!
/wicket:panel

as opposed to

?xml version=1.0 encoding=UTF-8?
html xmlns=http://www.w3.org/1999/xhtml;
xmlns:wicket=http://wicket.apache.org;
body
wicket:panel
Fallback works!
/wicket:panel
/body
/html

So I guess I am still doing something wrong here.

On Tue, Sep 16, 2014 at 12:28 PM, Thibault Kruse
tibokr...@googlemail.com wrote:
 So, I have a working solution like this:

 public class CustomMarkupFallbackMarkupContainer extends
 WebMarkupContainer implements IMarkupCacheKeyProvider {
 public CustomMarkupFallbackMarkupContainer(String id,
 IModelString model) {super(id, model);}

 @Override
 public IMarkupFragment getMarkup() {
 String markupString = (String) getDefaultModelObject();
 if (markupString == null) {
 return getAssociatedMarkup();
 } else {
 return Markup.of(markupString);
 }
 }

 @Override public String getCacheKey(MarkupContainer container,
 Class? containerClass) {return null;}
 }

 Regarding the multiple invocations of getMarkup(), they also occur
 when caching, and indeed they occur on every request (caching happens
 only for the associated markup, I assume). The calls all happen inside
 the same call to Component.internalRender()

 Invocations are:
 1: Component.internalRender():2309 // creating a MarkupStream only
 used inside if block

 2:
 Component.internalRenderComponent():2472 // some duplicate code with
 internalRender()
 MarkupContainer.onRender(): 1496
 Component.internalRender():2344

 3:
 Component.renderComponentTag():3961
 Component.internalRenderComponent():2505
 MarkupContainer.onRender(): 1496
 Component.internalRender():2344

 4:
 Component.renderComponentTag():3961
 AssociatedMarkupSourcingStrategy.renderAssociatedMarkup()
 AssociatedMarkupSourcingStrategy.renderAssociatedMarkup()
 PanelMarkupSourcingStrategy.onComponentTagBody():112
 Component.internalRenderComponent():2514
 MarkupContainer.onRender(): 1496
 Component.internalRender():2344



 Regarding usage of onComponentTagBody(), that seems also valid, but
 much deeper into the Wicket API than I would want to go, in particular
 given there are recommended solutions in
 http://wicket.apache.org/guide/guide/advanced.html#advanced_5 and the
 javadoc.

 On Tue, Sep 16, 2014 at 12:00 PM, Andrea Del Bene an.delb...@gmail.com 
 wrote:
 Hi,

 I didn't dig to much into the code, but keep in mind that you are disabling
 markup caching in your example. This might explain why getMarkup is called
 three times.
 Anyway, in your specific case it might be better not to implement
 IMarkupCacheKeyProvider and IMarkupResourceStreamProvider, but simply
 override onComponentTagBody like this:

 @Override
 public void onComponentTagBody(MarkupStream markupStream, ComponentTag
 openTag) {
 if (getDefaultModelObject() == null) {
 super.onComponentTagBody(markupStream, openTag);
 }
 else {

 replaceComponentTagBody(markupStream, openTag, wicket:panelit
 works/wicket:panel);
 }
 }

 So debugging a bit, I find that I get hit by the
 PanelMarkupSourcingStrategy. It seems it throws away the body markup
 in favcor of the associated Markup. So I could advance one step by
 extending WebMarkupContainer instead of Panel.

 I notice that when extending Panel, getMarkup() is being called 3
 times in my example, before the result is being discarded.

 That seems like design smell. If users override getMarkup() with some
 expensive operation, they should be able to rely on this being called
 just once, and this only if the result is actually being used.

 On Tue, Sep 16, 2014 at 11:24 AM, Thibault Kruse
 tibokr...@googlemail.com wrote:



 -
 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: Programmatic Markup with fallback

2014-09-16 Thread Thibault Kruse
I realize now using the wicket:panel tag only works with panels, so
maybe the wicket way to go would be to have a raw markup file
without the xmlns declaration. I don't know. In any case, I preferred
to use a panel with a complete html file like for any other panel,
so I had to circumvent the PanelMarkupSourcingStrategy from overruling
getMarkup().

In the implementation below I also preferred to use setMarkup() over
overriding getMarkup(). It seems to me getMarkup() is not suitable to
be overwritten, as the rest of the code with Component seems to assume
it is an accessor to a field (hence multiple invocations are assumed
cheap. The last invocation I listed was just used to get a handle to
the MarkupStream). I would recommend making getMarkup() final, and
maybe change the javadoc comment in IMarkupResourceStreamProvider.

I tried to get a IMarkupResourceStreamProvider solution to work, but I
fail to see an obvious way to get the associated Markup of a panel
class implementing IMarkupResourceStreamProvider, all approaches I
tried ended up using the provided getMarkupResourceStream() method.


public class CustomMarkupFallback2MarkupContainer extends
GenericPanelString implements IMarkupCacheKeyProvider {
private boolean overrideMarkup = false;
public CustomMarkupFallback2MarkupContainer(String id, String
markupString) {
super(id);
if (markupString != null) {
setMarkup(Markup.of(markupString));
overrideMarkup = true;
}
}

/**
 * For panels, the strategy by Panel.newMarkupSourcingStrategy()
overrules markup, reads associated markup in the end
 * @return
 */
protected IMarkupSourcingStrategy newMarkupSourcingStrategy()
{
if (overrideMarkup) {
return DefaultMarkupSourcingStrategy.get();
}
return super.newMarkupSourcingStrategy();
}

/**
 * Do not cache markup by wicket, null means no caching. must
implement IMarkupCacheKeyProvider
 */
@Override
public String getCacheKey(MarkupContainer container, Class?
containerClass) {
return null;
}
}

On Tue, Sep 16, 2014 at 2:28 PM, Thibault Kruse
tibokr...@googlemail.com wrote:
 I forgot to mention, for my solution to work, the associated markup
 file must not have tags outside the wicket:panel tags:
 wicket:panel
 Fallback works!
 /wicket:panel

 as opposed to

 ?xml version=1.0 encoding=UTF-8?
 html xmlns=http://www.w3.org/1999/xhtml;
 xmlns:wicket=http://wicket.apache.org;
 body
 wicket:panel
 Fallback works!
 /wicket:panel
 /body
 /html

 So I guess I am still doing something wrong here.

 On Tue, Sep 16, 2014 at 12:28 PM, Thibault Kruse
 tibokr...@googlemail.com wrote:
 So, I have a working solution like this:

 public class CustomMarkupFallbackMarkupContainer extends
 WebMarkupContainer implements IMarkupCacheKeyProvider {
 public CustomMarkupFallbackMarkupContainer(String id,
 IModelString model) {super(id, model);}

 @Override
 public IMarkupFragment getMarkup() {
 String markupString = (String) getDefaultModelObject();
 if (markupString == null) {
 return getAssociatedMarkup();
 } else {
 return Markup.of(markupString);
 }
 }

 @Override public String getCacheKey(MarkupContainer container,
 Class? containerClass) {return null;}
 }

 Regarding the multiple invocations of getMarkup(), they also occur
 when caching, and indeed they occur on every request (caching happens
 only for the associated markup, I assume). The calls all happen inside
 the same call to Component.internalRender()

 Invocations are:
 1: Component.internalRender():2309 // creating a MarkupStream only
 used inside if block

 2:
 Component.internalRenderComponent():2472 // some duplicate code with
 internalRender()
 MarkupContainer.onRender(): 1496
 Component.internalRender():2344

 3:
 Component.renderComponentTag():3961
 Component.internalRenderComponent():2505
 MarkupContainer.onRender(): 1496
 Component.internalRender():2344

 4:
 Component.renderComponentTag():3961
 AssociatedMarkupSourcingStrategy.renderAssociatedMarkup()
 AssociatedMarkupSourcingStrategy.renderAssociatedMarkup()
 PanelMarkupSourcingStrategy.onComponentTagBody():112
 Component.internalRenderComponent():2514
 MarkupContainer.onRender(): 1496
 Component.internalRender():2344



 Regarding usage of onComponentTagBody(), that seems also valid, but
 much deeper into the Wicket API than I would want to go, in particular
 given there are recommended solutions in
 http://wicket.apache.org/guide/guide/advanced.html#advanced_5 and the
 javadoc.

 On Tue, Sep 16, 2014 at 12:00 PM, Andrea Del Bene an.delb...@gmail.com 
 wrote:
 Hi,

 I didn't dig to much into the code, but keep in mind that you are disabling
 markup caching in your example. This might explain why getMarkup is called
 three times.
 Anyway, in your specific case it might be better not to implement
 IMarkupCacheKeyProvider and 

MarkupContainer rendering without children

2014-09-16 Thread Thibault Kruse
Hi,

is it intentional that if a class directly extends MarkupContainer,
but does not have any children, then its associated markup is not
rendered?

When using

public class FooMarkupContainer extends MarkupContainer implements
IMarkupCacheKeyProvider {
public FooMarkupContainer(String id) {super(id);}

@Override public String getCacheKey(MarkupContainer container,
Class? containerClass) {return null;}
}

with markup

divFoo works!/div

or anything, nothing appears on the page.

It seems the javadoc of MarkupContainer is not entirely clear on this:
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/MarkupContainer.html

Markup Rendering - A MarkupContainer also holds/references associated
markup which is used to render the container. As the markup stream for
a container is rendered, component references in the markup are
resolved by using the container to look up Components in the
container's component map by id. Each component referenced by the
markup stream is given an opportunity to render itself using the
markup stream. 

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



Re: ComponentNotFoundException when googlebot scrapes wicket page

2014-09-16 Thread Paul Bors
Well, you have the wicket component tree path to what's not found:
titleBar:menu:2:link

The 3rd (index 2) menu link was missing at the point your page was rendered.
Start thinking about how your 'menu' component could miss that from the
mode.

Or perhaps someone used the back-page button and your page was not in the
page store?

On Tue, Sep 16, 2014 at 3:42 AM, Robert Gründler rob...@dubture.com wrote:

 Hi,

 we’ve a very odd problem and are somewhat stuck, maybe someone here on the
 list has seen this sort of behaviour before.

 We’ve deployed a small wicket app (4 pages) to a tomcat7 server and all 4
 pages work just fine on the live system.

 However, when googlebot scrapes the pages, we see ComponentNotFound
 exceptions:

 ComponentNotFoundException: Could not find component
 'titleBar:menu:2:link' on page XYZ

 We’ve tried to fetch the page as google bot from the webmaster tools, but
 the exception is not being triggered either.

 No matter how we request the page, we cannot reproduce this exception.
 Only 2 or 3 times a day when the bot
 indexes us, we see this in the logs.

 We’ve also made sure the pages are stateless using the @StalessComponent
 annotation in combination with the StatelessChecker listener.

 Has anyone an idea what could cause this?

 thanks!


 -robert






Re: ComponentNotFoundException when googlebot scrapes wicket page

2014-09-16 Thread Paul Bors
ie: How do you create the menu links?
Where does the model come from and are those links dynamic?

On Tue, Sep 16, 2014 at 11:15 AM, Paul Bors p...@bors.ws wrote:

 Well, you have the wicket component tree path to what's not found:
 titleBar:menu:2:link

 The 3rd (index 2) menu link was missing at the point your page was
 rendered.
 Start thinking about how your 'menu' component could miss that from the
 mode.

 Or perhaps someone used the back-page button and your page was not in the
 page store?

 On Tue, Sep 16, 2014 at 3:42 AM, Robert Gründler rob...@dubture.com
 wrote:

 Hi,

 we’ve a very odd problem and are somewhat stuck, maybe someone here on
 the list has seen this sort of behaviour before.

 We’ve deployed a small wicket app (4 pages) to a tomcat7 server and all 4
 pages work just fine on the live system.

 However, when googlebot scrapes the pages, we see ComponentNotFound
 exceptions:

 ComponentNotFoundException: Could not find component
 'titleBar:menu:2:link' on page XYZ

 We’ve tried to fetch the page as google bot from the webmaster tools, but
 the exception is not being triggered either.

 No matter how we request the page, we cannot reproduce this exception.
 Only 2 or 3 times a day when the bot
 indexes us, we see this in the logs.

 We’ve also made sure the pages are stateless using the @StalessComponent
 annotation in combination with the StatelessChecker listener.

 Has anyone an idea what could cause this?

 thanks!


 -robert







Re: Programmatic Markup with fallback

2014-09-16 Thread Andrea Del Bene

Hi,

I've found a simple solution delegating markup providing to 
DefaultMarkupResourceStreamProvider:


public class CustomMarkupFallback2Panel extends Panel implements 
IMarkupCacheKeyProvider,

IMarkupResourceStreamProvider {

private final DefaultMarkupResourceStreamProvider 
markupResourceStreamProvider =

new DefaultMarkupResourceStreamProvider();

public CustomMarkupFallback2Panel(String id, IModelString model) {
super(id, model);
}


@Override
public IResourceStream getMarkupResourceStream(MarkupContainer 
container, Class? containerClass) {

if (getDefaultModelObject() == null) {
return 
markupResourceStreamProvider.getMarkupResourceStream(container, 
containerClass);

} else {
return new StringResourceStream( + getDefaultModelObject());
}
}

@Override
public String getCacheKey(MarkupContainer container, Class? 
containerClass) {

return null;
}
}

For the closed stream exception I'm opening an issue to improve code.

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



The order of setting mountPage and cryptoMapper changes behavior.

2014-09-16 Thread SGutta
Hello,

Assuming we have 2 applications

One application providing authentication and second application configured 
to be redirected to the first application for authentication.

Lets call page in the second application which does the redirection to 
first application as SignInPage. 

Below is the code in SignInPage which sets a cookie to redirect to the url 
that was requested after login.

// The following lines ensure redirection back to the second application 
page that was requested.
 Response resp = getRequestCycle().getResponse();
 if (resp instanceof WebResponse)
 {
 WebResponse webResp = (WebResponse) resp; 
 Cookie cookie = 
WicketApplication.get().getIamHelper().getIamSecurityHelper().getRedirectURLCookie(second
 
app url);
 webResp.addCookie(cookie);
 }
 
 // The following line redirects to first application for login.
 getRequestCycle().scheduleRequestHandlerAfterCurrent(new 
RedirectRequestHandler(../firstApplcation/login));

Now mounting SignInPage class in 
org.apache.wicket.protocol.http.WebApplication#init() in the following 
order
 
 getSecuritySettings().setCryptFactory(new 
KeyInSessionSunJceCryptFactory());
 
 setRootRequestMapper(new CryptoMapper(getRootRequestMapperAsCompound(), 
this));
 
 mountPage(/login, SignInPage.class);

The above setting works fine where the user is correctly redirected to 
../firstApplcation/login to login, 
however swapping CryptoMapper and mountPage as follows breaks and the user 
is not redirected to First app for authentication, 
url seen in the browser is secondApplication/xxx versus 
../firstApplcation/login
 
 getSecuritySettings().setCryptFactory(new 
KeyInSessionSunJceCryptFactory()); 
 
 mountPage(/login, SignInPage.class); 

 setRootRequestMapper(new CryptoMapper(getRootRequestMapperAsCompound(), 
this));
 
Why does the order of mountPage and CryptoMapper change behavior ?


Thanks  Regards
Satish Gutta



Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.

Re: AuthenticatedWebSession.authenticate() not being called

2014-09-16 Thread Lucio Crusca
 Puzzled. I try to create a quickstart, but the real problem is that I'm
 pretty sure the quickstart will work perfectly. Even my code has worked
 perfectly for the last 2 years...

 Here is a quickstart-like piece of code showing the problem (I obtained it
 by cutting away unneded pieces from my project):

 http://www.sulweb.org/download/sparsi/swquick.zip

 any user/password will do (i.e. the code would accept any of them, but
 they won't work anyway). I expect this code to login any user with any
 password and reach AuthenticatedPage. It reloads the SignInPage instead
 and the authenticate() method never gets called.


Now I've also tried with a real, minimal quickstart, and it works
(obviously). However I still can't spot the problem in my code.

Please help.


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



Re: Handling page refresh or redirect when the server reboots

2014-09-16 Thread Sébastien Gautrin

I don't have a wicket-way for this. However, if I had to do something like 
that, I'd try the following simple and extremely basic approach (which would need to be 
refined to be more than just an ugly hack)

1. after the action triggering the upgrade process, trigger a javascript on the 
client side
2. this javascript would poll a given url (e.g. current page or application 
home or a specific bookmarkmable page, the latter being probably better)
1. as long as the polled url does not return (within a short timeout) or 
returns an error code (depending on your setup: if the app is behind a proxy, 
you'd expect a 502/503 error as long as the app is not up)
2. once the poll returns a non-error, the javascript would trigger the 
redirect (it could also probably trigger a modal login form on the current page 
instead)

Note that I myself feel this approach would be very hacky and is most likely 
not the best way to do it with wicket, but this should at least work for your 
purpose, and maybe give you an idea on how to do it better.

On 10/09/14 23:03, msalman wrote:

So we have this feature of online server upgrade in which the user can start
an upgrade on the server while still logged into the (wicket) web app.  This
starts some scripts in the bacground which bring the  jboss server down,
upgrade the db, upgrade the ear file, etc., and then restart the jboss
server.  When the server comes back up we would like the user to be
redirected to the login page of the app automatically.  The last part does
not work.  At this time we just have a message telling the user to refresh
the page and when everything is ready he will be sent to the login page.

Is there a good robust way to make sure that the page is automatically
refreshed and the login page is presented?  Is it even possible to do it?
Personally I don't think this is not a good idea but this feature is a
requirement and I want to explore it as much as possible.


Appreciate any help.

Thanks.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Handling-page-refresh-or-redirect-when-the-server-reboots-tp4667465.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