Re: page expire / ajax error

2011-10-19 Thread Igor Vaynberg
maybe the two tomcats are sharing a work dir so the two wicket apps
might be sharing disk store files...

-igor

On Tue, Oct 18, 2011 at 7:35 AM, Jonathan Locke
jonathan.lo...@gmail.com wrote:
 I have two wicket applications running on the same box (my laptop, for
 example) with one on port 8880 and one on port 8881. Each application does
 ajax-self-updating. Now, if I start the first application, all is well and
 will stay well forever as far as I can tell. But the exact moment i start up
 the second application, the first application suddenly gets either a page
 expired error (under wicket 1.4) or an error regarding behaviors (under
 wicket 1.5). I've tried this over and over and it's not a fluke. Anyone have
 any idea what's going on? My best guess is that somehow Tomcat is
 misconfigured (I'm starting it embedded)? But how might that be?

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/page-expire-ajax-error-tp3915594p3915594.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



Re: Weblogic deployment

2011-10-19 Thread Wolfgang Schreiner
Thanks guys, removing the white spaces did the trick!




From:
jcgarciam jcgarc...@gmail.com
To:
users@wicket.apache.org
Date:
18.10.2011 16:47
Subject:
Re: Weblogic deployment



Nop, this is a bug in the container no within the wicket framework.

On Tue, Oct 18, 2011 at 11:44 AM, Wolfgang Schreiner [via Apache Wicket] 
ml-node+s1842946n3915620...@n4.nabble.com wrote:

 Ok thanks, will give it a go

 Is there another workaround? Like removing wicket.properties and calling
 the Initializers from code?




 From:
 jcgarciam [hidden email]
http://user/SendEmail.jtp?type=nodenode=3915620i=0

 To:
 [hidden email] http://user/SendEmail.jtp?type=nodenode=3915620i=1
 Date:
 18.10.2011 16:26
 Subject:
 Re: Weblogic deployment



 Weblogic doesn't play well with classpath resouces having space on its
 path.

 As Manuel, suggest try putting your domain in a path without space on it

 On Tue, Oct 18, 2011 at 11:02 AM, manuelbarzi [via Apache Wicket] 
 [hidden email] http://user/SendEmail.jtp?type=nodenode=3915620i=2
 wrote:

  Application.initializeComponents()
 
  may you try running wl in non-blank-spaces path? (zip:C:/Documents[16
  charater here])...)
  .
 
 
 
  On Tue, Oct 18, 2011 at 3:31 PM, Wolfgang Schreiner [hidden email]
 http://user/SendEmail.jtp?type=nodenode=3915471i=0
  wrote:
 
   Hi all,
  
   I am having problems deploying my web application on Weblogic 
10.3.2.
   Everything works fine on 10.3.5 but I am running into the following
   exception when deploying on 10.3.2 - see below
  
   How can I resolve this? And when and where is wicket.properties
 loaded?
 
   Can't find references in the sources ...
  
   Thanks!
  
  
   18.10.2011 14:17 Uhr MESZ Error HTTP BEA-101165 Could not
 load
   user def
   ined filter in web.xml: 
org.apache.wicket.protocol.http.WicketFilter.
   org.apache.wicket.WicketRuntimeException: 
java.net.URISyntaxException:
   Illegal c
   haracter in opaque part at index 16: zip:C:/Documents and
   Settings/schrewo3/Orac
  
 
 
le/Middleware/user_projects/domains/test1/servers/AdminServer/tmp/_WL_user/edoc-


 
   web/11vfn0/war/WEB-INF/lib/wicket-core-1.5.0.jar!/wicket.properties
  at
   
org.apache.wicket.application.AbstractClassResolver.getResources(Abst
   ractClassResolver.java:156)
  at
   
org.apache.wicket.Application.initializeComponents(Application.java:4
   90)
  at
   org.apache.wicket.Application.initApplication(Application.java:806)
  at
   
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:3
   46)
  at
   
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:2
   86)
  Truncated. see log file for complete stacktrace
   Caused By: java.net.URISyntaxException: Illegal character in opaque
 part
   at inde
   x 16: zip:C:/Documents and
   Settings/schrewo3/Oracle/Middleware/user_projects/dom
  
 
 
ains/test1/servers/AdminServer/tmp/_WL_user/edoc-web/11vfn0/war/WEB-INF/lib/wick


 
   et-core-1.5.0.jar!/wicket.properties
  at java.net.URI$Parser.fail(URI.java:2809)
  at java.net.URI$Parser.checkChars(URI.java:2982)
  at java.net.URI$Parser.parse(URI.java:3019)
  at java.net.URI.init(URI.java:578)
  at java.net.URL.toURI(URL.java:918)
  Truncated. see log file for complete stacktrace
 
  -
  To unsubscribe, e-mail: [hidden email]
 http://user/SendEmail.jtp?type=nodenode=3915471i=1
  For additional commands, e-mail: [hidden email]
 http://user/SendEmail.jtp?type=nodenode=3915471i=2
 
 
 
  --
   If you reply to this email, your message will be added to the
 discussion
  below:
 
 

 
http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-palette-tp3859111p3915471.html


   To unsubscribe from Apache Wicket, click here

 
 



 --

 JC


 --
 View this message in context:

 
http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-palette-tp3859111p3915574.html


 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: [hidden email]
http://user/SendEmail.jtp?type=nodenode=3915620i=3
 For additional commands, e-mail: [hidden email]
http://user/SendEmail.jtp?type=nodenode=3915620i=4





 --
  If you reply to this email, your message will be added to the 
discussion
 below:

 
http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-palette-tp3859111p3915620.html

  To unsubscribe from Apache Wicket, click here
http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=1842946code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=
.





-- 

JC


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-palette-tp3859111p3915632.html

Sent from the Users forum mailing list archive at Nabble.com.


MarkupId behavior when replacing component (wicket 1.4)

2011-10-19 Thread Yves-Marie LAINÉ
Hi All,

Yesterday, i wrote a Page that need to ajax replace a component, so with
outputMarkupId at true. This component has to know the markupId when
onInitialize is called (depending of a component used by it that create a
javascript)

I know that when we replace Components, the markupId of the replaced
Component is set on the added one.

But in order to make the added component work on that page, i had to wrote
code like this :


 public void onClick(AjaxRequestTarget target) {

UserDialogPanel userDialogPanel = new
UserDialogPanel(dialog, rowModel);

*
userDialogPanel.setMarkupId(getPage().get(dialog).getMarkupId());*//
This line of code could probably be avoided.


getPage().get(dialog).replaceWith(userDialogPanel);
target.addComponent(userDialogPanel);

userDialogPanel.open(target);
}

And after looking at the wicket code it seems to be normal  :

*public final MarkupContainer replace(final Component child)*
{
checkHierarchyChange(child);

if (child == null)
{
throw new IllegalArgumentException(argument child must be not
null);
}

if (log.isDebugEnabled())
{
log.debug(Replacing  + child.getId() +  in  + this);
}

if (child.getParent() != this)
{
// Add to map
final Component replaced = put(child);

// Look up to make sure it was already in the map
if (replaced == null)
{
throw new WicketRuntimeException(
exceptionMessage(Cannot replace a component which has
not been added: id=' +
child.getId() + ', component= + child));
}

// first remove the component.
removedComponent(replaced);

*// then add the other one.
addedComponent(child); // onInitialize is called in this method*

// The position of the associated markup remains the same
child.markupIndex = replaced.markupIndex;

*// The generated markup id remains the same
child.setMarkupIdImpl(replaced.getMarkupIdImpl()); // and then,
the markupid is replaced.*
}

return this;
}


So if wicket developpers read this, do you think it's possible to improve
this by modifying the sequence and setting the markupId before adding the
component ?
(Sorry for my english, i hope to be clear enough..)

Regards,
Yves-Marie LAINÉ


Re: MarkupId behavior when replacing component (wicket 1.4)

2011-10-19 Thread Martin Grigorov
Hi,

2011/10/19 Yves-Marie LAINÉ ymla...@gmail.com:
 Hi All,

 Yesterday, i wrote a Page that need to ajax replace a component, so with
 outputMarkupId at true. This component has to know the markupId when
 onInitialize is called (depending of a component used by it that create a
 javascript)

 I know that when we replace Components, the markupId of the replaced
 Component is set on the added one.

 But in order to make the added component work on that page, i had to wrote
 code like this :


                             public void onClick(AjaxRequestTarget target) {

                                UserDialogPanel userDialogPanel = new
 UserDialogPanel(dialog, rowModel);

 *
 userDialogPanel.setMarkupId(getPage().get(dialog).getMarkupId());*    //
 This line of code could probably be avoided.


 getPage().get(dialog).replaceWith(userDialogPanel);
                                target.addComponent(userDialogPanel);

                                userDialogPanel.open(target);
                            }

 And after looking at the wicket code it seems to be normal  :

    *public final MarkupContainer replace(final Component child)*
    {
        checkHierarchyChange(child);

        if (child == null)
        {
            throw new IllegalArgumentException(argument child must be not
 null);
        }

        if (log.isDebugEnabled())
        {
            log.debug(Replacing  + child.getId() +  in  + this);
        }

        if (child.getParent() != this)
        {
            // Add to map
            final Component replaced = put(child);

            // Look up to make sure it was already in the map
            if (replaced == null)
            {
                throw new WicketRuntimeException(
                    exceptionMessage(Cannot replace a component which has
 not been added: id=' +
                        child.getId() + ', component= + child));
            }

            // first remove the component.
            removedComponent(replaced);

 *            // then add the other one.
            addedComponent(child); // onInitialize is called in this method*

            // The position of the associated markup remains the same
            child.markupIndex = replaced.markupIndex;

 *            // The generated markup id remains the same
            child.setMarkupIdImpl(replaced.getMarkupIdImpl()); // and then,
 the markupid is replaced.*
        }

        return this;
    }


 So if wicket developpers read this, do you think it's possible to improve
 this by modifying the sequence and setting the markupId before adding the
 component ?
Wicket developer here :-)
Please create a ticket in our Jira to not forget about this request.
But I'm not sure this improvement will go in 1.4.x. 1.4.x is in
maintenance and receives only bug fixes. New features and improvements
go in 1.5.x.
 (Sorry for my english, i hope to be clear enough..)

 Regards,
 Yves-Marie LAINÉ




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



[OT] Wicket Jobs List?

2011-10-19 Thread James Carman
Fellow Wicketeers,

Do we have a special mailing list for Wicket jobs?  I'm looking again
and would like to find a good place to advertise that fact. :)

Thanks,

James Carman

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



Re: [OT] Wicket Jobs List?

2011-10-19 Thread moèz ben rhouma
Hi,
We have a linkedin group Apache
Wickethttp://www.linkedin.com/groups?jobs=gid=80181trk=anet_ug_jobs
and under this group we have a panel jobs

I hope it helps you.

2011/10/19 James Carman ja...@carmanconsulting.com

 Fellow Wicketeers,

 Do we have a special mailing list for Wicket jobs?  I'm looking again
 and would like to find a good place to advertise that fact. :)

 Thanks,

 James Carman

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




-- 
Cdt
Moèz


onInitialize or Constructor

2011-10-19 Thread Josh Kamau
Hi wicketeers ;

Which is the recommended way of initializing page components: onInitialize()
or Constructor ?

regards.
Josh.


Re: MarkupId behavior when replacing component (wicket 1.4)

2011-10-19 Thread Yves-Marie LAINÉ
Ok.  I'll try to check what happens in 1.5.1 in this case, and then create a
ticket.

Thanks !

2011/10/19 Martin Grigorov mgrigo...@apache.org

 Hi,

 2011/10/19 Yves-Marie LAINÉ ymla...@gmail.com:
  Hi All,
 
  Yesterday, i wrote a Page that need to ajax replace a component, so with
  outputMarkupId at true. This component has to know the markupId when
  onInitialize is called (depending of a component used by it that create a
  javascript)
 
  I know that when we replace Components, the markupId of the replaced
  Component is set on the added one.
 
  But in order to make the added component work on that page, i had to
 wrote
  code like this :
 
 
  public void onClick(AjaxRequestTarget target)
 {
 
 UserDialogPanel userDialogPanel = new
  UserDialogPanel(dialog, rowModel);
 
  *
  userDialogPanel.setMarkupId(getPage().get(dialog).getMarkupId());*
  //
  This line of code could probably be avoided.
 
 
  getPage().get(dialog).replaceWith(userDialogPanel);
 target.addComponent(userDialogPanel);
 
 userDialogPanel.open(target);
 }
 
  And after looking at the wicket code it seems to be normal  :
 
 *public final MarkupContainer replace(final Component child)*
 {
 checkHierarchyChange(child);
 
 if (child == null)
 {
 throw new IllegalArgumentException(argument child must be not
  null);
 }
 
 if (log.isDebugEnabled())
 {
 log.debug(Replacing  + child.getId() +  in  + this);
 }
 
 if (child.getParent() != this)
 {
 // Add to map
 final Component replaced = put(child);
 
 // Look up to make sure it was already in the map
 if (replaced == null)
 {
 throw new WicketRuntimeException(
 exceptionMessage(Cannot replace a component which has
  not been added: id=' +
 child.getId() + ', component= + child));
 }
 
 // first remove the component.
 removedComponent(replaced);
 
  *// then add the other one.
 addedComponent(child); // onInitialize is called in this
 method*
 
 // The position of the associated markup remains the same
 child.markupIndex = replaced.markupIndex;
 
  *// The generated markup id remains the same
 child.setMarkupIdImpl(replaced.getMarkupIdImpl()); // and
 then,
  the markupid is replaced.*
 }
 
 return this;
 }
 
 
  So if wicket developpers read this, do you think it's possible to improve
  this by modifying the sequence and setting the markupId before adding the
  component ?
 Wicket developer here :-)
 Please create a ticket in our Jira to not forget about this request.
 But I'm not sure this improvement will go in 1.4.x. 1.4.x is in
 maintenance and receives only bug fixes. New features and improvements
 go in 1.5.x.
  (Sorry for my english, i hope to be clear enough..)
 
  Regards,
  Yves-Marie LAINÉ
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

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




-- 
Yves-Marie LAINÉ


Re: onInitialize or Constructor

2011-10-19 Thread Martin Grigorov
Use onInitialize() if you need access to the parent component or to
the associated markup

On Wed, Oct 19, 2011 at 3:28 PM, Josh Kamau joshnet2...@gmail.com wrote:
 Hi wicketeers ;

 Which is the recommended way of initializing page components: onInitialize()
 or Constructor ?

 regards.
 Josh.




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: onInitialize or Constructor

2011-10-19 Thread Andrea Del Bene

Hi,

when onInitialize is called, component has already been inserted into 
its hierarchy so you can call getParent() or getPage() safely.

Hi wicketeers ;

Which is the recommended way of initializing page components: onInitialize()
or Constructor ?

regards.
Josh.




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



Re: onInitialize or Constructor

2011-10-19 Thread Josh Kamau
Thanks. Its clear now.

On Wed, Oct 19, 2011 at 4:01 PM, Andrea Del Bene adelb...@ciseonweb.itwrote:

 Hi,

 when onInitialize is called, component has already been inserted into its
 hierarchy so you can call getParent() or getPage() safely.

  Hi wicketeers ;

 Which is the recommended way of initializing page components:
 onInitialize()
 or Constructor ?

 regards.
 Josh.



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




Re: Access Denied with AjaxEditableLabel ant AjaxEditableMultiLineLabel under chrome and safari #wicket1.5

2011-10-19 Thread Martin Grigorov
Hi,

The EditableLabel's editor (the text field/area) saves the value on
'blur' event.
It is interesting when this event is fired - when the user leaves the
first tab or when she comes back.

On Wed, Oct 19, 2011 at 12:48 AM, Gaetan Zoritchak
g.zoritc...@moncoachfinance.com wrote:
 The problems occurs under chrome, safari and wicket 1.5.
 Scenario with an AjaxEditableLabel :
 1. The user puts the focus on the AjaxEditableLabel and edit the field.
 2. Without focusing out of the editable label, the user clicks on another
 tab of chrome.
 = the value is not put in the model.

 Scenario with an AjaxEditableMultiLineLabel :
 1. The user puts the focus on the AjaxEditableMultiLineLabel and edit the
 field.
 2. Without focusing out of the editable label, the user clicks on another
 tab of chrome.
 = coming back to the first tab, the browser shows an Access Denied Page.
 The log shows the warn :
 WARN  - RequestListenerInterface   - behavior not enabled; ignore call.
 Behavior
 org.apache.wicket.extensions.ajax.markup.html.AjaxEditableMultiLineLabel$5@18fa85
 at component [ [Component id = editor]]
 After some debugs it appears that under chrome the call on
 isVisibleInHierarchie() returns false.

 These scenario were ok with wicket 1.4

 Gaetan,


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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Dynamic page display based on a configuration in Wicket

2011-10-19 Thread Vasu Srinivasan
Hello,

I am familiar with wicket concepts and have done some basic stuff with it. I
am currently working on a PoC, but not sure how to get this around in
Wicket. In Wicket, the html and java are directly tied between each other.
However I would like to have an external configuration (json or xml) that
would contain the elements of a page (name, age, address etc fields), and
use that configuration to build out the html and tie it to a generic java
class (based on BasePage class). Is this possible in Wicket?

Or as an alternative, I can keep my generic java class, but instead of
having json/xml I could work directly with multiple htmls - that could be
handled by this generic class which delegates to other classes to handle the
page request. I know its slightly different from Wicket approach, but im
trying to see if this is a possibility.

To give an example --

Page1.html (contains name, age, address fields)
Page2.html (contains name, school education details)

Both of them should be handled by a single java file (which may be allowed
to have all of those fields). In effect the htmls may have only a subset of
fields that the page should handle/validate only those that are present in
the html.

thanks for any pointers

Vasya


Re: Dynamic page display based on a configuration in Wicket

2011-10-19 Thread James Carman
If you need inspiration, you can check out the Wicketopia project.  It
dynamically builds forms for beans, but you could easily adapt the
logic to figure out which fields to display from a different source.

On Wed, Oct 19, 2011 at 11:16 AM, Vasu Srinivasan vasy...@gmail.com wrote:
 Hello,

 I am familiar with wicket concepts and have done some basic stuff with it. I
 am currently working on a PoC, but not sure how to get this around in
 Wicket. In Wicket, the html and java are directly tied between each other.
 However I would like to have an external configuration (json or xml) that
 would contain the elements of a page (name, age, address etc fields), and
 use that configuration to build out the html and tie it to a generic java
 class (based on BasePage class). Is this possible in Wicket?

 Or as an alternative, I can keep my generic java class, but instead of
 having json/xml I could work directly with multiple htmls - that could be
 handled by this generic class which delegates to other classes to handle the
 page request. I know its slightly different from Wicket approach, but im
 trying to see if this is a possibility.

 To give an example --

 Page1.html (contains name, age, address fields)
 Page2.html (contains name, school education details)

 Both of them should be handled by a single java file (which may be allowed
 to have all of those fields). In effect the htmls may have only a subset of
 fields that the page should handle/validate only those that are present in
 the html.

 thanks for any pointers

 Vasya


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



Re: Dynamic page display based on a configuration in Wicket

2011-10-19 Thread Vasu Srinivasan
James

Took a quick look,, very interesting.. thanks for the suggestion

On Wed, Oct 19, 2011 at 10:19 AM, James Carman
ja...@carmanconsulting.comwrote:

 If you need inspiration, you can check out the Wicketopia project.  It
 dynamically builds forms for beans, but you could easily adapt the
 logic to figure out which fields to display from a different source.

 On Wed, Oct 19, 2011 at 11:16 AM, Vasu Srinivasan vasy...@gmail.com
 wrote:
  Hello,
 
  I am familiar with wicket concepts and have done some basic stuff with
 it. I
  am currently working on a PoC, but not sure how to get this around in
  Wicket. In Wicket, the html and java are directly tied between each
 other.
  However I would like to have an external configuration (json or xml) that
  would contain the elements of a page (name, age, address etc fields), and
  use that configuration to build out the html and tie it to a generic java
  class (based on BasePage class). Is this possible in Wicket?
 
  Or as an alternative, I can keep my generic java class, but instead of
  having json/xml I could work directly with multiple htmls - that could be
  handled by this generic class which delegates to other classes to handle
 the
  page request. I know its slightly different from Wicket approach, but im
  trying to see if this is a possibility.
 
  To give an example --
 
  Page1.html (contains name, age, address fields)
  Page2.html (contains name, school education details)
 
  Both of them should be handled by a single java file (which may be
 allowed
  to have all of those fields). In effect the htmls may have only a subset
 of
  fields that the page should handle/validate only those that are present
 in
  the html.
 
  thanks for any pointers
 
  Vasya
 

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




-- 
Regards,
Vasu Srinivasan
---
vagartham.blogspot.com
vasya10.wordpress.com


Re: MarkupId behavior when replacing component (wicket 1.4)

2011-10-19 Thread Igor Vaynberg
no need, fixed in trunk (1.5.2)

-igor

2011/10/19 Yves-Marie LAINÉ ymla...@gmail.com:
 Ok.  I'll try to check what happens in 1.5.1 in this case, and then create a
 ticket.

 Thanks !

 2011/10/19 Martin Grigorov mgrigo...@apache.org

 Hi,

 2011/10/19 Yves-Marie LAINÉ ymla...@gmail.com:
  Hi All,
 
  Yesterday, i wrote a Page that need to ajax replace a component, so with
  outputMarkupId at true. This component has to know the markupId when
  onInitialize is called (depending of a component used by it that create a
  javascript)
 
  I know that when we replace Components, the markupId of the replaced
  Component is set on the added one.
 
  But in order to make the added component work on that page, i had to
 wrote
  code like this :
 
 
                              public void onClick(AjaxRequestTarget target)
 {
 
                                 UserDialogPanel userDialogPanel = new
  UserDialogPanel(dialog, rowModel);
 
  *
  userDialogPanel.setMarkupId(getPage().get(dialog).getMarkupId());*
  //
  This line of code could probably be avoided.
 
 
  getPage().get(dialog).replaceWith(userDialogPanel);
                                 target.addComponent(userDialogPanel);
 
                                 userDialogPanel.open(target);
                             }
 
  And after looking at the wicket code it seems to be normal  :
 
     *public final MarkupContainer replace(final Component child)*
     {
         checkHierarchyChange(child);
 
         if (child == null)
         {
             throw new IllegalArgumentException(argument child must be not
  null);
         }
 
         if (log.isDebugEnabled())
         {
             log.debug(Replacing  + child.getId() +  in  + this);
         }
 
         if (child.getParent() != this)
         {
             // Add to map
             final Component replaced = put(child);
 
             // Look up to make sure it was already in the map
             if (replaced == null)
             {
                 throw new WicketRuntimeException(
                     exceptionMessage(Cannot replace a component which has
  not been added: id=' +
                         child.getId() + ', component= + child));
             }
 
             // first remove the component.
             removedComponent(replaced);
 
  *            // then add the other one.
             addedComponent(child); // onInitialize is called in this
 method*
 
             // The position of the associated markup remains the same
             child.markupIndex = replaced.markupIndex;
 
  *            // The generated markup id remains the same
             child.setMarkupIdImpl(replaced.getMarkupIdImpl()); // and
 then,
  the markupid is replaced.*
         }
 
         return this;
     }
 
 
  So if wicket developpers read this, do you think it's possible to improve
  this by modifying the sequence and setting the markupId before adding the
  component ?
 Wicket developer here :-)
 Please create a ticket in our Jira to not forget about this request.
 But I'm not sure this improvement will go in 1.4.x. 1.4.x is in
 maintenance and receives only bug fixes. New features and improvements
 go in 1.5.x.
  (Sorry for my english, i hope to be clear enough..)
 
  Regards,
  Yves-Marie LAINÉ
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

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




 --
 Yves-Marie LAINÉ


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



ClassCastException: wicket.in.action.CheesrSession cannot be cast to wicket.in.action.CheesrSession

2011-10-19 Thread Filipe Sousa
Hi,

I'm doing my first experiments with wicket. I'm testing the example in
chapter 3 (Wicket in Action) with eclipse and embedded jetty. The
wicket version I'm using is 1.3.7. The example provided works quite
well except when I make a change and redeploy it to jetty. Then I get
an unexpected RuntimeException. The only way to get the changes
working is with a server restart.

Wicket is running in DEVELOPMENT mode.

ERROR o.a.w.RequestCycle Error calling method: public
wicket.in.action.Cart wicket.in.action.CheesrPage.getCart() on object:
[Page class = wicket.in.action.Index, id = 0, version = 4, ajax = 0]
org.apache.wicket.WicketRuntimeException: Error calling method: public
wicket.in.action.Cart wicket.in.action.CheesrPage.getCart() on object:
[Page class = wicket.in.action.Index, id = 0, version = 4, ajax = 0]
at 
org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.getValue(PropertyResolver.java:1066)
~[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:252)
~[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:91)
~[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:113)
~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.getModelObject(Component.java:1565)
~[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:217)
~[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:524)
~[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:127)
~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.internalBeforeRender(Component.java:1009)
~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.beforeRender(Component.java:1041)
~[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1590)
~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.onBeforeRender(Component.java:3727)
~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Page.onBeforeRender(Page.java:1458)
~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.internalBeforeRender(Component.java:1009)
~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.beforeRender(Component.java:1041)
~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.prepareForRender(Component.java:2167)
~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Page.renderPage(Page.java:892) 
~[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.request.target.component.PageRequestTarget.respond(PageRequestTarget.java:63)
~[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
~[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1245)
[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1316)
[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1418)
[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.RequestCycle.request(RequestCycle.java:532)
[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:356)
[wicket-1.3.7.jar:1.3.7]
at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:201)
[wicket-1.3.7.jar:1.3.7]
at 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1329)
[jetty-servlet-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
[jetty-servlet-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
[jetty-server-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
[jetty-security-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
[jetty-server-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940)
[jetty-server-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
[jetty-servlet-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
[jetty-server-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874)
[jetty-server-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)

Re: ClassCastException: wicket.in.action.CheesrSession cannot be cast to wicket.in.action.CheesrSession

2011-10-19 Thread Matthias Gasser
Hello,

Your wicket version is fairly old. Please try the latest 1.5 release... Have a 
look at the wicket examples they provide a very good starting point.

Cheers, Matthias

--
iPhone Mail


On 19.10.2011, at 18:17, Filipe Sousa nat...@gmail.com wrote:

 Hi,
 
 I'm doing my first experiments with wicket. I'm testing the example in
 chapter 3 (Wicket in Action) with eclipse and embedded jetty. The
 wicket version I'm using is 1.3.7. The example provided works quite
 well except when I make a change and redeploy it to jetty. Then I get
 an unexpected RuntimeException. The only way to get the changes
 working is with a server restart.
 
 Wicket is running in DEVELOPMENT mode.
 
 ERROR o.a.w.RequestCycle Error calling method: public
 wicket.in.action.Cart wicket.in.action.CheesrPage.getCart() on object:
 [Page class = wicket.in.action.Index, id = 0, version = 4, ajax = 0]
 org.apache.wicket.WicketRuntimeException: Error calling method: public
 wicket.in.action.Cart wicket.in.action.CheesrPage.getCart() on object:
 [Page class = wicket.in.action.Index, id = 0, version = 4, ajax = 0]
at 
 org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.getValue(PropertyResolver.java:1066)
 ~[wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:252)
 ~[wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:91)
 ~[wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:113)
 ~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.getModelObject(Component.java:1565)
 ~[wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:217)
 ~[wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:524)
 ~[wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:127)
 ~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.internalBeforeRender(Component.java:1009)
 ~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.beforeRender(Component.java:1041)
 ~[wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1590)
 ~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.onBeforeRender(Component.java:3727)
 ~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Page.onBeforeRender(Page.java:1458)
 ~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.internalBeforeRender(Component.java:1009)
 ~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.beforeRender(Component.java:1041)
 ~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Component.prepareForRender(Component.java:2167)
 ~[wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.Page.renderPage(Page.java:892) 
 ~[wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.request.target.component.PageRequestTarget.respond(PageRequestTarget.java:63)
 ~[wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
 ~[wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1245)
 [wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1316)
 [wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1418)
 [wicket-1.3.7.jar:1.3.7]
at org.apache.wicket.RequestCycle.request(RequestCycle.java:532)
 [wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:356)
 [wicket-1.3.7.jar:1.3.7]
at 
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:201)
 [wicket-1.3.7.jar:1.3.7]
at 
 org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1329)
 [jetty-servlet-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
 org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
 [jetty-servlet-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
 org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
 [jetty-server-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
 org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
 [jetty-security-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
 org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
 [jetty-server-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
 org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940)
 [jetty-server-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
 org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
 [jetty-servlet-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
 org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
 [jetty-server-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
 

Re: ClassCastException: wicket.in.action.CheesrSession cannot be cast to wicket.in.action.CheesrSession

2011-10-19 Thread Filipe Sousa
Hi,

I know that 1.3 is not the latest version, but I think that's the
version used in the book. Since I am learning wicket I don't want to
deal with compatibility issues.

I tried the latest version (1.5.1) and the result is worse. If I
refresh the browser 3 times I get the same exception and this time I
didn't have to redeploy.

What strikes me is that the wicket can not cast
wicket.in.action.CheesrSession to wicket.in.action.CheesrSession

public class CheesrSession extends WebSession {
private Cart cart = new Cart();

public CheesrSession(Request request) {
super(request);
}

public Cart getCart() {
return cart;
}
}

ERROR o.a.w.Component Error while getting default model object for
Component: [ [Component id = cart, page = wicket.in.action.Index, path
= 2:cart.Index$2, isVisible = true, isVersioned = true]]
ERROR o.a.w.DefaultExceptionMapper Unexpected error occurred
org.apache.wicket.WicketRuntimeException: Error calling method: public
wicket.in.action.Cart wicket.in.action.CheesrPage.getCart() on object:
[Page class = wicket.in.action.Index, id = 2, render count = 2]
at 
org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.getValue(PropertyResolver.java:1128)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:305)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:244)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:97)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:134)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.Component.getDefaultModelObject(Component.java:1639)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:219)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:473)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:119)
~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Component.internalBeforeRender(Component.java:980)
~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Component.beforeRender(Component.java:1014)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1785)
~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Component.onBeforeRender(Component.java:3772)
~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Page.onBeforeRender(Page.java:823)
~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Component.internalBeforeRender(Component.java:980)
~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Component.beforeRender(Component.java:1014)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.Component.internalPrepareForRender(Component.java:2182)
~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Page.internalPrepareForRender(Page.java:280)
~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Component.render(Component.java:2269)
~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Page.renderPage(Page.java:1035)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:182)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:147)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:712)
~[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
~[wicket-request-1.5.1.jar:1.5.1]
at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:208)
[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:251)
[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
[wicket-core-1.5.1.jar:1.5.1]
at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
[wicket-core-1.5.1.jar:1.5.1]
at 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1329)
[jetty-servlet-7.5.3.v20111011.jar:7.5.3.v20111011]
at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
[jetty-servlet-7.5.3.v20111011.jar:7.5.3.v20111011]
at 

Re: ClassCastException: wicket.in.action.CheesrSession cannot be cast to wicket.in.action.CheesrSession

2011-10-19 Thread Igor Vaynberg
On Wed, Oct 19, 2011 at 12:55 PM, Filipe Sousa nat...@gmail.com wrote:
 Hi,

 I know that 1.3 is not the latest version, but I think that's the
 version used in the book. Since I am learning wicket I don't want to
 deal with compatibility issues.

 I tried the latest version (1.5.1) and the result is worse. If I
 refresh the browser 3 times I get the same exception and this time I
 didn't have to redeploy.

 What strikes me is that the wicket can not cast
 wicket.in.action.CheesrSession to wicket.in.action.CheesrSession

you either somehow have two of these on your classpath or tomcate
creates another one via a different classloader and then you have a
class from one classloader trying to cast to a class loaded from
another one...its probably an environment problem :/

-igor


 public class CheesrSession extends WebSession {
        private Cart cart = new Cart();

        public CheesrSession(Request request) {
                super(request);
        }

        public Cart getCart() {
                return cart;
        }
 }

 ERROR o.a.w.Component Error while getting default model object for
 Component: [ [Component id = cart, page = wicket.in.action.Index, path
 = 2:cart.Index$2, isVisible = true, isVersioned = true]]
 ERROR o.a.w.DefaultExceptionMapper Unexpected error occurred
 org.apache.wicket.WicketRuntimeException: Error calling method: public
 wicket.in.action.Cart wicket.in.action.CheesrPage.getCart() on object:
 [Page class = wicket.in.action.Index, id = 2, render count = 2]
        at 
 org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.getValue(PropertyResolver.java:1128)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:305)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:244)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:97)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:134)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.Component.getDefaultModelObject(Component.java:1639)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:219)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:473)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:119)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at org.apache.wicket.Component.internalBeforeRender(Component.java:980)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at org.apache.wicket.Component.beforeRender(Component.java:1014)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1785)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at org.apache.wicket.Component.onBeforeRender(Component.java:3772)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at org.apache.wicket.Page.onBeforeRender(Page.java:823)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at org.apache.wicket.Component.internalBeforeRender(Component.java:980)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at org.apache.wicket.Component.beforeRender(Component.java:1014)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.Component.internalPrepareForRender(Component.java:2182)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at org.apache.wicket.Page.internalPrepareForRender(Page.java:280)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at org.apache.wicket.Component.render(Component.java:2269)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at org.apache.wicket.Page.renderPage(Page.java:1035)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:182)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:147)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:712)
 ~[wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
 ~[wicket-request-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:208)
 [wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:251)
 [wicket-core-1.5.1.jar:1.5.1]
        at 
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
 [wicket-core-1.5.1.jar:1.5.1]
        at 
 

Re: ClassCastException: wicket.in.action.CheesrSession cannot be cast to wicket.in.action.CheesrSession

2011-10-19 Thread Deniz Oğuz
I have also tried same examples without any issues. Try it on another server
instance or completely different server. There should be someting wrong in
your jetty, eclipse combination. This kind of classcastexceptions (can not
cast A to A) are a result of class loader hierarchy of app servers. Some how
same class is loaded by 2 different class loaders.

On Oct 19, 2011 10:56 PM, Filipe Sousa nat...@gmail.com wrote:

 Hi,

 I know that 1.3 is not the latest version, but I think that's the
 version used in the book. Since I am learning wicket I don't want to
 deal with compatibility issues.

 I tried the latest version (1.5.1) and the result is worse. If I
 refresh the browser 3 times I get the same exception and this time I
 didn't have to redeploy.

 What strikes me is that the wicket can not cast
 wicket.in.action.CheesrSession to wicket.in.action.CheesrSession

 public class CheesrSession extends WebSession {
private Cart cart = new Cart();

public CheesrSession(Request request) {
super(request);
}

public Cart getCart() {
return cart;
}
 }

 ERROR o.a.w.Component Error while getting default model object for
 Component: [ [Component id = cart, page = wicket.in.action.Index, path
 = 2:cart.Index$2, isVisible = true, isVersioned = true]]
 ERROR o.a.w.DefaultExceptionMapper Unexpected error occurred
 org.apache.wicket.WicketRuntimeException: Error calling method: public
 wicket.in.action.Cart wicket.in.action.CheesrPage.getCart() on object:
 [Page class = wicket.in.action.Index, id = 2, render count = 2]
at
org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.getValue(PropertyResolver.java:1128)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:305)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:244)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:97)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:134)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.Component.getDefaultModelObject(Component.java:1639)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:219)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:473)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:119)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.Component.internalBeforeRender(Component.java:980)
 ~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Component.beforeRender(Component.java:1014)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1785)
 ~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Component.onBeforeRender(Component.java:3772)
 ~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Page.onBeforeRender(Page.java:823)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.Component.internalBeforeRender(Component.java:980)
 ~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Component.beforeRender(Component.java:1014)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.Component.internalPrepareForRender(Component.java:2182)
 ~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Page.internalPrepareForRender(Page.java:280)
 ~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Component.render(Component.java:2269)
 ~[wicket-core-1.5.1.jar:1.5.1]
at org.apache.wicket.Page.renderPage(Page.java:1035)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:182)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:147)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:712)
 ~[wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
 ~[wicket-request-1.5.1.jar:1.5.1]
at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:208)
 [wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:251)
 [wicket-core-1.5.1.jar:1.5.1]
at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
 [wicket-core-1.5.1.jar:1.5.1]
 

Re: ClassCastException: wicket.in.action.CheesrSession cannot be cast to wicket.in.action.CheesrSession

2011-10-19 Thread Filipe Sousa
On Wed, Oct 19, 2011 at 9:04 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:

 you either somehow have two of these on your classpath or tomcate
 creates another one via a different classloader and then you have a
 class from one classloader trying to cast to a class loaded from
 another one...its probably an environment problem :/

 -igor

Hello Igor,

I'm not using tomcat but jetty.

I'm using apache ivy for dependencies and the only jars I have in classpath are:
geronimo-jta_1.1_spec-1.1.1.jar
jetty-continuation-7.5.3.v20111011.jar
jetty-deploy-7.5.3.v20111011.jar
jetty-http-7.5.3.v20111011.jar
jetty-io-7.5.3.v20111011.jar
jetty-jndi-7.5.3.v20111011.jar
jetty-plus-7.5.3.v20111011.jar
jetty-security-7.5.3.v20111011.jar
jetty-server-7.5.3.v20111011.jar
jetty-servlet-7.5.3.v20111011.jar
jetty-util-7.5.3.v20111011.jar
jetty-webapp-7.5.3.v20111011.jar
jetty-xml-7.5.3.v20111011.jar
logback-classic-0.9.30.jar
logback-core-0.9.30.jar
mail-1.4.1.jar
servlet-api-2.5.jar
slf4j-api-1.6.2.jar
wicket-core-1.5.1.jar
wicket-request-1.5.1.jar
wicket-util-1.5.1.jar

The command line that starts jetty inside eclipse:
 /usr/lib/jvm/java-1.6.0-sun-1.6.0.27.x86_64/bin/java
-agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:44305
-XX:+CMSClassUnloadingEnabled -XX:PermSize=64M -XX:MaxPermSize=128M
-Dlogback.configurationFile=etc/logback.xml -Dfile.encoding=UTF-8
-classpath 
/home/fsousa/workspace/wicket/WebContent/WEB-INF/classes:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-core/jars/wicket-core-1.5.1.jar:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-util/jars/wicket-util-1.5.1.jar:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-request/jars/wicket-request-1.5.1.jar:/home/fsousa/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-0.9.30.jar:/home/fsousa/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-0.9.30.jar:/home/fsousa/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.2.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-webapp/jars/jetty-webapp-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-xml/jars/jetty-xml-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-util/jars/jetty-util-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-servlet/jars/jetty-servlet-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-security/jars/jetty-security-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-server/jars/jetty-server-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/javax.servlet/servlet-api/jars/servlet-api-2.5.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-continuation/jars/jetty-continuation-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-http/jars/jetty-http-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-io/jars/jetty-io-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-plus/jars/jetty-plus-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.apache.geronimo.specs/geronimo-jta_1.1_spec/jars/geronimo-jta_1.1_spec-1.1.1.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-jndi/jars/jetty-jndi-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/javax.mail/mail/jars/mail-1.4.1.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-deploy/jars/jetty-deploy-7.5.3.v20111011.jar
org.eclipse.jetty.xml.XmlConfiguration etc/jetty.xml

Thanks
-- 
Filipe Sousa

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



Re: ClassCastException: wicket.in.action.CheesrSession cannot be cast to wicket.in.action.CheesrSession

2011-10-19 Thread Deniz Oğuz
Pass -verbose:gc to your server vm to see from where your class is loaded.
On Oct 19, 2011 11:22 PM, Filipe Sousa nat...@gmail.com wrote:

 On Wed, Oct 19, 2011 at 9:04 PM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:
 
  you either somehow have two of these on your classpath or tomcate
  creates another one via a different classloader and then you have a
  class from one classloader trying to cast to a class loaded from
  another one...its probably an environment problem :/
 
  -igor

 Hello Igor,

 I'm not using tomcat but jetty.

 I'm using apache ivy for dependencies and the only jars I have in classpath
 are:
 geronimo-jta_1.1_spec-1.1.1.jar
 jetty-continuation-7.5.3.v20111011.jar
 jetty-deploy-7.5.3.v20111011.jar
 jetty-http-7.5.3.v20111011.jar
 jetty-io-7.5.3.v20111011.jar
 jetty-jndi-7.5.3.v20111011.jar
 jetty-plus-7.5.3.v20111011.jar
 jetty-security-7.5.3.v20111011.jar
 jetty-server-7.5.3.v20111011.jar
 jetty-servlet-7.5.3.v20111011.jar
 jetty-util-7.5.3.v20111011.jar
 jetty-webapp-7.5.3.v20111011.jar
 jetty-xml-7.5.3.v20111011.jar
 logback-classic-0.9.30.jar
 logback-core-0.9.30.jar
 mail-1.4.1.jar
 servlet-api-2.5.jar
 slf4j-api-1.6.2.jar
 wicket-core-1.5.1.jar
 wicket-request-1.5.1.jar
 wicket-util-1.5.1.jar

 The command line that starts jetty inside eclipse:
  /usr/lib/jvm/java-1.6.0-sun-1.6.0.27.x86_64/bin/java
 -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:44305
 -XX:+CMSClassUnloadingEnabled -XX:PermSize=64M -XX:MaxPermSize=128M
 -Dlogback.configurationFile=etc/logback.xml -Dfile.encoding=UTF-8
 -classpath
 /home/fsousa/workspace/wicket/WebContent/WEB-INF/classes:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-core/jars/wicket-core-1.5.1.jar:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-util/jars/wicket-util-1.5.1.jar:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-request/jars/wicket-request-1.5.1.jar:/home/fsousa/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-0.9.30.jar:/home/fsousa/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-0.9.30.jar:/home/fsousa/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.2.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-webapp/jars/jetty-webapp-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-xml/jars/jetty-xml-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-util/jars/jetty-util-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-servlet/jars/jetty-servlet-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-security/jars/jetty-security-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-server/jars/jetty-server-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/javax.servlet/servlet-api/jars/servlet-api-2.5.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-continuation/jars/jetty-continuation-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-http/jars/jetty-http-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-io/jars/jetty-io-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-plus/jars/jetty-plus-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.apache.geronimo.specs/geronimo-jta_1.1_spec/jars/geronimo-jta_1.1_spec-1.1.1.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-jndi/jars/jetty-jndi-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/javax.mail/mail/jars/mail-1.4.1.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-deploy/jars/jetty-deploy-7.5.3.v20111011.jar
 org.eclipse.jetty.xml.XmlConfiguration etc/jetty.xml

 Thanks
 --
 Filipe Sousa

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




Re: ClassCastException: wicket.in.action.CheesrSession cannot be cast to wicket.in.action.CheesrSession

2011-10-19 Thread Deniz Oğuz
Sorry it should be verbose:class (if it is oracle jre)
On Oct 19, 2011 11:25 PM, Deniz Oğuz denizo...@gmail.com wrote:

 Pass -verbose:gc to your server vm to see from where your class is loaded.
 On Oct 19, 2011 11:22 PM, Filipe Sousa nat...@gmail.com wrote:

 On Wed, Oct 19, 2011 at 9:04 PM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:
 
  you either somehow have two of these on your classpath or tomcate
  creates another one via a different classloader and then you have a
  class from one classloader trying to cast to a class loaded from
  another one...its probably an environment problem :/
 
  -igor

 Hello Igor,

 I'm not using tomcat but jetty.

 I'm using apache ivy for dependencies and the only jars I have in
 classpath are:
 geronimo-jta_1.1_spec-1.1.1.jar
 jetty-continuation-7.5.3.v20111011.jar
 jetty-deploy-7.5.3.v20111011.jar
 jetty-http-7.5.3.v20111011.jar
 jetty-io-7.5.3.v20111011.jar
 jetty-jndi-7.5.3.v20111011.jar
 jetty-plus-7.5.3.v20111011.jar
 jetty-security-7.5.3.v20111011.jar
 jetty-server-7.5.3.v20111011.jar
 jetty-servlet-7.5.3.v20111011.jar
 jetty-util-7.5.3.v20111011.jar
 jetty-webapp-7.5.3.v20111011.jar
 jetty-xml-7.5.3.v20111011.jar
 logback-classic-0.9.30.jar
 logback-core-0.9.30.jar
 mail-1.4.1.jar
 servlet-api-2.5.jar
 slf4j-api-1.6.2.jar
 wicket-core-1.5.1.jar
 wicket-request-1.5.1.jar
 wicket-util-1.5.1.jar

 The command line that starts jetty inside eclipse:
  /usr/lib/jvm/java-1.6.0-sun-1.6.0.27.x86_64/bin/java
 -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:44305
 -XX:+CMSClassUnloadingEnabled -XX:PermSize=64M -XX:MaxPermSize=128M
 -Dlogback.configurationFile=etc/logback.xml -Dfile.encoding=UTF-8
 -classpath
 /home/fsousa/workspace/wicket/WebContent/WEB-INF/classes:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-core/jars/wicket-core-1.5.1.jar:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-util/jars/wicket-util-1.5.1.jar:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-request/jars/wicket-request-1.5.1.jar:/home/fsousa/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-0.9.30.jar:/home/fsousa/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-0.9.30.jar:/home/fsousa/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.2.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-webapp/jars/jetty-webapp-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-xml/jars/jetty-xml-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-util/jars/jetty-util-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-servlet/jars/jetty-servlet-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-security/jars/jetty-security-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-server/jars/jetty-server-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/javax.servlet/servlet-api/jars/servlet-api-2.5.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-continuation/jars/jetty-continuation-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-http/jars/jetty-http-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-io/jars/jetty-io-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-plus/jars/jetty-plus-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.apache.geronimo.specs/geronimo-jta_1.1_spec/jars/geronimo-jta_1.1_spec-1.1.1.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-jndi/jars/jetty-jndi-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/javax.mail/mail/jars/mail-1.4.1.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-deploy/jars/jetty-deploy-7.5.3.v20111011.jar
 org.eclipse.jetty.xml.XmlConfiguration etc/jetty.xml

 Thanks
 --
 Filipe Sousa

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




Wrong path for resources on redirected login page

2011-10-19 Thread bjolletz
Hi,

I have the following setup:

Two pages mounted like follows:
mountPage(App/StartPage, StartPage.class);
mountPage(LoginPage, LoginPage.class);

In my web.xml, I have added a security constraint to the /App/ path and
set up the form-login-page to be /LoginPage.

This means that when I go to the address App/StartPage, tomcat redirects
me to /LoginPage, which is working fine. However, none of my resources are
loaded. The reason seems to be that wicket still believes that my base URL
is /App/, when it should actually be /. The URL shown in the browser
address field is /App/LoginPage?0.

Resources on my LoginPage are loaded with PackageResourceReference, like:
add(new Image(logo, new PackageResourceReference(LoginPage.class,
images/logo.png)));

Other resource, like css, are loaded like:
response.renderCSSReference(new CssResourceReference(LoginPage.class,
style.css));

This approach was working fine in 1.4.18. Right now I'm using 1.5.1.


I know that both the resource handling and URL rendering have been changed
in wicket 1.5, but I haven't been able to figure out what (if anything) I'm
supposed to change to make this work again. Does anyone have any ideas? Or
is there a better way to set up things?

I've been looking at this case, it feels similar to my problem but if it was
the same it should have been fixed in 1.5.1:
https://issues.apache.org/jira/browse/WICKET-4030

I hope this is understandable. Thank you for any input on this!



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wrong-path-for-resources-on-redirected-login-page-tp3920038p3920038.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: wicket + jasper reports

2011-10-19 Thread Paul Szulc
Ok, below the code I use to create a link that allows to download pdf file
created by jasper on runtime. Hope it helps. Do not hesitate to ask
questions.


public class PdfGenerateLink extends ResourceLinkVoid {

public PdfGenerateLink(final String id, final IModelBid model, final
PdfBuilderFromBidCreator creator) {

super(id, new WebResource() {
@Override
public IResourceStream getResourceStream() {
IResourceStream resourceStream = new
AbstractResourceStreamWriter() {

public void write(OutputStream output) {
try {
generate(output, model.getObject());
} catch (Exception e) {
throw new RuntimeException(e);
}
}

private void generate(OutputStream output, Bid bid)
throws Exception {
PdfOfertaDocumentBuilder pdf = creator.create(bid);
InputStream generate = pdf.generate();
byte[] buffer = new byte[1024];
while (generate.read(buffer) != -1) {
output.write(buffer);
}
generate.close();
}

public String getContentType() {
return application/pdf;
}
};

return resourceStream;
}

@Override
protected void setHeaders(WebResponse response) {
super.setHeaders(response);
response.setCharacterEncoding(UFT-8);
response.setHeader(Expires, 0);
response.setHeader(Cache-Control, no-cache);
response.setHeader(Cache-Control, must-revalidate,
post-check=0, pre-check=0);
response.setHeader(Pragma, public);

response.setAttachmentHeader(model.getObject().getPublicTask().getName().replace(
, _) + .pdf);
}
});
add(createImage(icon, pdficon16.png));
}
}

On Tue, Oct 18, 2011 at 8:43 PM, Jim Pinkham pinkh...@gmail.com wrote:

 Paul,

 I am doing something very similar - I'd be interested to know more about
 how you got this working - here is what I've got that works for now, but I'm
 not real happy with it:

 In my report forms, I have buttons like this:  (details about params
 omitted - nothing fancy there)

 add(new MyReportResourceButton(pdf, new
 ReportResource(MyReport, new PdfResourceHandler()), paramsModel));
 add(new MyReportResourceButton(xls, new
 ReportResource(MyReport, new XlsResourceHandler()), paramsModel));

 (So it will load MyReport.jasper that was compiled and put into resources
 folder by maven plugin during build)

 MyReportResourceButton has this:
 @Override
 public final void onResourceRequested() {
 MapString,Object params = paramsModel.getObject();
 resource.setReportParameters(params);
 super.onResourceRequested();
 }

 and it's superclass MyResourceButton has this:
 @Override
 public void onSubmit() {
 onResourceRequested();
 }

 /**
  * @see org.apache.wicket.IResourceListener#onResourceRequested()
  */
 public void onResourceRequested()
 {
 Attributes a = new Attributes(RequestCycle.get().getRequest(),
 RequestCycle.get()
 .getResponse(), null);
 resource.respond(a);
 }


 At runtime, it basically works, however, it gives me this annoying message
 in my logs multiple times per report request after the report has been
 served and it appears to be trying to just stay on the same page:

 2011-10-13 15:22:42,381 [http-80-12] ERROR
 org.apache.wicket.DefaultExceptionMapper - Unexpected error occurred
 java.lang.IllegalStateException: Header was already written to response!
 at
 org.apache.wicket.protocol.http.HeaderBufferingWebResponse.checkHeader(HeaderBufferingWebResponse.java:64)
 at
 org.apache.wicket.protocol.http.HeaderBufferingWebResponse.sendRedirect(HeaderBufferingWebResponse.java:112)
 at
 org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:136)
 at
 org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:261)
 at
 org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:139)
 at
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:717)
 at
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
 at
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:96)
 at
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
 at
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253)
 at
 

Re: ClassCastException: wicket.in.action.CheesrSession cannot be cast to wicket.in.action.CheesrSession

2011-10-19 Thread Filipe Sousa
I stated jetty from command line (no eclipse)

$ /usr/lib/jvm/java-1.6.0-sun-1.6.0.27.x86_64/bin/java
-Dlogback.configurationFile=etc/logback.xml -verbose:class
-Dfile.encoding=UTF-8 -classpath
/home/fsousa/workspace/wicket/WebContent/WEB-INF/classes:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-core/jars/wicket-core-1.5.1.jar:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-util/jars/wicket-util-1.5.1.jar:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-request/jars/wicket-request-1.5.1.jar:/home/fsousa/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-0.9.30.jar:/home/fsousa/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-0.9.30.jar:/home/fsousa/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.2.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-webapp/jars/jetty-webapp-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-xml/jars/jetty-xml-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-util/jars/jetty-util-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-servlet/jars/jetty-servlet-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-security/jars/jetty-security-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-server/jars/jetty-server-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/javax.servlet/servlet-api/jars/servlet-api-2.5.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-continuation/jars/jetty-continuation-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-http/jars/jetty-http-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-io/jars/jetty-io-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-plus/jars/jetty-plus-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.apache.geronimo.specs/geronimo-jta_1.1_spec/jars/geronimo-jta_1.1_spec-1.1.1.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-jndi/jars/jetty-jndi-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/javax.mail/mail/jars/mail-1.4.1.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-deploy/jars/jetty-deploy-7.5.3.v20111011.jar
org.eclipse.jetty.xml.XmlConfiguration etc/jetty.xml  verbose

Then I opened http://localhost:8080/wicket/ in browser and I can see
that the example works.
Next I refresh the browser and no problems
Refresh the browser again and I get the exception

$ grep CheesrSession verbose
[Loaded wicket.in.action.CheesrSession from
file:/home/fsousa/workspace/wicket/WebContent/WEB-INF/classes/]
[Loaded wicket.in.action.CheesrSession from
file:/home/fsousa/workspace/wicket/WebContent/WEB-INF/classes/]
Caused by: java.lang.ClassCastException:
wicket.in.action.CheesrSession cannot be cast to
wicket.in.action.CheesrSession

On Wed, Oct 19, 2011 at 9:27 PM, Deniz Oğuz denizo...@gmail.com wrote:
 Sorry it should be verbose:class (if it is oracle jre)
 On Oct 19, 2011 11:25 PM, Deniz Oğuz denizo...@gmail.com wrote:

 Pass -verbose:gc to your server vm to see from where your class is loaded.
 On Oct 19, 2011 11:22 PM, Filipe Sousa nat...@gmail.com wrote:

 On Wed, Oct 19, 2011 at 9:04 PM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:
 
  you either somehow have two of these on your classpath or tomcate
  creates another one via a different classloader and then you have a
  class from one classloader trying to cast to a class loaded from
  another one...its probably an environment problem :/
 
  -igor

 Hello Igor,

 I'm not using tomcat but jetty.

 I'm using apache ivy for dependencies and the only jars I have in
 classpath are:
 geronimo-jta_1.1_spec-1.1.1.jar
 jetty-continuation-7.5.3.v20111011.jar
 jetty-deploy-7.5.3.v20111011.jar
 jetty-http-7.5.3.v20111011.jar
 jetty-io-7.5.3.v20111011.jar
 jetty-jndi-7.5.3.v20111011.jar
 jetty-plus-7.5.3.v20111011.jar
 jetty-security-7.5.3.v20111011.jar
 jetty-server-7.5.3.v20111011.jar
 jetty-servlet-7.5.3.v20111011.jar
 jetty-util-7.5.3.v20111011.jar
 jetty-webapp-7.5.3.v20111011.jar
 jetty-xml-7.5.3.v20111011.jar
 logback-classic-0.9.30.jar
 logback-core-0.9.30.jar
 mail-1.4.1.jar
 servlet-api-2.5.jar
 slf4j-api-1.6.2.jar
 wicket-core-1.5.1.jar
 wicket-request-1.5.1.jar
 wicket-util-1.5.1.jar

 The command line that starts jetty inside eclipse:
  /usr/lib/jvm/java-1.6.0-sun-1.6.0.27.x86_64/bin/java
 -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:44305
 -XX:+CMSClassUnloadingEnabled -XX:PermSize=64M -XX:MaxPermSize=128M
 -Dlogback.configurationFile=etc/logback.xml -Dfile.encoding=UTF-8
 -classpath
 

Re: Wrong path for resources on redirected login page

2011-10-19 Thread bjolletz
Addition to my post above:

I noticed that the browser URL seems to be the same in both 1.4.18 and
1.5.1:
/App/LoginPage

But, in 1.4.18 the resource links looked something like this:
../resources/se.app.LoginPage/images/logo.png

while in 1.5.1 it looks lke this:
wicket/resource/se.app.LoginPage/images/logo-ver-1319057388417.png

So, no ../ in 1.5.1 which I guess is what's causing my problems. In 1.4.18
it seems that wicket automagically solved the resource path issue.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wrong-path-for-resources-on-redirected-login-page-tp3920038p3920126.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: ClassCastException: wicket.in.action.CheesrSession cannot be cast to wicket.in.action.CheesrSession

2011-10-19 Thread Filipe Sousa
Here is the eclipse project with all jars included. Launch
configurations included
http://dl.dropbox.com/u/5176435/wicket.tar.gz

On Wed, Oct 19, 2011 at 9:49 PM, Filipe Sousa nat...@gmail.com wrote:
 I stated jetty from command line (no eclipse)

 $ /usr/lib/jvm/java-1.6.0-sun-1.6.0.27.x86_64/bin/java
 -Dlogback.configurationFile=etc/logback.xml -verbose:class
 -Dfile.encoding=UTF-8 -classpath
 /home/fsousa/workspace/wicket/WebContent/WEB-INF/classes:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-core/jars/wicket-core-1.5.1.jar:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-util/jars/wicket-util-1.5.1.jar:/home/fsousa/.ivy2/cache/org.apache.wicket/wicket-request/jars/wicket-request-1.5.1.jar:/home/fsousa/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-0.9.30.jar:/home/fsousa/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-0.9.30.jar:/home/fsousa/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.2.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-webapp/jars/jetty-webapp-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-xml/jars/jetty-xml-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-util/jars/jetty-util-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-servlet/jars/jetty-servlet-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-security/jars/jetty-security-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-server/jars/jetty-server-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/javax.servlet/servlet-api/jars/servlet-api-2.5.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-continuation/jars/jetty-continuation-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-http/jars/jetty-http-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-io/jars/jetty-io-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-plus/jars/jetty-plus-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/org.apache.geronimo.specs/geronimo-jta_1.1_spec/jars/geronimo-jta_1.1_spec-1.1.1.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-jndi/jars/jetty-jndi-7.5.3.v20111011.jar:/home/fsousa/.ivy2/cache/javax.mail/mail/jars/mail-1.4.1.jar:/home/fsousa/.ivy2/cache/org.eclipse.jetty/jetty-deploy/jars/jetty-deploy-7.5.3.v20111011.jar
 org.eclipse.jetty.xml.XmlConfiguration etc/jetty.xml  verbose

 Then I opened http://localhost:8080/wicket/ in browser and I can see
 that the example works.
 Next I refresh the browser and no problems
 Refresh the browser again and I get the exception

 $ grep CheesrSession verbose
 [Loaded wicket.in.action.CheesrSession from
 file:/home/fsousa/workspace/wicket/WebContent/WEB-INF/classes/]
 [Loaded wicket.in.action.CheesrSession from
 file:/home/fsousa/workspace/wicket/WebContent/WEB-INF/classes/]
 Caused by: java.lang.ClassCastException:
 wicket.in.action.CheesrSession cannot be cast to
 wicket.in.action.CheesrSession

 On Wed, Oct 19, 2011 at 9:27 PM, Deniz Oğuz denizo...@gmail.com wrote:
 Sorry it should be verbose:class (if it is oracle jre)
 On Oct 19, 2011 11:25 PM, Deniz Oğuz denizo...@gmail.com wrote:

 Pass -verbose:gc to your server vm to see from where your class is loaded.
 On Oct 19, 2011 11:22 PM, Filipe Sousa nat...@gmail.com wrote:

 On Wed, Oct 19, 2011 at 9:04 PM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:
 
  you either somehow have two of these on your classpath or tomcate
  creates another one via a different classloader and then you have a
  class from one classloader trying to cast to a class loaded from
  another one...its probably an environment problem :/
 
  -igor

 Hello Igor,

 I'm not using tomcat but jetty.

 I'm using apache ivy for dependencies and the only jars I have in
 classpath are:
 geronimo-jta_1.1_spec-1.1.1.jar
 jetty-continuation-7.5.3.v20111011.jar
 jetty-deploy-7.5.3.v20111011.jar
 jetty-http-7.5.3.v20111011.jar
 jetty-io-7.5.3.v20111011.jar
 jetty-jndi-7.5.3.v20111011.jar
 jetty-plus-7.5.3.v20111011.jar
 jetty-security-7.5.3.v20111011.jar
 jetty-server-7.5.3.v20111011.jar
 jetty-servlet-7.5.3.v20111011.jar
 jetty-util-7.5.3.v20111011.jar
 jetty-webapp-7.5.3.v20111011.jar
 jetty-xml-7.5.3.v20111011.jar
 logback-classic-0.9.30.jar
 logback-core-0.9.30.jar
 mail-1.4.1.jar
 servlet-api-2.5.jar
 slf4j-api-1.6.2.jar
 wicket-core-1.5.1.jar
 wicket-request-1.5.1.jar
 wicket-util-1.5.1.jar

 The command line that starts jetty inside eclipse:
  /usr/lib/jvm/java-1.6.0-sun-1.6.0.27.x86_64/bin/java
 -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:44305
 -XX:+CMSClassUnloadingEnabled -XX:PermSize=64M -XX:MaxPermSize=128M
 -Dlogback.configurationFile=etc/logback.xml -Dfile.encoding=UTF-8
 -classpath
 

Re: Wrong path for resources on redirected login page

2011-10-19 Thread Igor Vaynberg
first try with 1.5.2 candidate (see the vote thread on @dev for where
to get the artifacts). if it still doesnt work post a jira bug and
attach a quickstart.

-igor


On Wed, Oct 19, 2011 at 1:55 PM, bjolletz daniel.akerl...@pagero.com wrote:
 Addition to my post above:

 I noticed that the browser URL seems to be the same in both 1.4.18 and
 1.5.1:
 /App/LoginPage

 But, in 1.4.18 the resource links looked something like this:
 ../resources/se.app.LoginPage/images/logo.png

 while in 1.5.1 it looks lke this:
 wicket/resource/se.app.LoginPage/images/logo-ver-1319057388417.png

 So, no ../ in 1.5.1 which I guess is what's causing my problems. In 1.4.18
 it seems that wicket automagically solved the resource path issue.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wrong-path-for-resources-on-redirected-login-page-tp3920038p3920126.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



POST-only StatelessForm

2011-10-19 Thread Chris Hansen
Is there a way to create a StatelessForm that can *only* be submitted via
POST?

The current behavior of StatelessForm is to allow the form to be submitted
via GET even if the form's method is POST. I've provided two examples of
this behavior below (one each for Wicket 1.4 and 1.5). When you visit the
URIs below in a browser, you'll notice an error on the page that a
required field is missing. This indicates the form has been submitted via
GET (i.e. just by visiting the URI). So far I've found no way to prevent a
StatelessForm from being submitted via GET, but I'm not a Wicket power
user by any means so I'm hoping someone can help.

Wicket 1.4 example:
http://wicketstuff.org/wicket14/stateless/?wicket:bookmarkablePage=:org.apa
che.wicket.examples.stateless.StatelessPagewicket:interface=:0:statelessfo
rm::IFormSubmitListener::


Wicket 1.5 example:
http://wicketstuff.org/wicket/stateless/foo?0-1.IFormSubmitListener-statele
ssform


I found and old bug WICKET-877 which supposedly addressed the issue, so I
created WICKET-4107 thinking that the current behavior of StatelessForm
may be a regression. However, I failed to adequately describe the issue on
the ticket, so I apologize for having to bring it up on both the list and
Jira. More detail can be found on WICKET-4107.

Thanks,
Chris Hansen
http://o.co




CONFIDENTIALITY NOTICE: This message is intended only for the use and review of 
the individual or entity to which it is addressed and may contain information 
that is privileged and confidential. If the reader of this message is not the 
intended recipient, or the employee or agent responsible for delivering the 
message solely to the intended recipient, you are hereby notified that any 
dissemination, distribution or copying of this communication is strictly 
prohibited. If you have received this communication in error, please notify 
sender immediately by telephone or return email. Thank you.

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



Re: Wrong path for resources on redirected login page

2011-10-19 Thread Martin Grigorov
Artifacts
http://people.apache.org/~ivaynberg/wicket-1.5.2/dist/

Maven repo
https://repository.apache.org/content/repositories/orgapachewicket-079/


On Thu, Oct 20, 2011 at 1:27 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 first try with 1.5.2 candidate (see the vote thread on @dev for where
 to get the artifacts). if it still doesnt work post a jira bug and
 attach a quickstart.

 -igor


 On Wed, Oct 19, 2011 at 1:55 PM, bjolletz daniel.akerl...@pagero.com wrote:
 Addition to my post above:

 I noticed that the browser URL seems to be the same in both 1.4.18 and
 1.5.1:
 /App/LoginPage

 But, in 1.4.18 the resource links looked something like this:
 ../resources/se.app.LoginPage/images/logo.png

 while in 1.5.1 it looks lke this:
 wicket/resource/se.app.LoginPage/images/logo-ver-1319057388417.png

 So, no ../ in 1.5.1 which I guess is what's causing my problems. In 1.4.18
 it seems that wicket automagically solved the resource path issue.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wrong-path-for-resources-on-redirected-login-page-tp3920038p3920126.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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: wicket + jasper reports

2011-10-19 Thread Martin Grigorov
On Wed, Oct 19, 2011 at 11:46 PM, Paul Szulc paul.sz...@gmail.com wrote:
 Ok, below the code I use to create a link that allows to download pdf file
 created by jasper on runtime. Hope it helps. Do not hesitate to ask
 questions.


 public class PdfGenerateLink extends ResourceLinkVoid {

    public PdfGenerateLink(final String id, final IModelBid model, final
 PdfBuilderFromBidCreator creator) {

        super(id, new WebResource() {
            @Override
            public IResourceStream getResourceStream() {
                IResourceStream resourceStream = new
 AbstractResourceStreamWriter() {

                    public void write(OutputStream output) {
                        try {
                            generate(output, model.getObject());
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        }
                    }

                    private void generate(OutputStream output, Bid bid)
 throws Exception {
                        PdfOfertaDocumentBuilder pdf = creator.create(bid);
Oferta ?!
This sounds like Bulgarians are involved here :-)
                        InputStream generate = pdf.generate();
                        byte[] buffer = new byte[1024];
                        while (generate.read(buffer) != -1) {
                            output.write(buffer);
                        }
                        generate.close();
                    }

                    public String getContentType() {
                        return application/pdf;
                    }
                };

                return resourceStream;
            }

            @Override
            protected void setHeaders(WebResponse response) {
                super.setHeaders(response);
                response.setCharacterEncoding(UFT-8);
                response.setHeader(Expires, 0);
                response.setHeader(Cache-Control, no-cache);
                response.setHeader(Cache-Control, must-revalidate,
 post-check=0, pre-check=0);
                response.setHeader(Pragma, public);

 response.setAttachmentHeader(model.getObject().getPublicTask().getName().replace(
 , _) + .pdf);
            }
        });
        add(createImage(icon, pdficon16.png));
    }
 }

 On Tue, Oct 18, 2011 at 8:43 PM, Jim Pinkham pinkh...@gmail.com wrote:

 Paul,

 I am doing something very similar - I'd be interested to know more about
 how you got this working - here is what I've got that works for now, but I'm
 not real happy with it:

 In my report forms, I have buttons like this:  (details about params
 omitted - nothing fancy there)

             add(new MyReportResourceButton(pdf, new
 ReportResource(MyReport, new PdfResourceHandler()), paramsModel));
             add(new MyReportResourceButton(xls, new
 ReportResource(MyReport, new XlsResourceHandler()), paramsModel));

 (So it will load MyReport.jasper that was compiled and put into resources
 folder by maven plugin during build)

 MyReportResourceButton has this:
     @Override
     public final void onResourceRequested() {
         MapString,Object params = paramsModel.getObject();
         resource.setReportParameters(params);
         super.onResourceRequested();
     }

 and it's superclass MyResourceButton has this:
     @Override
     public void onSubmit() {
         onResourceRequested();
     }

     /**
      * @see org.apache.wicket.IResourceListener#onResourceRequested()
      */
     public void onResourceRequested()
     {
         Attributes a = new Attributes(RequestCycle.get().getRequest(),
 RequestCycle.get()
             .getResponse(), null);
         resource.respond(a);
     }


 At runtime, it basically works, however, it gives me this annoying message
 in my logs multiple times per report request after the report has been
 served and it appears to be trying to just stay on the same page:

 2011-10-13 15:22:42,381 [http-80-12] ERROR
 org.apache.wicket.DefaultExceptionMapper - Unexpected error occurred
 java.lang.IllegalStateException: Header was already written to response!
     at
 org.apache.wicket.protocol.http.HeaderBufferingWebResponse.checkHeader(HeaderBufferingWebResponse.java:64)
     at
 org.apache.wicket.protocol.http.HeaderBufferingWebResponse.sendRedirect(HeaderBufferingWebResponse.java:112)
     at
 org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:136)
     at
 org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:261)
     at
 org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:139)
     at
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:717)
     at
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
     at
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:96)
     at
 

Occasional Software caused connection abort: socket write error with 1.5

2011-10-19 Thread Chris Colman
Occasionally over the last few days/weeks testing our 1.5 migration I've
seen the following exception.
I'm wondering if anyone has any idea of what's causing it or have seen
something similar. We've never seen it before with Wicket 1.4
 
It only happens when I click a link while it is still processing the
previous request. i.e. quickly clicking links on the site's main menu
will usually cause this to occur within about 10 seconds. If I wait
until each request has completed before clicking the next link it
*never* occurs.
 
I tried the rapid clicking on our Wicket 1.4 version of the app and the
exception never occurs.
 
2011/10/20 12:21:29.436 ERROR - EServerContext - Exception
thrown while servicing HTTP request: ClientAbortException:
java.net.SocketException: Software caused connection abort: socket write
error
2011/10/20 12:21:29.436 ERROR - EServerContext - The
following might help:
ClientAbortException:  java.net.SocketException: Software caused
connection abort: socket write error
at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:319
)
at
org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:288)
at
org.apache.catalina.connector.Response.flushBuffer(Response.java:548)
at
org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.
java:279)
at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter
.java:205)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
218)
at
com.sas.av.ui.wicket.templates.original.PagebloomFilter.doFilter(Pageblo
omFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:206)
at
com.sas.framework.expojo.servlet.ExpojoServletFilter.doFilter(ExpojoServ
letFilter.java:201)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:206)
at
com.sas.util.web.StaticResponseHeaderFilter.doFilter(Unknown Source)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:206)
at
com.sas.av.model.context.UrlRedirectorFilter.doFilter(UrlRedirectorFilte
r.java:77)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:102)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568
)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
86)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
5)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.SocketException: Software caused connection abort:
socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOut
putBuffer.java:740)
at
org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
at
org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer
.java:299)
at
org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:964
)
at org.apache.coyote.Response.action(Response.java:183)
at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:314
)
... 28 more
2011/10/20 12:21:29.436 ERROR - EServerContext - Caused by:
java.net.SocketException: Software caused connection abort: socket write
error
java.net.SocketException: Software caused connection abort: socket write
error
at