Aw: Re: Re: Automatically insert generated html IDs in other places in html file

2022-07-08 Thread Daniel Radünz
Thank you again for your input and sorry for the slow responses. Been 
unexpectedly busy with more urgent problems in my project.

Beforehand: If it's still not clear what I'm trying to achieve after this 
message, I'll happily provide the requested quickstart, though from your 
responses and my own digging I already get the feeling, that it might just not 
be possible ...

While the idea of Martin Terra with using a generic panel is good, the example 
that I've given with the h1 in the section is sadly just a simple one to show 
the general problem.
There are many many use cases with aria-* accessibillity attributes where you 
have to add the id of one element to an attribute of another element. 
aria-labelledby, aria-owns, aria-controls, aria-describedby, ... just to name a 
few. With many of those you don't always have the convinient case that these 
elements encase eachother as they do in my example. They could be encased the 
other way around or not all and both just be direct children of another parent 
element. They might not even be in close proxymity, as an element right at the 
beginning of a panel could reference an element which is at the very end of 
that panel.
So yes, I might be able to write some JS code for this very particular simple 
example but as soon as the structure changes or in general I have panels with 
different structures, the JS code would fail or I would at least have to write 
different JS code for each case. That's why I'd like to do it on the server 
side where it's reasonable to assume to have unique Wicket IDs in a panel.html 
file which then get turned into unique html IDs when wicket assembles the full 
page.

Maybe I failed to make clear that of course I am well aware of how to do this 
the "hard" way with some boiler plate could. I know I could very well have this 
bit of html:


  Lorem ipsum


and wire everything together with this bit of code:

WebMarkupContainer section = new WebMarkupContainer("section");
add(section);
WebMarkupContainer sectionheader = new WebMarkupContainer("sectionheader");
sectionheader.setOutputMarkupId(true);
section.add(sectionheader);
section.add(AttributeModifier.replace("aria-labelledby", 
sectionheader::getMarkupId));

which would produce something like this with unique IDs


  Lorem ipsum


But I wanted to avoid that. Adding these elements to the Java side has no real 
benefits in my eyes.

If I write this in html


  Lorem ipsum


it's already clear from the html side that the developer wants to wire these 
components togehter just by having the attributes on the corresponding tags. 
Adding any (boiler plate-)code on the Java side increases the complexitiy, 
feels redundant and in the worst case even causes trouble. So the idea was that 
maybe there is a way to write whatever "global" behaviour/listener/filter etc. 
to recognise matching pairs id- and aria-*-attributes in a Wicket panel and 
then generate and insert unique IDs into these places within a panel.

I will check out AutoLabelTagHandler and AutoLabelTagResolver again as Martijn 
suggested.

With that said, if it turns out, that it's not possible, I will just have to do 
it the "old fashioned" way by adding everything on the Java side as well. I 
just wanted to know ahead of that if somebody has solved this problem in a more 
elegant way before and I would maybe not have to reinvent the wheel.

Thank you for your time and kind regards
Daniel Radünz
 
 

Gesendet: Sonntag, 03. Juli 2022 um 22:36 Uhr
Von: "Martin Grigorov" 
An: users@wicket.apache.org
Betreff: Re: Re: Automatically insert generated html IDs in other places in 
html file
On Sat, Jul 2, 2022, 15:18 Martijn Dashorst 
wrote:

> I think Daniel suggest that Wicket doesn't make /all/ id's unique, only
> those that are owned by it by having a component attached to it. And even
> then, when you explicitly setMarkupId() you are yourself responsible for
> ensuring it is unique.
>
> BarPanel.html:
> 
> 
>

1. Don't set the ID in HTML
2. Use panel.setOutputMarkupId(true)

Voila!



>
> BarPage.html:
> 
> 
>
> BarPagel.java:
> add(new BarPanel("panel1"));
> add(new BarPanel("panel2"));
>
> This would result in two h1 tags with the same HTML id. Wicket doesn't
> modify the id magically.
>
> Wicket (from what i know) doesn't support Daniel's usecase out of the box,
> but Wicket does have the ability to act on tags if you make such affordance
> yourself.
>
> I suppose
>
> 
> 
>
> Could be similarly implemented as the wicket:for attribute.
> See AutoLabelTagHandler and AutoLabelTagResolver for more information.
>
> Martijn
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>

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



Aw: Re: Automatically insert generated html IDs in other places in html file

2022-06-30 Thread Daniel Radünz
Thank you kindly both for your suggestions.

@Martin Terra
I'm not sure I quite undstand what you mean. My hope was that I don't have to 
add any of the involved components to the Java code of every single panel. The 
example I've given is just one of many. We have many different constellation 
with completly different html fragments but each of them has the same problem, 
that somewhere in there the html ID of one html tag has to be put into the html 
attribute of another html tag.

@Martin Grigorov
The problem I'm having with doing it on the client with javascript or with the 
IResponseFilter is that by that time I can only work on the fully assembled 
html. If a Wicket page includes the same panel multiple times though, I would 
already have the same html ID and the same reference to it multiple times in 
the final html without a (bullet proof) way to figure out which two elements 
ultimatively belong together.

That's why I was hoping there would be a way to do this on a panel level, maybe 
with a custom attribute. Something like

  


If I'd then have a page which has the same panel twice in it, Wicket would take 
care of assinging unique IDs and also putting these generated unique IDs in the 
corresponding attributes that reference them, resulting in something like this:

  


  


If there is something like the IResponseFilter but on a per component base 
which would allow me to inspect and modify only the html fragment of a 
component/panel it might work.

Kind regards,
Daniel 


Gesendet: Mittwoch, 29. Juni 2022 um 15:40 Uhr
Von: "Martin Grigorov" 
An: users@wicket.apache.org
Betreff: Re: Automatically insert generated html IDs in other places in html 
file
Hi,

The easiest way I could imagine is with a short jQuery function that is
called on domready.

If you need to do it on the server side then maybe with IResponseFilter.

On Wed, Jun 29, 2022, 12:38 Daniel Radünz  wrote:

> Hello everybody,
>
> I'm wondering if there is a way in Wicket to generate unique html IDs and
> to then add them in other places in the html, without having to write any
> boiler plate code in each panel that I have.
>
> For example in the following panel I need the ID of the h1 tag to be put
> into the aria-labelledby attribute in the section tag.
> 
> 
> Lorem
> ipsum dolor sit amet
> Content ...
> 
> 
>
> Hardwiring it like in this example of course won't work if I use the same
> panel class multiple times within a page due to duplicate html IDs.
>
> While I know I could add WebMarkupContainers for the section and the h1 to
> my Java code and manually wire them together with an AttributeModifier in
> Wicket, I woud prefer to have some application wide code which recognizes
> this constellation in the html file and automatically generates and inserts
> the IDs.
>
> Maybe somebody can push me in the right direction, how I could accomplish
> this with Wicket, if it's possible at all.
>
> Kind regards,
> Daniel
>
> -
> 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



Automatically insert generated html IDs in other places in html file

2022-06-29 Thread Daniel Radünz
Hello everybody,

I'm wondering if there is a way in Wicket to generate unique html IDs and to 
then add them in other places in the html, without having to write any boiler 
plate code in each panel that I have.

For example in the following panel I need the ID of the h1 tag to be put into 
the aria-labelledby attribute in the section tag.


Lorem ipsum 
dolor sit amet
Content ...



Hardwiring it like in this example of course won't work if I use the same panel 
class multiple times within a page due to duplicate html IDs.

While I know I could add WebMarkupContainers for the section and the h1 to my 
Java code and manually wire them together with an AttributeModifier in Wicket, 
I woud prefer to have some application wide code which recognizes this 
constellation in the html file and automatically generates and inserts the IDs.

Maybe somebody can push me in the right direction, how I could accomplish this 
with Wicket, if it's possible at all.

Kind regards,
Daniel

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



Re: Problem with MetaData when detaching Component

2021-04-13 Thread Daniel Radünz

Thanks for the response!

I switched to using the RequestCycle to store the component related
data, which solved the specific problem for me. :)

Nevertheless I have created a bug reported with a quickstart attached as
requested. (WICKET-6877)

Regards,
Daniel


Am 12.04.2021 um 12:24 schrieb Martin Grigorov:

Hi,

On Mon, Apr 12, 2021 at 12:13 PM Daniel Radünz  wrote:


It sounds like a bug to me!
Please create an issue in JIRA. With a failing test case would be perfect!

To work it around you can probably use RequestCycle's MetaData instead.

Regards,
Martin




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



Problem with MetaData when detaching Component

2021-04-12 Thread Daniel Radünz
Hello,

I am facing a problem with our Wicket 8.10.0 application and I wonder if it's a
bug or if I am using the MetaData feature in an unsupported or wrong way.

I have a Behavior, which adds a MetaData entry to a component in the Behavior's
"onConfigure(Component component)" method and later removes the same MetaData 
again
from the component in the Behaviour's "detach(Component component)" method.
(I'll skip explaining what it is used for, but if it's important to understand 
my
use case I'll gladly explain it)

Now upon detaching the component with said Behaviour, Wickets 
NotDetachedModelChecker
encountered a not detached model in the component. After debugging the problem 
for
a few hours I discovered the cause:

Right before the detach phase starts, the components internal "data" field is an
array with the following 4 entries:
- [0] the component's Model
- [1] the MetaDataEntry belonging to the described Behavior
- [2] the Behavior itself
- [3] an AttributeModifier with a StringResourceModel

When the component's "detach()" method is called by Wicket, it internally calls
the static "Behaviors.detach(Component component)" method. This method then 
iterates
through all the entries in the aforementioned "data" array and detaches them, if
they are Behaviours.
Now when it detaches the Behavior (index 2), the MetaDataEntry (index 1) gets 
removed
as well by our Behavior, shifting every entry in the data array by 1. The next 
loop
iteration for index 3 then doesn't find anything anymore, since the 
AttributeModifier,
which still needed to get detached, is now at index 2 and not 3 anymore, 
ultimately
resulting in the observed error from the NotDetachedModelChecker.

To fix the problem for now I set the MetaDataEntry to a known non-null 
"undefined"
value in the Behavior's "detach(Component component)" method and then compare 
that
value again in the Behavior's "onConfigure(Component component)" to treat it as 
null.

Now I wonder, if you would consider this being a bug, if I'm just using it the 
wrong
way or if I should rather save the information in a different way, like for 
example
in a map (Component mapped to value) in the RequestCycle object.

Thanks for your help

Daniel


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



Re: Provide a additional static content with https://github.com/MarcGiffing/wicket-spring-boot

2021-01-13 Thread Daniel Weiss

works :) https://github.com/geramaya/wicket-spring-boot-simple

thx for help

Am 13.01.2021 um 20:19 schrieb Martin Grigorov:

In that case you should report it at
https://github.com/MarcGiffing/wicket-spring-boot/issues

On Wed, Jan 13, 2021 at 5:28 PM Daniel Weiss  wrote:


Hey all,

I've tested it. A mini spring-boot provide static content with functions
of https://www.baeldung.com/spring-mvc-static-resources. A mini spring
boot app with wicket-spring-boot does not provide it. I got a error
message with not found of ...

Some ideas or experience about it?


Am 13.01.2021 um 14:52 schrieb Martin Grigorov:

Hi, There is nothing Wicket specific in this. Just use Spring Boot/MVC
facilities: https://www.baeldung.com/spring-mvc-static-resources On
Wed, Jan 13, 2021 at 3:08 PM Daniel Weiss  wrote:

Hi all, I use https://github.com/MarcGiffing/wicket-spring-boot with
Wicket 8.x and with a spring boot application. I would add static web
content (online help page) to provide a documentation inside the
spring boot application. Knows someone a way to provide to serve
static web content with a set of html sites? I'll thankful for some
hints for this issue :) Thx in advance Daniel
-
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: Provide a additional static content with https://github.com/MarcGiffing/wicket-spring-boot

2021-01-13 Thread Daniel Weiss

https://github.com/MarcGiffing/wicket-spring-boot/issues/174

Done. Thx for your help :)

Am 13.01.2021 um 20:19 schrieb Martin Grigorov:

In that case you should report it at
https://github.com/MarcGiffing/wicket-spring-boot/issues

On Wed, Jan 13, 2021 at 5:28 PM Daniel Weiss  wrote:


Hey all,

I've tested it. A mini spring-boot provide static content with functions
of https://www.baeldung.com/spring-mvc-static-resources. A mini spring
boot app with wicket-spring-boot does not provide it. I got a error
message with not found of ...

Some ideas or experience about it?


Am 13.01.2021 um 14:52 schrieb Martin Grigorov:

Hi, There is nothing Wicket specific in this. Just use Spring Boot/MVC
facilities: https://www.baeldung.com/spring-mvc-static-resources On
Wed, Jan 13, 2021 at 3:08 PM Daniel Weiss  wrote:

Hi all, I use https://github.com/MarcGiffing/wicket-spring-boot with
Wicket 8.x and with a spring boot application. I would add static web
content (online help page) to provide a documentation inside the
spring boot application. Knows someone a way to provide to serve
static web content with a set of html sites? I'll thankful for some
hints for this issue :) Thx in advance Daniel
-
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: Provide a additional static content with https://github.com/MarcGiffing/wicket-spring-boot

2021-01-13 Thread Daniel Weiss

Hey all,

I've tested it. A mini spring-boot provide static content with functions 
of https://www.baeldung.com/spring-mvc-static-resources. A mini spring 
boot app with wicket-spring-boot does not provide it. I got a error 
message with not found of ...


Some ideas or experience about it?


Am 13.01.2021 um 14:52 schrieb Martin Grigorov:
Hi, There is nothing Wicket specific in this. Just use Spring Boot/MVC 
facilities: https://www.baeldung.com/spring-mvc-static-resources On 
Wed, Jan 13, 2021 at 3:08 PM Daniel Weiss  wrote:
Hi all, I use https://github.com/MarcGiffing/wicket-spring-boot with 
Wicket 8.x and with a spring boot application. I would add static web 
content (online help page) to provide a documentation inside the 
spring boot application. Knows someone a way to provide to serve 
static web content with a set of html sites? I'll thankful for some 
hints for this issue :) Thx in advance Daniel 
- 
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For 
additional commands, e-mail: users-h...@wicket.apache.org 




Re: Provide a additional static content with https://github.com/MarcGiffing/wicket-spring-boot

2021-01-13 Thread Daniel Weiss
Thx :) I have found this, but it doesn't work with my app. My next 
should step is to use a clean small spring boot app and spring boot with 
the wicket-spring-boot to exclude own bugs with my wonderful program :D


Thx
Daniel

Am 13.01.2021 um 14:52 schrieb Martin Grigorov:

Hi,

There is nothing Wicket specific in this. Just use Spring Boot/MVC
facilities: https://www.baeldung.com/spring-mvc-static-resources

On Wed, Jan 13, 2021 at 3:08 PM Daniel Weiss  wrote:


Hi all,

I use https://github.com/MarcGiffing/wicket-spring-boot with Wicket 8.x
and with a spring boot application. I would add static web content
(online help page) to provide a documentation inside the spring boot
application.

Knows someone a way to provide to serve static web content with a set of
html sites? I'll thankful for some hints for this issue :)

Thx in advance
Daniel



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




Provide a additional static content with https://github.com/MarcGiffing/wicket-spring-boot

2021-01-13 Thread Daniel Weiss



Hi all,

I use https://github.com/MarcGiffing/wicket-spring-boot with Wicket 8.x 
and with a spring boot application. I would add static web content 
(online help page) to provide a documentation inside the spring boot 
application.


Knows someone a way to provide to serve static web content with a set of 
html sites? I'll thankful for some hints for this issue :)


Thx in advance
Daniel



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



Re: Component.getPage() and Exception Handling

2020-08-25 Thread Daniel Weiss

Hey all,

after few hours of debugging, clean the inheritance structure and the 
right call of "onBeforeRender" vs "add;addOrReplace" > it works! :)


Yeah ... was hard stuff and a better code review will make something 
simplier.

Thx for your help/motivation :)

Greets
Daniel

Am 24.08.2020 um 17:07 schrieb Sven Meier:

Hi,

I didn't understand what's your problem.

Sven


On 24.08.20 16:56, Daniel Weiss wrote:

Hello all,

I don't like the exception handling of Component.getPage(). We are 
working on the integration to Wicket 8.4. We use panels or dialogs as 
anonymous classes / instances and this feature will blocked us to 
redefine a parent component or page.


In fact (I think ..) we don't need this to handle anonymous 
implementations. My first thoughts about this was "what the hell ... 
why ... and whats the benefit of it?" :)


Please explain or link a reason,documentation etc. to handle it and 
the reason for it.


Thx in advance!
Daniel

https://issues.apache.org/jira/browse/WICKET-6415
https://github.com/apache/wicket/commit/140fea6/




-
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



Component.getPage() and Exception Handling

2020-08-24 Thread Daniel Weiss

Hello all,

I don't like the exception handling of Component.getPage(). We are 
working on the integration to Wicket 8.4. We use panels or dialogs as 
anonymous classes / instances and this feature will blocked us to 
redefine a parent component or page.


In fact (I think ..) we don't need this to handle anonymous 
implementations. My first thoughts about this was "what the hell ... why 
... and whats the benefit of it?" :)


Please explain or link a reason,documentation etc. to handle it and the 
reason for it.


Thx in advance!
Daniel

https://issues.apache.org/jira/browse/WICKET-6415
https://github.com/apache/wicket/commit/140fea6/



Re: FilenameWithVersionResourceCachingStrategy accepts (almost) any string as a version

2020-05-26 Thread Daniel Stoch
I know that and for me this is not an issue either ;).
But this "issue" is reported by some security scanners which checks
for obsolete and backup files by adding "_old", "_bak", "_backup"
suffix to filename of selected resource (css, js). And our Wicket
application is serving such files as if indeed such old copies were
available.
So I'm only loudly thinking is it really no problem that we serve
files with any text attached on the end of file name.

--
Daniel


pon., 25 maj 2020 o 21:14 Carl-Eric Menzel  napisał(a):
>
> Sorry, didn't mean to sound dismissive. It's a valid point, just I'm
> not seeing that anybody could get to anything otherwise unavailable.
>
> On Mon, 25 May 2020 21:02:08 +0200
> Carl-Eric Menzel  wrote:
>
> > I think the point of this version decoration is not to ensure a
> > particular version is requested, because typically only one version of
> > a file is available in the application.
> >
> > The point is instead to defeat any caching, both in the browser and by
> > proxies, which might serve the user an outdated version. So I don't
> > think there needs to be any checking of that string.
> >
> > Or is there an actual security impact that I'm missing?
> >
> > Carl-Eric
> >
> > On Mon, 25 May 2020 20:47:36 +0200
> > Daniel Stoch  wrote:
> >
> > > Hi,
> > >
> > > Each resource in Wicket is decorated using a version string in a
> > > file name by default. It is implemented in
> > > FilenameWithVersionResourceCachingStrategy. Depending on DEVELOPMENT
> > > or DEPLOYMENT mode it looks like:
> > > jquery-ver-1590158412000.css
> > > jquery-ver-F334A4E46CB37347CAB42E2B1A45897C.css
> > >
> > > There is a small security issue, that this strategy does not check
> > > if this version is correctly calculated for specific resource and
> > > accepts any string as a version identifier, eg.:
> > > jquery-ver-F334A4E46CB37347CAB42E2B1A45897C_old.css
> > > jquery-ver-F334A4E46CB37347CAB42E2B1A45897C_bakup.css
> > > jquery-ver-XYZABCDEF.css
> > > etc.
> > >
> > > Maybe we should add a check if version passed in request is correct?
> > > There is partially such check done in decorateResponse() method. So
> > > maybe it is enough to add else block here and raise some exception?
> > >
> > > @Override
> > > public void decorateResponse(AbstractResource.ResourceResponse
> > > response, IStaticCacheableResource resource) {
> > >   String requestedVersion =
> > > RequestCycle.get().getMetaData(URL_VERSION); String
> > > calculatedVersion = this.resourceVersion.getVersion(resource); if
> > > (calculatedVersion != null &&
> > > calculatedVersion.equals(requestedVersion))
> > > { response.setCacheDurationToMaximum();
> > > response.setCacheScope(WebResponse.CacheScope.PUBLIC); } }
> > >
> > > --
> > > Best regards,
> > > Daniel Stoch
> > >
> > > -
> > > 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
> >
>
> 000
>
> -
> 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



FilenameWithVersionResourceCachingStrategy accepts (almost) any string as a version

2020-05-25 Thread Daniel Stoch
Hi,

Each resource in Wicket is decorated using a version string in a file
name by default. It is implemented in
FilenameWithVersionResourceCachingStrategy. Depending on DEVELOPMENT
or DEPLOYMENT mode it looks like:
jquery-ver-1590158412000.css
jquery-ver-F334A4E46CB37347CAB42E2B1A45897C.css

There is a small security issue, that this strategy does not check if
this version is correctly calculated for specific resource and accepts
any string as a version identifier, eg.:
jquery-ver-F334A4E46CB37347CAB42E2B1A45897C_old.css
jquery-ver-F334A4E46CB37347CAB42E2B1A45897C_bakup.css
jquery-ver-XYZABCDEF.css
etc.

Maybe we should add a check if version passed in request is correct?
There is partially such check done in decorateResponse() method. So
maybe it is enough to add else block here and raise some exception?

@Override
public void decorateResponse(AbstractResource.ResourceResponse
response, IStaticCacheableResource resource) {
  String requestedVersion = RequestCycle.get().getMetaData(URL_VERSION);
  String calculatedVersion = this.resourceVersion.getVersion(resource);
  if (calculatedVersion != null && calculatedVersion.equals(requestedVersion)) {
response.setCacheDurationToMaximum();
response.setCacheScope(WebResponse.CacheScope.PUBLIC);
  }
}

--
Best regards,
Daniel Stoch

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



Users can be redirected based on unvalidated input (CWE-601: URL Redirection to Untrusted Site)

2019-11-13 Thread Daniel Stoch
Hi,

Do you have a knowledge how to protect a Wicket application against
such a problem:
http://cwe.mitre.org/data/definitions/601.html

In short: redirect request can be intercepted and the attacker can
change Host header to another value.

Can it be done on application (Wicket, Java Servlet) level (such Host
header checking) or should it be done outside an app, on the
reverse-proxy level, ...?


More details:

Description:
The application redirects users based on the value of the Host header.
As this value is not properly validated, redirects to third party
domains can occur.

Impact:
It is possible to redirect application users to a URL outside the
customer control. Such a website might be used in phishing attacks to
harvest user credentials or try to exploit vulnerabilities on a user’s
machine.
This vulnerability might also lead to web-cache poisoning and
poisoning of links that are send to an user via an e-mail
functionality.

Proposal:
Validate all input parameters used for redirection and deny any
request if the supplied value does not belong to the application’s
domain.

--
Daniel

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



Re: WebSockets: page deserialisation on close (performance issue?)

2019-08-05 Thread Daniel Stoch
Hi,

Thanks for your answer.
I have created a JIRA issue with Quickstart:
https://issues.apache.org/jira/browse/WICKET-6692

--
Daniel


On Sat, Aug 3, 2019 at 10:05 PM Sven Meier  wrote:
>
> Hi Daniel,
>
> can you create a quickstart and attach it to a Jura issue please?
>
> Thanks
> Sven
>
> On 01.08.19 10:57, Daniel Stoch wrote:
> > Correction to my previous message (I have debugged this more precisely):
> >
> > AbstractWebSocketProcessor.onClose method is called in both Jetty
> > versions (not only in a newer one).
> > The difference is in connection:
> > - in Jetty 9.4.12.v20180830 connection is closed
> > - in Jetty 9.4.18.v20190429 connection is still open
> >
> > So message is broadcasted only in a newer version.
> >
> > --
> > Daniel
> >
> > On Thu, Aug 1, 2019 at 10:25 AM Daniel Stoch  wrote:
> >> Hi,
> >>
> >> We are using web sockets (with wicket-native-core) on many pages in
> >> our application. After upgrade a Jetty from 9.4.12.v20180830 to a
> >> newer version 9.4.18.v20190429, I have found a different behaviour in
> >> application:
> >>
> >> When user navigates to another page, a websocket connection is closed
> >> and AbstractWebSocketProcessor.onClose method is called. This causes
> >> broadcasting a message to connected page:
> >>
> >>broadcastMessage(new ClosedMessage(getApplication(), getSessionId(), 
> >> key));
> >>
> >> and leads to page deserialisation (from PageStore).
> >> I think something was changed in a new version of Jetty, because in
> >> the previous used version this was not called. Maybe because of this:
> >> https://github.com/eclipse/jetty.project/issues/3835
> >> https://github.com/eclipse/jetty.project/commit/2383bf4974ba7d82109cedfc4a8e7693d106abf0
> >>
> >> I believe that now it works correctly (as was designed) and onClose
> >> should be called. But I wonder how it can affect performance: almost
> >> every page navigation causes page deserialization (when it should
> >> occur only for back button or when some web socket message comes and
> >> application need to process it).
> >>
> >> Maybe this message should be send only when needed or maybe I should
> >> not care and current behaviour does not affect performance?
> >>
> >> --
> >> Best regards,
> >> Daniel Stoch
> > -
> > 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
>

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



Re: WebSockets: page deserialisation on close (performance issue?)

2019-08-01 Thread Daniel Stoch
Correction to my previous message (I have debugged this more precisely):

AbstractWebSocketProcessor.onClose method is called in both Jetty
versions (not only in a newer one).
The difference is in connection:
- in Jetty 9.4.12.v20180830 connection is closed
- in Jetty 9.4.18.v20190429 connection is still open

So message is broadcasted only in a newer version.

--
Daniel

On Thu, Aug 1, 2019 at 10:25 AM Daniel Stoch  wrote:
>
> Hi,
>
> We are using web sockets (with wicket-native-core) on many pages in
> our application. After upgrade a Jetty from 9.4.12.v20180830 to a
> newer version 9.4.18.v20190429, I have found a different behaviour in
> application:
>
> When user navigates to another page, a websocket connection is closed
> and AbstractWebSocketProcessor.onClose method is called. This causes
> broadcasting a message to connected page:
>
>   broadcastMessage(new ClosedMessage(getApplication(), getSessionId(), key));
>
> and leads to page deserialisation (from PageStore).
> I think something was changed in a new version of Jetty, because in
> the previous used version this was not called. Maybe because of this:
> https://github.com/eclipse/jetty.project/issues/3835
> https://github.com/eclipse/jetty.project/commit/2383bf4974ba7d82109cedfc4a8e7693d106abf0
>
> I believe that now it works correctly (as was designed) and onClose
> should be called. But I wonder how it can affect performance: almost
> every page navigation causes page deserialization (when it should
> occur only for back button or when some web socket message comes and
> application need to process it).
>
> Maybe this message should be send only when needed or maybe I should
> not care and current behaviour does not affect performance?
>
> --
> Best regards,
> Daniel Stoch

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



WebSockets: page deserialisation on close (performance issue?)

2019-08-01 Thread Daniel Stoch
Hi,

We are using web sockets (with wicket-native-core) on many pages in
our application. After upgrade a Jetty from 9.4.12.v20180830 to a
newer version 9.4.18.v20190429, I have found a different behaviour in
application:

When user navigates to another page, a websocket connection is closed
and AbstractWebSocketProcessor.onClose method is called. This causes
broadcasting a message to connected page:

  broadcastMessage(new ClosedMessage(getApplication(), getSessionId(), key));

and leads to page deserialisation (from PageStore).
I think something was changed in a new version of Jetty, because in
the previous used version this was not called. Maybe because of this:
https://github.com/eclipse/jetty.project/issues/3835
https://github.com/eclipse/jetty.project/commit/2383bf4974ba7d82109cedfc4a8e7693d106abf0

I believe that now it works correctly (as was designed) and onClose
should be called. But I wonder how it can affect performance: almost
every page navigation causes page deserialization (when it should
occur only for back button or when some web socket message comes and
application need to process it).

Maybe this message should be send only when needed or maybe I should
not care and current behaviour does not affect performance?

--
Best regards,
Daniel Stoch

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



Re: Wicket 8 ModalWindow autosizing problem

2018-11-08 Thread daniel
Thanks for the tip.

https://issues.apache.org/jira/browse/WICKET-6613

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Wicket 8 ModalWindow autosizing problem

2018-11-08 Thread daniel
Thanks for the tip.

https://issues.apache.org/jira/browse/WICKET-6613

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Wicket 8 ModalWindow autosizing problem

2018-11-07 Thread daniel
I updated the version and modal.css seems to load fine
(modal-ver-154158884.css).

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Wicket 8 ModalWindow autosizing problem

2018-11-07 Thread daniel
Hi, 

I've recently upgraded my project from Wicket version 6 to 8.0.0-M9 and
autosizing of ModalWindows suddenly stopped working. All ModalWindows are
either too big or too small, in that case the scrollbar appears. I need my
ModalWindows to be autosized so the content fits perfectly without any
scrollbar or excessive window size. I've been trying to play around with
various combinations of set/useInitial/Minimal/Height() and setAutoSize()
without any luck so far.

Any help is appreciated, thank you.

Daniel

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



ResponseIOException logged as error in DefaultExceptionMapper

2018-06-26 Thread Daniel Stoch
Hi,

DefaultExceptionMapper handles by default some "internal" exceptions.
You can look at the thread "Marker interface for "internal"
exceptions" on this list (Jun 02, 2014). ResponseIOException is one of
them, but when this kind of exception occurs then an error is logged
in DefaultExceptionMapper.mapExpectedExceptions(...):

  logger.error("Connection lost, give up responding.", e);

Why it is logged as an error, which means something is wrong in our
application? If it is handled transparently by a framework then it
should not be logged as error (maybe as debug?).
Or maybe I should add some special handling to this
ResponseIOException in my app?

--
Best regards,
Daniel

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



How to add some data to ajax and websocket response?

2017-03-31 Thread Daniel Stoch
Hi,

I am trying to solve WICKET-5588. I want to add some ordering
information (key-value) to responses for ajax and websocket. This
information then will be read on client side (JS) to handle proper
processing order of responses. But I cannot find a good entry point to
add such generic information (order information should be calculated
in context of page/component).
How to add such information to response in Wicket 6.x?

--
Best regards,
Daniel

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



Re: Safe way to display HTML user input

2017-02-09 Thread daniel simko
Thank you Martin! This is exactly what I was looking for.

2017-02-09 13:03 GMT+01:00 Martin Grigorov <mgrigo...@apache.org>:

> Hi,
>
> Check https://jsoup.org/cookbook/cleaning-html/whitelist-sanitizer
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, Feb 9, 2017 at 12:50 PM, daniel simko <dan.si...@gmail.com> wrote:
>
> > Hello,
> >
> > I would like to ask you whether there is some safe way how to display
> html
> > output from some rich editor (e.g. TinyMCE)? In order to display html it
> is
> > necessary to switch off model escaping [1] which is opening a door for
> XSS.
> > I was thinking about some converter [2] which would escape only JS
> related
> > stuff (e.g. 

Safe way to display HTML user input

2017-02-09 Thread daniel simko
Hello,

I would like to ask you whether there is some safe way how to display html
output from some rich editor (e.g. TinyMCE)? In order to display html it is
necessary to switch off model escaping [1] which is opening a door for XSS.
I was thinking about some converter [2] which would escape only JS related
stuff (e.g. 

Re: Resource caching - validation of user entered version

2016-05-31 Thread Daniel Stoch
Thanks for fast answer :)

--
Daniel

On Tue, May 31, 2016 at 4:54 PM, Martin Grigorov <mgrigo...@apache.org> wrote:
> Hi,
>
> The version is intended to be used by the browser for client side caching,
> not by Wicket. That's why it is just stripped off by Wicket without any
> validation.
> Actually if Wicket rejects it then you won't be able to update your
> resources in new application versions.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, May 31, 2016 at 4:51 PM, Daniel Stoch <daniel.st...@gmail.com>
> wrote:
>
>> Hi,
>>
>> By default Wicket (6.x) uses IResourceCachingStrategy which generates
>> resource urls like this one:
>>
>> http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver-1E0DAFB24FE33C93370DE13BF6FFE77F.js
>>
>> But as a user I can generate almost any version number in this url and
>> it will be handled correctly by Wicket. For example these urls still
>> work ok:
>>
>> http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver-123.js
>>
>> http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver--alert('1');return
>> false;.js
>>
>> Is it a desired behavior or maybe Wicket should reject such
>> "incorrect" versions? Could it be some security issue?
>>
>> --
>> Best regards,
>> Daniel
>>
>> -
>> 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



Resource caching - validation of user entered version

2016-05-31 Thread Daniel Stoch
Hi,

By default Wicket (6.x) uses IResourceCachingStrategy which generates
resource urls like this one:
http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver-1E0DAFB24FE33C93370DE13BF6FFE77F.js

But as a user I can generate almost any version number in this url and
it will be handled correctly by Wicket. For example these urls still
work ok:
http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver-123.js
http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver--alert('1');return
false;.js

Is it a desired behavior or maybe Wicket should reject such
"incorrect" versions? Could it be some security issue?

--
Best regards,
Daniel

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



Re: Invalid JS src url for ajax behaviors - degradation after 6.17.0

2016-01-11 Thread Daniel Stoch
Hi,

Thanks for your answer.

I have tried to reproduce this problem in quickstart app and it seems
that it is a problem in my application.
Problem is related to Wicket-Ajax-BaseURL encoding, when parameter
values contains "#" (eg. abx#xyz). In 6.17.0 there were some problems
with these encodings and I have internal patch in overridden
MultipartServletWebRequestImpl.getHeader() method - I forgot to make
JIRA for that. It seems that in 6.21.0 these problems do not exist, so
my internal patch is not necessary, moreover generates an error which
I described in a previous email. So when I remove it, it seems that
everything works ok.

--
Best regards,
Daniel

On Fri, Jan 8, 2016 at 10:47 PM, Sven Meier <s...@meiers.net> wrote:
> Hi,
>
> please create a quickstart and/or test case and attach it to a new Jira
> issue.
>
> This way we can dissect the problem.
>
> Best regards
> Sven
>
>
>
> On 08.01.2016 18:19, Daniel Stoch wrote:
>>
>> Hi,
>>
>> I have upgraded Wicket from 6.17.0 to 6.21.0. And there is some
>> problem after this upgrade. I am using UrlPathPageParametersEncoder so
>> my page parameters are encoded like:
>> /param1Name/param1Value/param2Name/param2Value
>>
>> Sample scenario to reproduce this problem:
>> 1. User enters a bookmarkable page with four parameters, so url looks
>> like:
>> http://localhost:8080/app/somepage/p1/v1/p2/v2/p3/v3/p4/v4
>> 2. User clicks checkbox with AjaxFormChoiceComponentUpdatingBehavior
>> and the generated ajax response contains invalid (in 6.21.0) url to
>> JavaScript resources, eg.:
>>
>> 6.21.0
>> >
>> src="../../../../wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-1446158378000.js">
>>
>> but it shoud be:
>>
>> 6.17.0
>> >
>> src="../../../../../../../../wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-140930656.js">
>>
>>
>> So there are only 4 "../" url parts in new Wicket version, instead of
>> 8 in older one (6.17.0). This leads to invalid requests that come to
>> server (request contains invalid parameters in a path).
>>
>> Are there any changes in 6.x branch after 6.17.0 version which can
>> cause such problems?
>>
>> --
>> Best regards,
>> Daniel
>>
>> -
>> 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
>

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



Invalid JS src url for ajax behaviors - degradation after 6.17.0

2016-01-08 Thread Daniel Stoch
Hi,

I have upgraded Wicket from 6.17.0 to 6.21.0. And there is some
problem after this upgrade. I am using UrlPathPageParametersEncoder so
my page parameters are encoded like:
/param1Name/param1Value/param2Name/param2Value

Sample scenario to reproduce this problem:
1. User enters a bookmarkable page with four parameters, so url looks like:
http://localhost:8080/app/somepage/p1/v1/p2/v2/p3/v3/p4/v4
2. User clicks checkbox with AjaxFormChoiceComponentUpdatingBehavior
and the generated ajax response contains invalid (in 6.21.0) url to
JavaScript resources, eg.:

6.21.0


but it shoud be:

6.17.0



So there are only 4 "../" url parts in new Wicket version, instead of
8 in older one (6.17.0). This leads to invalid requests that come to
server (request contains invalid parameters in a path).

Are there any changes in 6.x branch after 6.17.0 version which can
cause such problems?

--
Best regards,
Daniel

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



Re: Native WebSockets - exceptions and sendRedirect inside WebSocketResponse

2016-01-04 Thread Daniel Stoch
On Fri, Jan 1, 2016 at 10:25 PM, Martin Grigorov <mgrigo...@apache.org> wrote:
> Hi,
>
>
> On Mon, Dec 28, 2015 at 4:49 PM, Daniel Stoch <daniel.st...@gmail.com>
> wrote:
>
>> Hi,
>>
>> As I wrote in my previous post "Native WebSockets - cookies and last
>> handler question": In WebSocketResponse many methods throws
>> UnsupportedOperationException. Some of them can be customized now
>> thanks to WICKET-6054.
>>
>> But I have found another problem with WebSocketResponse.sendRedirect()
>> method. When you send a message using
>> IWebSocketConnection.sendMessage() and an exeption is raised somewhere
>> during processing of this message you can get the following exception
>> (the orignal exception is lost):
>>
>> Error during processing error message
>> java.lang.UnsupportedOperationException
>> at
>> org.apache.wicket.protocol.ws.api.WebSocketResponse.sendRedirect(WebSocketResponse.java:205)
>> at
>> org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:176)
>> at
>> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:327)
>> at
>> org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
>> at
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:890)
>> at
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:233)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>> at
>> org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor.broadcastMessage(AbstractWebSocketProcessor.java:251)
>> at
>> org.apache.wicket.protocol.ws.api.AbstractWebSocketConnection.sendMessage(AbstractWebSocketConnection.java:43)
>>
>>
>> This is because WebPageRenderer by default calls redirectTo method. So
>> it looks like WebSocketResponse.sendRedirect() should not throw
>> exception in the default implementation?
>>
>
> The default is to throw an exception so that you know that you are trying
> to do something that is really not supported.
> But now I think we can actually add support for it - as Ajax does with
> ...
> Please file a ticket with a quickstart app!
> Thank you!
>

WICKET-6064


BTW: The quickstart app is not compatible with websockets when you are
trying to use Start.main():

java.lang.IllegalStateException: Websockets not supported on blocking connectors
at 
org.eclipse.jetty.websocket.WebSocketFactory.upgrade(WebSocketFactory.java:237)
at 
org.eclipse.jetty.websocket.WebSocketFactory.acceptWebSocket(WebSocketFactory.java:396)
at 
org.apache.wicket.protocol.ws.jetty.Jetty7WebSocketFilter.acceptWebSocket(Jetty7WebSocketFilter.java:74)
at 
org.apache.wicket.protocol.ws.AbstractUpgradeFilter.processRequestCycle(AbstractUpgradeFilter.java:55)
at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
at 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandle

Re: Native WebSockets - exceptions and sendRedirect inside WebSocketResponse

2016-01-04 Thread Daniel Stoch
On Fri, Jan 1, 2016 at 10:26 PM, Martin Grigorov <mgrigo...@apache.org> wrote:
> Hi,
>
> On Tue, Dec 29, 2015 at 2:14 PM, Daniel Stoch <daniel.st...@gmail.com>
> wrote:
>
>> Another problem with WebSocketRequest:
>>
>> @Override
>> public Url getUrl()
>> {
>> return null;
>> }
>>
>> @Override
>> public Url getClientUrl()
>> {
>> return null;
>> }
>>
>> null result in getUrl() method can leed to execptions in
>> UrlRequestParametersAdapter:
>>
>> java.lang.IllegalArgumentException: Argument 'url' may not be null.
>> at org.apache.wicket.util.lang.Args.notNull(Args.java:41)
>> at
>> org.apache.wicket.request.parameter.UrlRequestParametersAdapter.(UrlRequestParametersAdapter.java:48)
>> at
>> org.apache.wicket.request.Request.getQueryParameters(Request.java:128)
>> at
>> org.apache.wicket.request.Request.getRequestParameters(Request.java:136)
>>
>> Maybe these methods should better return empty Url instead of null (
>> return new Url(); )?
>>
>
> Please file a separate ticket with a quickstart app!
> Thank you!

WICKET-6063

--
Daniel

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



Re: Native WebSockets - exceptions and sendRedirect inside WebSocketResponse

2015-12-29 Thread Daniel Stoch
Another problem with WebSocketRequest:

@Override
public Url getUrl()
{
return null;
}

@Override
public Url getClientUrl()
{
return null;
}

null result in getUrl() method can leed to execptions in
UrlRequestParametersAdapter:

java.lang.IllegalArgumentException: Argument 'url' may not be null.
at org.apache.wicket.util.lang.Args.notNull(Args.java:41)
at 
org.apache.wicket.request.parameter.UrlRequestParametersAdapter.(UrlRequestParametersAdapter.java:48)
at org.apache.wicket.request.Request.getQueryParameters(Request.java:128)
at org.apache.wicket.request.Request.getRequestParameters(Request.java:136)

Maybe these methods should better return empty Url instead of null (
return new Url(); )?

--
Daniel


On Mon, Dec 28, 2015 at 4:49 PM, Daniel Stoch <daniel.st...@gmail.com> wrote:
> Hi,
>
> As I wrote in my previous post "Native WebSockets - cookies and last
> handler question": In WebSocketResponse many methods throws
> UnsupportedOperationException. Some of them can be customized now
> thanks to WICKET-6054.
>
> But I have found another problem with WebSocketResponse.sendRedirect()
> method. When you send a message using
> IWebSocketConnection.sendMessage() and an exeption is raised somewhere
> during processing of this message you can get the following exception
> (the orignal exception is lost):
>
> Error during processing error message
> java.lang.UnsupportedOperationException
> at 
> org.apache.wicket.protocol.ws.api.WebSocketResponse.sendRedirect(WebSocketResponse.java:205)
> at 
> org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:176)
> at 
> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:327)
> at 
> org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
> at 
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:890)
> at 
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at 
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at 
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:233)
> at 
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> at 
> org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor.broadcastMessage(AbstractWebSocketProcessor.java:251)
> at 
> org.apache.wicket.protocol.ws.api.AbstractWebSocketConnection.sendMessage(AbstractWebSocketConnection.java:43)
>
>
> This is because WebPageRenderer by default calls redirectTo method. So
> it looks like WebSocketResponse.sendRedirect() should not throw
> exception in the default implementation?
>
> --
> Best regards,
> Daniel

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



Native WebSockets - exceptions and sendRedirect inside WebSocketResponse

2015-12-28 Thread Daniel Stoch
Hi,

As I wrote in my previous post "Native WebSockets - cookies and last
handler question": In WebSocketResponse many methods throws
UnsupportedOperationException. Some of them can be customized now
thanks to WICKET-6054.

But I have found another problem with WebSocketResponse.sendRedirect()
method. When you send a message using
IWebSocketConnection.sendMessage() and an exeption is raised somewhere
during processing of this message you can get the following exception
(the orignal exception is lost):

Error during processing error message
java.lang.UnsupportedOperationException
at 
org.apache.wicket.protocol.ws.api.WebSocketResponse.sendRedirect(WebSocketResponse.java:205)
at 
org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:176)
at 
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:327)
at 
org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:890)
at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at 
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:233)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
at 
org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor.broadcastMessage(AbstractWebSocketProcessor.java:251)
at 
org.apache.wicket.protocol.ws.api.AbstractWebSocketConnection.sendMessage(AbstractWebSocketConnection.java:43)


This is because WebPageRenderer by default calls redirectTo method. So
it looks like WebSocketResponse.sendRedirect() should not throw
exception in the default implementation?

--
Best regards,
Daniel

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



Native WebSockets - cookies and last handler question

2015-12-23 Thread Daniel Stoch
Hi,

I am during replacement Atmosphere push implementation to Wicket
Native WebSockets. I have an abstraction layer over it, so I can
replace only implementation and easily switch between these two
solutions and compare them. I have a couple of questions about Native
WebSockets:

1. In WebSocketResponse many methods throws
UnsupportedOperationException. I have a situation when component sets
cookie during its lifecycle, so this exeption is raised when it is
refreshed during push response. Is it any chance to implement these
methods or do they necessary throw exceptions? In Atmosphere
implementation this works.

2. I have a code which checks
PageRequestHandlerTracker.getLastHandler(requestCycle) to get actual
page for current request (is it a best method?). During processing
push request this method returns null. Is it a correct behavior? In
Atmosphere implementation this works too ;).

More questions to come later ;)
PS. I am using Wicket 6.x.

--
Best regards,
Daniel

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



Re: Native WebSockets - cookies and last handler question

2015-12-23 Thread Daniel Stoch
On Wed, Dec 23, 2015 at 2:34 PM, Martin Grigorov <mgrigo...@apache.org> wrote:
> Hi,
>
>
> On Wed, Dec 23, 2015 at 2:21 PM, Daniel Stoch <daniel.st...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I am during replacement Atmosphere push implementation to Wicket
>> Native WebSockets. I have an abstraction layer over it, so I can
>> replace only implementation and easily switch between these two
>> solutions and compare them. I have a couple of questions about Native
>> WebSockets:
>>
>> 1. In WebSocketResponse many methods throws
>> UnsupportedOperationException. I have a situation when component sets
>> cookie during its lifecycle, so this exeption is raised when it is
>> refreshed during push response. Is it any chance to implement these
>> methods or do they necessary throw exceptions? In Atmosphere
>> implementation this works.
>>
>
> Although an HTTP request is being *upgraded* to WebSocket, the websocket
> response is not an HTTP response.
> You can only write String and binary data that is processed by the
> application client code. The browser doesn't read/intercept the data
> transfered on the websocket connection so any headers (like cookies) could
> not be processed.
>
> We could change the impl to log a warning whenever one of those methods is
> used instead of throwing exception.
> Just like
> https://github.com/apache/wicket/commit/8a5508e117991faf43f53d770b64568842d8d557
> Please file a ticket if you think this is a better implementation.

Logging a warning is not a good solution in my case, because when I
call addCookie() I don't know if current response implementation
supports it or not (to avoid logging warns). So there will be many
unnecessary WARN logs in my application. So a better solution for me
is simply do nothing (empty mehod). I think it is probably not a good
solution for you, but as I can see in WICKET-5737 there is a factory
method for the WebSocketResponse so I will be able to use my own
implementation of WebSocketResponse where addCookie() will not throws
exception.
Can this patch be backported to 6.x?


>
>>
>> 2. I have a code which checks
>> PageRequestHandlerTracker.getLastHandler(requestCycle) to get actual
>> page for current request (is it a best method?). During processing
>> push request this method returns null. Is it a correct behavior? In
>> Atmosphere implementation this works too ;).
>>
>
> I think this should work.
> There must be a bug somewhere.

What should I check, how to investigate it?


>
>
>>
>> More questions to come later ;)
>> PS. I am using Wicket 6.x.
>>
>> --
>> Best regards,
>> Daniel
>>
>> -
>> 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: Native WebSockets - cookies and last handler question

2015-12-23 Thread Daniel Stoch
On Wed, Dec 23, 2015 at 3:41 PM, Martin Grigorov <mgrigo...@apache.org> wrote:
> On Wed, Dec 23, 2015 at 2:52 PM, Daniel Stoch <daniel.st...@gmail.com>
> wrote:
>
>> On Wed, Dec 23, 2015 at 2:34 PM, Martin Grigorov <mgrigo...@apache.org>
>> wrote:
>> > Hi,
>> >
>> >
>> > On Wed, Dec 23, 2015 at 2:21 PM, Daniel Stoch <daniel.st...@gmail.com>
>> > wrote:
>> >
>> >> Hi,
>> >>
>> >> I am during replacement Atmosphere push implementation to Wicket
>> >> Native WebSockets. I have an abstraction layer over it, so I can
>> >> replace only implementation and easily switch between these two
>> >> solutions and compare them. I have a couple of questions about Native
>> >> WebSockets:
>> >>
>> >> 1. In WebSocketResponse many methods throws
>> >> UnsupportedOperationException. I have a situation when component sets
>> >> cookie during its lifecycle, so this exeption is raised when it is
>> >> refreshed during push response. Is it any chance to implement these
>> >> methods or do they necessary throw exceptions? In Atmosphere
>> >> implementation this works.
>> >>
>> >
>> > Although an HTTP request is being *upgraded* to WebSocket, the websocket
>> > response is not an HTTP response.
>> > You can only write String and binary data that is processed by the
>> > application client code. The browser doesn't read/intercept the data
>> > transfered on the websocket connection so any headers (like cookies)
>> could
>> > not be processed.
>> >
>> > We could change the impl to log a warning whenever one of those methods
>> is
>> > used instead of throwing exception.
>> > Just like
>> >
>> https://github.com/apache/wicket/commit/8a5508e117991faf43f53d770b64568842d8d557
>> > Please file a ticket if you think this is a better implementation.
>>
>> Logging a warning is not a good solution in my case, because when I
>> call addCookie() I don't know if current response implementation
>> supports it or not (to avoid logging warns). So there will be many
>> unnecessary WARN logs in my application. So a better solution for me
>> is simply do nothing (empty mehod). I think it is probably not a good
>> solution for you, but as I can see in WICKET-5737 there is a factory
>> method for the WebSocketResponse so I will be able to use my own
>> implementation of WebSocketResponse where addCookie() will not throws
>> exception.
>> Can this patch be backported to 6.x?
>>
>
> Sure. Please file a ticket.

WICKET-6054


>> >> 2. I have a code which checks
>> >> PageRequestHandlerTracker.getLastHandler(requestCycle) to get actual
>> >> page for current request (is it a best method?). During processing
>> >> push request this method returns null. Is it a correct behavior? In
>> >> Atmosphere implementation this works too ;).
>> >>
>> >
>> > I think this should work.
>> > There must be a bug somewhere.
>>
>> What should I check, how to investigate it?
>>
>
> Put a breakpoint at
> https://github.com/apache/wicket/blob/master/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L237
> and see why the request cycle listeners are not notified.

This probably has been fixed in WICKET-5701 (in 6.18.0). I am using
6.17.0 and there is not scheduleRequestHandlerAfterCurrent() call.
So I have to upgrade and then check if it works ok.

Thanks for your help!

--
Best regards,
Daniel

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



Re: FormComponent.getConvertedInput() for multiple choice components

2015-10-12 Thread Daniel Stoch
> this required check will always be true.

Will always be FALSE of course :)

--
Daniel

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



FormComponent.getConvertedInput() for multiple choice components

2015-10-12 Thread Daniel Stoch
Hi,

What contract should be for FormComponent.getConvertedInput() method,
for components like ListMultipleChoice, which operates on Collection
of objects? When there are no selected values this method (exactly:
convertedInput field) should be set on empty Collection (0 sized) or
null object?

For ListMultipleChoice it is set to empty list but such behavior leads
to a problem in FormComponents.validate() method:

if (isRequired() && getConvertedInput() == null && isInputNullable())
{
reportRequiredError();
}
else
{
validateValidators();
}

where there is a condition to check if getConvertedInput() is null. So
for required field when its value is selected but not available in
list anymore, this required check will always be true. So even such
field has no value, required message will not be displayed and form
will be submitted.

--
Daniel

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



Re: AtmosphereBehavior - hard reference to page object

2015-08-11 Thread Daniel Stoch
Hi,

AtmosphereBehavior extends AbstractAjaxBehavior which has a component
field - so this holds a reference to a component, so also to its page
(using parent relationships). AtmosphereBehavior in onRequest() method
registers itself as a listener to Meteor object:

  ...
  Meteor meteor = Meteor.build(request.getContainerRequest());
  // Add us to the listener list.
  meteor.addListener(this);
  ...

So until atmosphere resource hold in meteor expires, it keeps a hard
reference to our behavior so also to a page. It can be a problem in
heavy load applications (with many users), where many atmosphere
resources are created.

--
Daniel

On Mon, Aug 10, 2015 at 1:38 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 Can you point in the code where this happens?

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

 On Mon, Aug 10, 2015 at 11:34 AM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 Ok, EventBus stores only pageId. But Atmosphere framework keeps all
 AtmosphereResourceEventListeners which are implemented by
 AtmosphereBehavior - so I think this is a place when Atmosphere keeps
 references to all registered pages.

 --
 Daniel


 On Tue, Jul 28, 2015 at 9:33 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Hi,
 
  I see no problem here.
  Wicket-Atmosphere keeps the pageId, not the page:
 
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/EventBus.java#L253
 
  Later uses it at
 
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java#L76
 
  Martin Grigorov
  Freelancer. Available for hire!
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Mon, Jul 20, 2015 at 1:54 PM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  Hi,
 
  In Wicket (AFAIK) we keeps only actual page reference in a web
  session, all other pages as serialized to a page store.
  AtmosphereBehavior registers itself as a listener to
  AtmosphereResource object. Because of this Atmosphere keeps references
  to all registered pages (until such resource expires). I think it
  could be a problem in high load applications: theses hard references
  could eat all memory.
 
  What do you think: is it a problem or not (and I am wrong in this case)?
 
  --
  Best regards,
  Daniel
 
  -
  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



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



Re: AtmosphereBehavior - hard reference to page object

2015-08-11 Thread Daniel Stoch
Ok, I will try to prepare a fix for this. Then I will create a JIRA
issue for this with this fix.

--
Daniel

On Tue, Aug 11, 2015 at 12:55 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Thanks!

 Do you want to contribute an improvement?
 For example we can extract a class that will be listener. In its onXyz()
 callbacks it will use the pageId to lookup the page, then it will search
 for an AtmosphereBehavior in the page to do its job (if this is required).

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

 On Tue, Aug 11, 2015 at 1:20 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 AtmosphereBehavior extends AbstractAjaxBehavior which has a component
 field - so this holds a reference to a component, so also to its page
 (using parent relationships). AtmosphereBehavior in onRequest() method
 registers itself as a listener to Meteor object:

   ...
   Meteor meteor = Meteor.build(request.getContainerRequest());
   // Add us to the listener list.
   meteor.addListener(this);
   ...

 So until atmosphere resource hold in meteor expires, it keeps a hard
 reference to our behavior so also to a page. It can be a problem in
 heavy load applications (with many users), where many atmosphere
 resources are created.

 --
 Daniel

 On Mon, Aug 10, 2015 at 1:38 PM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Hi,
 
  Can you point in the code where this happens?
 
  Martin Grigorov
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Mon, Aug 10, 2015 at 11:34 AM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  Hi,
 
  Ok, EventBus stores only pageId. But Atmosphere framework keeps all
  AtmosphereResourceEventListeners which are implemented by
  AtmosphereBehavior - so I think this is a place when Atmosphere keeps
  references to all registered pages.
 
  --
  Daniel
 
 
  On Tue, Jul 28, 2015 at 9:33 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
   Hi,
  
   I see no problem here.
   Wicket-Atmosphere keeps the pageId, not the page:
  
 
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/EventBus.java#L253
  
   Later uses it at
  
 
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java#L76
  
   Martin Grigorov
   Freelancer. Available for hire!
   Wicket Training and Consulting
   https://twitter.com/mtgrigorov
  
   On Mon, Jul 20, 2015 at 1:54 PM, Daniel Stoch daniel.st...@gmail.com
 
   wrote:
  
   Hi,
  
   In Wicket (AFAIK) we keeps only actual page reference in a web
   session, all other pages as serialized to a page store.
   AtmosphereBehavior registers itself as a listener to
   AtmosphereResource object. Because of this Atmosphere keeps
 references
   to all registered pages (until such resource expires). I think it
   could be a problem in high load applications: theses hard references
   could eat all memory.
  
   What do you think: is it a problem or not (and I am wrong in this
 case)?
  
   --
   Best regards,
   Daniel
  
   -
   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
 
 

 -
 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: AtmosphereBehavior - hard reference to page object

2015-08-10 Thread Daniel Stoch
Hi,

Ok, EventBus stores only pageId. But Atmosphere framework keeps all
AtmosphereResourceEventListeners which are implemented by
AtmosphereBehavior - so I think this is a place when Atmosphere keeps
references to all registered pages.

--
Daniel


On Tue, Jul 28, 2015 at 9:33 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 I see no problem here.
 Wicket-Atmosphere keeps the pageId, not the page:
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/EventBus.java#L253

 Later uses it at
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java#L76

 Martin Grigorov
 Freelancer. Available for hire!
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Mon, Jul 20, 2015 at 1:54 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 In Wicket (AFAIK) we keeps only actual page reference in a web
 session, all other pages as serialized to a page store.
 AtmosphereBehavior registers itself as a listener to
 AtmosphereResource object. Because of this Atmosphere keeps references
 to all registered pages (until such resource expires). I think it
 could be a problem in high load applications: theses hard references
 could eat all memory.

 What do you think: is it a problem or not (and I am wrong in this case)?

 --
 Best regards,
 Daniel

 -
 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



AtmosphereBehavior - hard reference to page object

2015-07-20 Thread Daniel Stoch
Hi,

In Wicket (AFAIK) we keeps only actual page reference in a web
session, all other pages as serialized to a page store.
AtmosphereBehavior registers itself as a listener to
AtmosphereResource object. Because of this Atmosphere keeps references
to all registered pages (until such resource expires). I think it
could be a problem in high load applications: theses hard references
could eat all memory.

What do you think: is it a problem or not (and I am wrong in this case)?

--
Best regards,
Daniel

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



RE: How to load-balance on AWS with standalone Tomcats

2015-03-10 Thread Daniel Del Castillo
Hi Martin,

Thanks a lot for your prompt response, that's very helpful.

With regards the session affinity, we'll have a Tomcat Session Manager, which 
is going to serialise sessions into ElastiCache, configured for each Tomcat 
instance with the same parameters and this should free us from sticky sessions. 
Is there any other concerns that I should take into account with regards Wicket 
Sessions in an environment like this?

Regards,
DDC

-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: 09 March 2015 21:26
To: users@wicket.apache.org
Subject: Re: How to load-balance on AWS with standalone Tomcats

Hi,

I think it would be much simpler if you use Tomcat clustering support.
Wicket 1.4.x is a bit old but as far as I remember the support for it in Wicket 
has been introduced with 1.4.1 so it should work fine in 1.4.17.

But if Tomcat clustering in not an option for you for some reason then:
- make sure you use session affinity (aka sticky sessions)
- create your own IPageStore to keep the serialized view of the pages in shared 
DB (as you already figured out)
- no need of custom ISessionStore. You need custom one only in case you want to 
put your Wicket Session instances in something else than HTTP Session

I guess you are not interested in upgrading to Wicket 6.x but I'd recommend you 
to upgrade at least to 1.4.22. There were some security fixes in the last few 
releases from 1.4.x series.


Martin Grigorov
Funemployed! Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Mar 9, 2015 at 6:09 PM, Daniel Del Castillo dani...@optimad.com
wrote:

 Hi list,

 One of the modules of our application is completely written in Wicket 
 1.4.17. This application runs on a single standalone Tomcat installation.

 We now need to move this to AWS servers and ensure the service is 24/7 
 available. We are looking to have multiple Tomcat instances (not a 
 cluster) which are load-balanced with ELB.

 My question is: what do I we need to do in order to achieve this? I 
 now we'll have to write a IPageStore in order to serialise the page 
 map into a shared database. Any suggestion on how to do this? Will we 
 have to write a ISessionStore as well?

 I've found a solution for clustering (see link below) which I'm now 
 about to test but I've thought that it'd be useful to try get some 
 advice from this list.

 http://letsgetdugg.com/2010/02/07/clustering-wicket-for-fun-and-profit
 /

 Many thanks for your help.

 Regards,
 Daniel
 DDC

 --
  This transmission is confidential and intended solely 
 for the person or organization to whom it is addressed. It may contain 
 privileged and confidential information. If you are not the intended 
 recipient, you should not copy, distribute or take any action in 
 reliance on it.

 If you believe you received this transmission in error, please notify 
 the sender as soon as possible.

 This e-mail has been scanned for known viruses by Mimecast for IMD.

 --
 -

--
This transmission is confidential and intended solely for the person or 
organization to whom it is addressed. It may contain privileged 
and confidential information. If you are not the intended recipient, you should 
not copy, distribute or take any action in reliance on it.

If you believe you received this transmission in error, please notify the 
sender as soon as possible.

This e-mail has been scanned for known viruses by Mimecast for IMD. 
---



RE: How to load-balance on AWS with standalone Tomcats

2015-03-10 Thread Daniel Del Castillo
Thanks for the input! I will let you know how it goes.

Cheers!
DDC


-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: 10 March 2015 11:18
To: users@wicket.apache.org
Subject: Re: How to load-balance on AWS with standalone Tomcats

Hi,

In that case I think you don't need custom IPageStore too. It will be redundant.
When a request comes Wicket tries to load the page from the HTTP session first. 
If it is found there then it stores it at the end of the request cycle both in 
the http session and in the disk (IPageStore).
Since you will have a bigger http session (ElastiCache) then I think there is 
no need to copy the same data second time with a custom IPageStore impl.

I don't remember how all this works in 1.4.x, so what I say is for 1.5.0+.
This part of Wicket (IPageStore, IDataStore) has been reworked for 1.5.0 but I 
guess there are no big architectural changes, just implementation changes.

Please let us know how things go!

Good luck!



Martin Grigorov
Funemployed! Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Mar 10, 2015 at 11:26 AM, Daniel Del Castillo dani...@optimad.com
wrote:

 Hi Martin,

 Thanks a lot for your prompt response, that's very helpful.

 With regards the session affinity, we'll have a Tomcat Session 
 Manager, which is going to serialise sessions into ElastiCache, 
 configured for each Tomcat instance with the same parameters and this 
 should free us from sticky sessions. Is there any other concerns that 
 I should take into account with regards Wicket Sessions in an environment 
 like this?

 Regards,
 DDC

 -Original Message-
 From: Martin Grigorov [mailto:mgrigo...@apache.org]
 Sent: 09 March 2015 21:26
 To: users@wicket.apache.org
 Subject: Re: How to load-balance on AWS with standalone Tomcats

 Hi,

 I think it would be much simpler if you use Tomcat clustering support.
 Wicket 1.4.x is a bit old but as far as I remember the support for it 
 in Wicket has been introduced with 1.4.1 so it should work fine in 1.4.17.

 But if Tomcat clustering in not an option for you for some reason then:
 - make sure you use session affinity (aka sticky sessions)
 - create your own IPageStore to keep the serialized view of the pages 
 in shared DB (as you already figured out)
 - no need of custom ISessionStore. You need custom one only in case 
 you want to put your Wicket Session instances in something else than 
 HTTP Session

 I guess you are not interested in upgrading to Wicket 6.x but I'd 
 recommend you to upgrade at least to 1.4.22. There were some security 
 fixes in the last few releases from 1.4.x series.


 Martin Grigorov
 Funemployed! Available for hire!
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Mon, Mar 9, 2015 at 6:09 PM, Daniel Del Castillo 
 dani...@optimad.com
 wrote:

  Hi list,
 
  One of the modules of our application is completely written in 
  Wicket 1.4.17. This application runs on a single standalone Tomcat 
  installation.
 
  We now need to move this to AWS servers and ensure the service is 
  24/7 available. We are looking to have multiple Tomcat instances 
  (not a
  cluster) which are load-balanced with ELB.
 
  My question is: what do I we need to do in order to achieve this? I 
  now we'll have to write a IPageStore in order to serialise the page 
  map into a shared database. Any suggestion on how to do this? Will 
  we have to write a ISessionStore as well?
 
  I've found a solution for clustering (see link below) which I'm now 
  about to test but I've thought that it'd be useful to try get some 
  advice from this list.
 
  http://letsgetdugg.com/2010/02/07/clustering-wicket-for-fun-and-prof
  it
  /
 
  Many thanks for your help.
 
  Regards,
  Daniel
  DDC
 
  
  --
   This transmission is confidential and intended 
  solely for the person or organization to whom it is addressed. It 
  may contain privileged and confidential information. If you are not 
  the intended recipient, you should not copy, distribute or take any 
  action in reliance on it.
 
  If you believe you received this transmission in error, please 
  notify the sender as soon as possible.
 
  This e-mail has been scanned for known viruses by Mimecast for IMD.
 
  
  --
  -
 

 --
  This transmission is confidential and intended solely 
 for the person or organization to whom it is addressed. It may contain 
 privileged and confidential information. If you are not the intended 
 recipient, you should not copy, distribute or take any action in 
 reliance on it.

 If you believe you received this transmission in error, please notify 
 the sender as soon as possible.

 This e-mail has been scanned for known viruses

How to load-balance on AWS with standalone Tomcats

2015-03-09 Thread Daniel Del Castillo
Hi list,

One of the modules of our application is completely written in Wicket 1.4.17. 
This application runs on a single standalone Tomcat installation.

We now need to move this to AWS servers and ensure the service is 24/7 
available. We are looking to have multiple Tomcat instances (not a cluster) 
which are load-balanced with ELB.

My question is: what do I we need to do in order to achieve this? I now we'll 
have to write a IPageStore in order to serialise the page map into a shared 
database. Any suggestion on how to do this? Will we have to write a 
ISessionStore as well?

I've found a solution for clustering (see link below) which I'm now about to 
test but I've thought that it'd be useful to try get some advice from this list.

http://letsgetdugg.com/2010/02/07/clustering-wicket-for-fun-and-profit/

Many thanks for your help.

Regards,
Daniel
DDC
--
This transmission is confidential and intended solely for the person or 
organization to whom it is addressed. It may contain privileged 
and confidential information. If you are not the intended recipient, you should 
not copy, distribute or take any action in reliance on it.

If you believe you received this transmission in error, please notify the 
sender as soon as possible.

This e-mail has been scanned for known viruses by Mimecast for IMD. 
---


How to get request/page parameters from RequestCycle?

2015-01-19 Thread Daniel Stoch
Hi,

In Wicket 1.4 I can get a page parameter value using this code:

PageParameters pageParameters = requestCycle.getPageParameters();
String value = pageParameters.getString(paramName);


The problem is that in Wicket 6 there is no equivalent. I have tried
with this solution:

IRequestParameters requestParameters =
requestCycle.getRequest().getRequestParameters();
String value = requestParameters.getParameterValue(paramName).toString();

but this does not work. These requestParameters does not contain
parameters. I think the problem is related to url encoding strategy
which is used. My urls are encoded like:
somepath/param1/value1/param2/value2

Is there another way to do this?

--
Best regards,
Daniel

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



Re: How to get request/page parameters from RequestCycle?

2015-01-19 Thread Daniel Stoch
Well this workaround from my previous post does not work, because this
page does not exists yet when I need to get this parameter value.

--
Daniel

On Mon, Jan 19, 2015 at 4:16 PM, Daniel Stoch daniel.st...@gmail.com wrote:
 Maybe such workaround (not very elegant though):

 app.init():
   getRequestCycleListeners().add(new PageRequestHandlerTracker());

   private Page getCurrentPage(RequestCycle requestCycle) {
 IPageRequestHandler pageRequestHandler =
 PageRequestHandlerTracker.getLastHandler(requestCycle);
 if ((pageRequestHandler != null)  (pageRequestHandler.getPage()
 instanceof Page)) {
   Page page = (Page)pageRequestHandler.getPage();
   return page;
 }
 return null;
   }

   Page page = getCurrentPage(requestCycle.getPageParameters());
   if (page != null) {
 PageParameters pageParameters =
 getCurrentPage(requestCycle.getPageParameters());
 String value = pageParameters.getString(paramName);
   } ...

 ?

 --
 Daniel

 On Mon, Jan 19, 2015 at 3:38 PM, Daniel Stoch daniel.st...@gmail.com wrote:
 Hi,

 In Wicket 1.4 I can get a page parameter value using this code:

 PageParameters pageParameters = requestCycle.getPageParameters();
 String value = pageParameters.getString(paramName);


 The problem is that in Wicket 6 there is no equivalent. I have tried
 with this solution:

 IRequestParameters requestParameters =
 requestCycle.getRequest().getRequestParameters();
 String value = requestParameters.getParameterValue(paramName).toString();

 but this does not work. These requestParameters does not contain
 parameters. I think the problem is related to url encoding strategy
 which is used. My urls are encoded like:
 somepath/param1/value1/param2/value2

 Is there another way to do this?

 --
 Best regards,
 Daniel

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



Re: How to get request/page parameters from RequestCycle?

2015-01-19 Thread Daniel Stoch
On Mon, Jan 19, 2015 at 4:54 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 On Mon, Jan 19, 2015 at 4:38 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 In Wicket 1.4 I can get a page parameter value using this code:

 PageParameters pageParameters = requestCycle.getPageParameters();
 String value = pageParameters.getString(paramName);


 The problem is that in Wicket 6 there is no equivalent. I have tried
 with this solution:

 IRequestParameters requestParameters =
 requestCycle.getRequest().getRequestParameters();
 String value =
 requestParameters.getParameterValue(paramName).toString();


 request.getQueryParameters() is the equivalent, but #getRequestParameters()
 would work too because it is a mix of GET and POST parameters

But I think it does not work with UrlPathPageParametersEncoder.




 but this does not work. These requestParameters does not contain
 parameters. I think the problem is related to url encoding strategy
 which is used. My urls are encoded like:
 somepath/param1/value1/param2/value2


 Check org.apache.wicket.request.mapper.parameter.UrlPathPageParametersEncoder

Ok, but how should I get url argument?
requestCycle.getRequest().getUrl() return null for me.

Another, minor, problem is that with this solution I have a hard coded
page parameters encoder here. In previous version the code can be
universal: it does not matter which encoding strategies page is using.
For now if there will be pages with different encoding strategies this
code stops working.

--
Daniel






 Is there another way to do this?

 --
 Best regards,
 Daniel

 -
 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: How to get request/page parameters from RequestCycle?

2015-01-19 Thread Daniel Stoch
Sorry, my fault - I forgot to pass a parameter.
So:
  requestCycle.getRequest().getUrl()
returns full path including mountpath and parameters, eg.:
somepath/param1/value1

But if I pass this to
UrlPathPageParametersEncoder.decodePageParameters() this decodes
somepath as a first argument.


On Mon, Jan 19, 2015 at 5:12 PM, Daniel Stoch daniel.st...@gmail.com wrote:
 requestCycle.getRequest().getUrl() return null for me. - sorry, not
 null but returns only a mount path without paramname/paramvalue part.

 On Mon, Jan 19, 2015 at 5:09 PM, Daniel Stoch daniel.st...@gmail.com wrote:
 On Mon, Jan 19, 2015 at 4:54 PM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 Hi,

 On Mon, Jan 19, 2015 at 4:38 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 In Wicket 1.4 I can get a page parameter value using this code:

 PageParameters pageParameters = requestCycle.getPageParameters();
 String value = pageParameters.getString(paramName);


 The problem is that in Wicket 6 there is no equivalent. I have tried
 with this solution:

 IRequestParameters requestParameters =
 requestCycle.getRequest().getRequestParameters();
 String value =
 requestParameters.getParameterValue(paramName).toString();


 request.getQueryParameters() is the equivalent, but #getRequestParameters()
 would work too because it is a mix of GET and POST parameters

 But I think it does not work with UrlPathPageParametersEncoder.




 but this does not work. These requestParameters does not contain
 parameters. I think the problem is related to url encoding strategy
 which is used. My urls are encoded like:
 somepath/param1/value1/param2/value2


 Check 
 org.apache.wicket.request.mapper.parameter.UrlPathPageParametersEncoder

 Ok, but how should I get url argument?
 requestCycle.getRequest().getUrl() return null for me.

 Another, minor, problem is that with this solution I have a hard coded
 page parameters encoder here. In previous version the code can be
 universal: it does not matter which encoding strategies page is using.
 For now if there will be pages with different encoding strategies this
 code stops working.

 --
 Daniel






 Is there another way to do this?

 --
 Best regards,
 Daniel

 -
 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: How to get request/page parameters from RequestCycle?

2015-01-19 Thread Daniel Stoch
Maybe such workaround (not very elegant though):

app.init():
  getRequestCycleListeners().add(new PageRequestHandlerTracker());

  private Page getCurrentPage(RequestCycle requestCycle) {
IPageRequestHandler pageRequestHandler =
PageRequestHandlerTracker.getLastHandler(requestCycle);
if ((pageRequestHandler != null)  (pageRequestHandler.getPage()
instanceof Page)) {
  Page page = (Page)pageRequestHandler.getPage();
  return page;
}
return null;
  }

  Page page = getCurrentPage(requestCycle.getPageParameters());
  if (page != null) {
PageParameters pageParameters =
getCurrentPage(requestCycle.getPageParameters());
String value = pageParameters.getString(paramName);
  } ...

?

--
Daniel

On Mon, Jan 19, 2015 at 3:38 PM, Daniel Stoch daniel.st...@gmail.com wrote:
 Hi,

 In Wicket 1.4 I can get a page parameter value using this code:

 PageParameters pageParameters = requestCycle.getPageParameters();
 String value = pageParameters.getString(paramName);


 The problem is that in Wicket 6 there is no equivalent. I have tried
 with this solution:

 IRequestParameters requestParameters =
 requestCycle.getRequest().getRequestParameters();
 String value = requestParameters.getParameterValue(paramName).toString();

 but this does not work. These requestParameters does not contain
 parameters. I think the problem is related to url encoding strategy
 which is used. My urls are encoded like:
 somepath/param1/value1/param2/value2

 Is there another way to do this?

 --
 Best regards,
 Daniel

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



Re: How to get request/page parameters from RequestCycle?

2015-01-19 Thread Daniel Stoch
requestCycle.getRequest().getUrl() return null for me. - sorry, not
null but returns only a mount path without paramname/paramvalue part.

On Mon, Jan 19, 2015 at 5:09 PM, Daniel Stoch daniel.st...@gmail.com wrote:
 On Mon, Jan 19, 2015 at 4:54 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 On Mon, Jan 19, 2015 at 4:38 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 In Wicket 1.4 I can get a page parameter value using this code:

 PageParameters pageParameters = requestCycle.getPageParameters();
 String value = pageParameters.getString(paramName);


 The problem is that in Wicket 6 there is no equivalent. I have tried
 with this solution:

 IRequestParameters requestParameters =
 requestCycle.getRequest().getRequestParameters();
 String value =
 requestParameters.getParameterValue(paramName).toString();


 request.getQueryParameters() is the equivalent, but #getRequestParameters()
 would work too because it is a mix of GET and POST parameters

 But I think it does not work with UrlPathPageParametersEncoder.




 but this does not work. These requestParameters does not contain
 parameters. I think the problem is related to url encoding strategy
 which is used. My urls are encoded like:
 somepath/param1/value1/param2/value2


 Check org.apache.wicket.request.mapper.parameter.UrlPathPageParametersEncoder

 Ok, but how should I get url argument?
 requestCycle.getRequest().getUrl() return null for me.

 Another, minor, problem is that with this solution I have a hard coded
 page parameters encoder here. In previous version the code can be
 universal: it does not matter which encoding strategies page is using.
 For now if there will be pages with different encoding strategies this
 code stops working.

 --
 Daniel






 Is there another way to do this?

 --
 Best regards,
 Daniel

 -
 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: How to get request/page parameters from RequestCycle?

2015-01-19 Thread Daniel Stoch
This code is called inside custom
DefaultMapperContext.newPageInstance() implementation and in custom
IRequestMapper.mapRequest() method.

--
Daniel

On Mon, Jan 19, 2015 at 5:22 PM, Martin Grigorov mgrigo...@apache.org wrote:
 In what context do you need to extract these parameters ?
 In what class is this code ?

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

 On Mon, Jan 19, 2015 at 6:20 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Sorry, my fault - I forgot to pass a parameter.
 So:
   requestCycle.getRequest().getUrl()
 returns full path including mountpath and parameters, eg.:
 somepath/param1/value1

 But if I pass this to
 UrlPathPageParametersEncoder.decodePageParameters() this decodes
 somepath as a first argument.


 On Mon, Jan 19, 2015 at 5:12 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:
  requestCycle.getRequest().getUrl() return null for me. - sorry, not
  null but returns only a mount path without paramname/paramvalue part.
 
  On Mon, Jan 19, 2015 at 5:09 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:
  On Mon, Jan 19, 2015 at 4:54 PM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Hi,
 
  On Mon, Jan 19, 2015 at 4:38 PM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  Hi,
 
  In Wicket 1.4 I can get a page parameter value using this code:
 
  PageParameters pageParameters = requestCycle.getPageParameters();
  String value = pageParameters.getString(paramName);
 
 
  The problem is that in Wicket 6 there is no equivalent. I have tried
  with this solution:
 
  IRequestParameters requestParameters =
  requestCycle.getRequest().getRequestParameters();
  String value =
  requestParameters.getParameterValue(paramName).toString();
 
 
  request.getQueryParameters() is the equivalent, but
 #getRequestParameters()
  would work too because it is a mix of GET and POST parameters
 
  But I think it does not work with UrlPathPageParametersEncoder.
 
 
 
 
  but this does not work. These requestParameters does not contain
  parameters. I think the problem is related to url encoding strategy
  which is used. My urls are encoded like:
  somepath/param1/value1/param2/value2
 
 
  Check
 org.apache.wicket.request.mapper.parameter.UrlPathPageParametersEncoder
 
  Ok, but how should I get url argument?
  requestCycle.getRequest().getUrl() return null for me.
 
  Another, minor, problem is that with this solution I have a hard coded
  page parameters encoder here. In previous version the code can be
  universal: it does not matter which encoding strategies page is using.
  For now if there will be pages with different encoding strategies this
  code stops working.
 
  --
  Daniel
 
 
 
 
 
 
  Is there another way to do this?
 
  --
  Best regards,
  Daniel
 
  -
  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



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



Re: How to get request/page parameters from RequestCycle?

2015-01-19 Thread Daniel Stoch
I have found another solution: in my scenario I can get parameters
from DefaultMapperContext.
newPageInstance(). Thanks for your help and tips.

--
Daniel

On Mon, Jan 19, 2015 at 5:44 PM, Daniel Stoch daniel.st...@gmail.com wrote:
 This code is called inside custom
 DefaultMapperContext.newPageInstance() implementation and in custom
 IRequestMapper.mapRequest() method.

 --
 Daniel

 On Mon, Jan 19, 2015 at 5:22 PM, Martin Grigorov mgrigo...@apache.org wrote:
 In what context do you need to extract these parameters ?
 In what class is this code ?

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

 On Mon, Jan 19, 2015 at 6:20 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Sorry, my fault - I forgot to pass a parameter.
 So:
   requestCycle.getRequest().getUrl()
 returns full path including mountpath and parameters, eg.:
 somepath/param1/value1

 But if I pass this to
 UrlPathPageParametersEncoder.decodePageParameters() this decodes
 somepath as a first argument.


 On Mon, Jan 19, 2015 at 5:12 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:
  requestCycle.getRequest().getUrl() return null for me. - sorry, not
  null but returns only a mount path without paramname/paramvalue part.
 
  On Mon, Jan 19, 2015 at 5:09 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:
  On Mon, Jan 19, 2015 at 4:54 PM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Hi,
 
  On Mon, Jan 19, 2015 at 4:38 PM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  Hi,
 
  In Wicket 1.4 I can get a page parameter value using this code:
 
  PageParameters pageParameters = requestCycle.getPageParameters();
  String value = pageParameters.getString(paramName);
 
 
  The problem is that in Wicket 6 there is no equivalent. I have tried
  with this solution:
 
  IRequestParameters requestParameters =
  requestCycle.getRequest().getRequestParameters();
  String value =
  requestParameters.getParameterValue(paramName).toString();
 
 
  request.getQueryParameters() is the equivalent, but
 #getRequestParameters()
  would work too because it is a mix of GET and POST parameters
 
  But I think it does not work with UrlPathPageParametersEncoder.
 
 
 
 
  but this does not work. These requestParameters does not contain
  parameters. I think the problem is related to url encoding strategy
  which is used. My urls are encoded like:
  somepath/param1/value1/param2/value2
 
 
  Check
 org.apache.wicket.request.mapper.parameter.UrlPathPageParametersEncoder
 
  Ok, but how should I get url argument?
  requestCycle.getRequest().getUrl() return null for me.
 
  Another, minor, problem is that with this solution I have a hard coded
  page parameters encoder here. In previous version the code can be
  universal: it does not matter which encoding strategies page is using.
  For now if there will be pages with different encoding strategies this
  code stops working.
 
  --
  Daniel
 
 
 
 
 
 
  Is there another way to do this?
 
  --
  Best regards,
  Daniel
 
  -
  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



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



Re: Change in configuring AtmosphereServlet init-params

2015-01-13 Thread Daniel Stoch
Thanks for your answers.
I must check why this new version does not work in my app.

--
Best regards,
Daniel


On Mon, Jan 12, 2015 at 1:00 PM, Emond Papegaaij
emond.papega...@topicus.nl wrote:
 You are right. The filter allows the client to know the length of pushed
 messages. I believe it was also needed for very long messages. The problem
 with the default filter was, that the separator was far too common to use for
 wicket's Ajax responses and the default implementation did not offer a way to
 change the separator. This was fixed in recent versions of Atmosphere. In
 fact, changes to the API broke the old one, so I needed to replace it with the
 improved default.

 Best regards,
 Emond

 On Sunday 11 January 2015 21:54:36 Martin Grigorov wrote:
 Only Emond knows the details ...
 AFAIK TrackMessageSizeFilter was needed to overcome a problem in Atmosphere
 + Wicket's XML response.
 It seems Atmosphere 2.20+ provides the solution by itself so Wicket's one
 is not needed anymore.

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

 On Fri, Jan 9, 2015 at 3:41 PM, Daniel Stoch daniel.st...@gmail.com wrote:
  On Fri, Jan 9, 2015 at 2:37 PM, Martin Grigorov mgrigo...@apache.org
 
  wrote:
   Hi,
  
   I think this changes was needed to upgrade from Atmosphere 2.18 to 2.22.
   AFAIK this change is needed by Atmosphere itself.
   Wicket-Atmosphere doesn't use these parameters.
 
  Ok, I know that. But how did you (or Emond ;)) know how to changed it,
  maybe I should look into Atmosphere documentation?
  The old TrackMessageSizeFilter comes from Wicket-Atmosphere, so there
  was some reason to setup such parameter.
 
  --
  Daniel
 
   Martin Grigorov
   Wicket Training and Consulting
   https://twitter.com/mtgrigorov
  
   On Fri, Jan 9, 2015 at 11:07 AM, Daniel Stoch daniel.st...@gmail.com
  
   wrote:
   Hi,
  
   In the most recent version of atmosphere-example the init-params were
   changed in servlet configuration (in web.xml).
  
   From:
   init-param
  
 param-nameorg.atmosphere.cpr.broadcastFilterClasses/param-name
 
  param-valueorg.apache.wicket.atmosphere.TrackMessageSizeFilter/param-va
  lue
   /init-param
  
   To:
   init-param
  
 param-nameorg.atmosphere.cpr.AtmosphereInterceptor/param-name
 
  param-valueorg.atmosphere.client.TrackMessageSizeInterceptor/param-valu
  e
   /init-param
   init-param
 
  param-nameorg.atmosphere.client.TrackMessageSizeInterceptor.delimiter/p
  aram-name
 param-value![CDATA[|msg|]]/param-value
  
   /init-param
  
   What is the reason of this change, what these parameters are used for?
   Actual version does not work for me and I need to know how to debug
   this. Any tip will be helpful.
  
   --
   Best regards,
   Daniel
  
   -
   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


 -
 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



Change in configuring AtmosphereServlet init-params

2015-01-09 Thread Daniel Stoch
Hi,

In the most recent version of atmosphere-example the init-params were
changed in servlet configuration (in web.xml).

From:
init-param
  param-nameorg.atmosphere.cpr.broadcastFilterClasses/param-name
  param-valueorg.apache.wicket.atmosphere.TrackMessageSizeFilter/param-value
/init-param

To:
init-param
  param-nameorg.atmosphere.cpr.AtmosphereInterceptor/param-name
  param-valueorg.atmosphere.client.TrackMessageSizeInterceptor/param-value
/init-param
init-param
  
param-nameorg.atmosphere.client.TrackMessageSizeInterceptor.delimiter/param-name
  param-value![CDATA[|msg|]]/param-value
/init-param

What is the reason of this change, what these parameters are used for?
Actual version does not work for me and I need to know how to debug
this. Any tip will be helpful.

--
Best regards,
Daniel

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



Re: Change in configuring AtmosphereServlet init-params

2015-01-09 Thread Daniel Stoch
On Fri, Jan 9, 2015 at 2:37 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 I think this changes was needed to upgrade from Atmosphere 2.18 to 2.22.
 AFAIK this change is needed by Atmosphere itself.
 Wicket-Atmosphere doesn't use these parameters.

Ok, I know that. But how did you (or Emond ;)) know how to changed it,
maybe I should look into Atmosphere documentation?
The old TrackMessageSizeFilter comes from Wicket-Atmosphere, so there
was some reason to setup such parameter.

--
Daniel



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

 On Fri, Jan 9, 2015 at 11:07 AM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 In the most recent version of atmosphere-example the init-params were
 changed in servlet configuration (in web.xml).

 From:
 init-param
   param-nameorg.atmosphere.cpr.broadcastFilterClasses/param-name

 param-valueorg.apache.wicket.atmosphere.TrackMessageSizeFilter/param-value
 /init-param

 To:
 init-param
   param-nameorg.atmosphere.cpr.AtmosphereInterceptor/param-name

 param-valueorg.atmosphere.client.TrackMessageSizeInterceptor/param-value
 /init-param
 init-param

 param-nameorg.atmosphere.client.TrackMessageSizeInterceptor.delimiter/param-name
   param-value![CDATA[|msg|]]/param-value
 /init-param

 What is the reason of this change, what these parameters are used for?
 Actual version does not work for me and I need to know how to debug
 this. Any tip will be helpful.

 --
 Best regards,
 Daniel

 -
 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



Synchonization problems? (Cannot modify component hierarchy after render phase has started)

2014-12-18 Thread Daniel Stoch
Hi,

Is it possible that there is some issue with simultaneous access to a
page by different threads using wicket-atmosphere integration? From
time to time, when system send many server events to page, such error
can occurs - in onConfigure method I call setVisible on some children
components:

org.apache.wicket.WicketRuntimeException: Cannot modify component
hierarchy after render phase has started (page version cant change
then anymore)
at org.apache.wicket.Component.checkHierarchyChange(Component.java:3557)
at org.apache.wicket.Component.addStateChange(Component.java:3486)
at org.apache.wicket.Component.setVisible(Component.java:3173)
at myapp.MyPanel.onConfigure(MyPanel.java:83)
at org.apache.wicket.Component.configure(Component.java:1041)
at org.apache.wicket.Component.internalBeforeRender(Component.java:926)
at org.apache.wicket.Component.beforeRender(Component.java:1003)
at org.apache.wicket.Component.internalPrepareForRender(Component.java:2179)
at org.apache.wicket.Component.render(Component.java:2268)
at 
org.apache.wicket.ajax.XmlAjaxResponse.writeComponent(XmlAjaxResponse.java:128)
at 
org.apache.wicket.ajax.AbstractAjaxResponse.writeComponents(AbstractAjaxResponse.java:218)
at 
org.apache.wicket.ajax.AbstractAjaxResponse.writeTo(AbstractAjaxResponse.java:150)
at 
org.apache.wicket.ajax.AjaxRequestHandler.respond(AjaxRequestHandler.java:359)
at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:97)
at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:417)
at 
org.apache.wicket.atmosphere.EventBus.postToSingleResource(EventBus.java:393)
at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:346)
at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:329)

So it looks that some thread earlier mark this component as rendering?

--
Daniel

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



Re: How to call onResourceRequested for page behavior in ajax update (Atmosphere related)

2014-12-12 Thread Daniel Stoch
Hi,

Ok, I think I didn't described a problem well.

When you add a component which subscribes some events, then
AtmosphereBehavior is added to page. But the wicketAtmosphere JS
callback is registered inside AtmosphereBehavior.renderHead() method,
so only (I think) when the whole page is rendered. When you add a
component using ajax, then this code (renderHead) is not called, so
events are not broadcasted to client: because page is not registered
in EventBus and does not have atmosphere resource assigned.

So maybe my original question should be: how to invode this JS
callback from AtmosphereBehavior.renderHead in ajax requests?

--
Daniel

On Wed, Dec 10, 2014 at 12:19 PM, Daniel Stoch daniel.st...@gmail.com wrote:
 Hi,

 It seems that I am using an older version of AtmosphereBehavior which
 implements IResourceListener. Since 6.17.0 this implementation was
 removed and the code is moved to onRequest() method.
 So I must check a newer version, maybe my problem is solved.

 Thanks for a tip!

 --
 Daniel

 On Wed, Dec 10, 2014 at 11:03 AM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 Hi,

 Please give more details.
 https://github.com/apache/wicket/blob/master/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java#L51
 doesn't implement IResourceListener, so it seems you do something custom.

 Just implementing IResourceListener doesn't mean anything to Wicket.
 You need to create a callback url with
 org.apache.wicket.Component#urlFor(org.apache.wicket.RequestListenerInterface,
 org.apache.wicket.request.mapper.parameter.PageParameters) and use it
 somehow to invoke org.apache.wicket.IResourceListener#onResourceRequested


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

 On Wed, Dec 10, 2014 at 11:45 AM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Is it possible to invoke this listener manually, or maybe this is a
 generally a bad practise?

 --
 Daniel

  On 9 gru 2014, at 12:24, Daniel Stoch daniel.st...@gmail.com wrote:
 
  Hi,
 
  I have a behavior which implements IResourceListener
  (AtmosphereBehavior). The problem is when this behavior is added to
  page during ajax request (eg. some panel is dynamically added to page)
  - then onResourceRequested is not invoked for page. So when using
  AtmosphereBehavior the suspended connection from the client is not
  registered.
 
  How should I solve this problem: how and when call this
  onResourceRequested method?
 
  --
  Best regards,
  Daniel

 -
 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: How to call onResourceRequested for page behavior in ajax update (Atmosphere related)

2014-12-12 Thread Daniel Stoch
On Fri, Dec 12, 2014 at 11:38 AM, Martin Grigorov mgrigo...@apache.org wrote:
 I see it is a bit ugly, but oh well... this is how it works now.

 in YourComponent#renderHead():

 AtmosphereBehavior atmo =
 getPage().getBehaviors(AtmosphereBehavior.class).get(0);
 CharSequence callbackUrl = atmo.getCallbackUrl();
 headerResponse.render(OnDomReadyHeaderItem.forScript(Wicket.Ajax.get({u:
 +callbackUrl+})));

Thanks, it works.
But I call whole atmo.renderHead(page, response); method.


 You may need to use some flag to make sure this happens once per page
 instance. Otherwise every re-render of such component will initialize a new
 web socket connection (or whatever fallback you may use)


Hmmm, do we really need this check if I call whole atmo.renderHead method?

Thanks for your help.

--
Daniel


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

 On Fri, Dec 12, 2014 at 11:36 AM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 Ok, I think I didn't described a problem well.

 When you add a component which subscribes some events, then
 AtmosphereBehavior is added to page. But the wicketAtmosphere JS
 callback is registered inside AtmosphereBehavior.renderHead() method,
 so only (I think) when the whole page is rendered. When you add a
 component using ajax, then this code (renderHead) is not called, so
 events are not broadcasted to client: because page is not registered
 in EventBus and does not have atmosphere resource assigned.

 So maybe my original question should be: how to invode this JS
 callback from AtmosphereBehavior.renderHead in ajax requests?

 --
 Daniel

 On Wed, Dec 10, 2014 at 12:19 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:
  Hi,
 
  It seems that I am using an older version of AtmosphereBehavior which
  implements IResourceListener. Since 6.17.0 this implementation was
  removed and the code is moved to onRequest() method.
  So I must check a newer version, maybe my problem is solved.
 
  Thanks for a tip!
 
  --
  Daniel
 
  On Wed, Dec 10, 2014 at 11:03 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Hi,
 
  Please give more details.
 
 https://github.com/apache/wicket/blob/master/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java#L51
  doesn't implement IResourceListener, so it seems you do something
 custom.
 
  Just implementing IResourceListener doesn't mean anything to Wicket.
  You need to create a callback url with
 
 org.apache.wicket.Component#urlFor(org.apache.wicket.RequestListenerInterface,
  org.apache.wicket.request.mapper.parameter.PageParameters) and use it
  somehow to invoke
 org.apache.wicket.IResourceListener#onResourceRequested
 
 
  Martin Grigorov
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Wed, Dec 10, 2014 at 11:45 AM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  Is it possible to invoke this listener manually, or maybe this is a
  generally a bad practise?
 
  --
  Daniel
 
   On 9 gru 2014, at 12:24, Daniel Stoch daniel.st...@gmail.com
 wrote:
  
   Hi,
  
   I have a behavior which implements IResourceListener
   (AtmosphereBehavior). The problem is when this behavior is added to
   page during ajax request (eg. some panel is dynamically added to
 page)
   - then onResourceRequested is not invoked for page. So when using
   AtmosphereBehavior the suspended connection from the client is not
   registered.
  
   How should I solve this problem: how and when call this
   onResourceRequested method?
  
   --
   Best regards,
   Daniel
 
  -
  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



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



Re: How to call onResourceRequested for page behavior in ajax update (Atmosphere related)

2014-12-10 Thread Daniel Stoch
Is it possible to invoke this listener manually, or maybe this is a generally a 
bad practise?

--
Daniel

 On 9 gru 2014, at 12:24, Daniel Stoch daniel.st...@gmail.com wrote:
 
 Hi,
 
 I have a behavior which implements IResourceListener
 (AtmosphereBehavior). The problem is when this behavior is added to
 page during ajax request (eg. some panel is dynamically added to page)
 - then onResourceRequested is not invoked for page. So when using
 AtmosphereBehavior the suspended connection from the client is not
 registered.
 
 How should I solve this problem: how and when call this
 onResourceRequested method?
 
 --
 Best regards,
 Daniel

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



Re: How to call onResourceRequested for page behavior in ajax update (Atmosphere related)

2014-12-10 Thread Daniel Stoch
Hi,

It seems that I am using an older version of AtmosphereBehavior which
implements IResourceListener. Since 6.17.0 this implementation was
removed and the code is moved to onRequest() method.
So I must check a newer version, maybe my problem is solved.

Thanks for a tip!

--
Daniel

On Wed, Dec 10, 2014 at 11:03 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 Please give more details.
 https://github.com/apache/wicket/blob/master/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java#L51
 doesn't implement IResourceListener, so it seems you do something custom.

 Just implementing IResourceListener doesn't mean anything to Wicket.
 You need to create a callback url with
 org.apache.wicket.Component#urlFor(org.apache.wicket.RequestListenerInterface,
 org.apache.wicket.request.mapper.parameter.PageParameters) and use it
 somehow to invoke org.apache.wicket.IResourceListener#onResourceRequested


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

 On Wed, Dec 10, 2014 at 11:45 AM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Is it possible to invoke this listener manually, or maybe this is a
 generally a bad practise?

 --
 Daniel

  On 9 gru 2014, at 12:24, Daniel Stoch daniel.st...@gmail.com wrote:
 
  Hi,
 
  I have a behavior which implements IResourceListener
  (AtmosphereBehavior). The problem is when this behavior is added to
  page during ajax request (eg. some panel is dynamically added to page)
  - then onResourceRequested is not invoked for page. So when using
  AtmosphereBehavior the suspended connection from the client is not
  registered.
 
  How should I solve this problem: how and when call this
  onResourceRequested method?
 
  --
  Best regards,
  Daniel

 -
 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



How to call onResourceRequested for page behavior in ajax update (Atmosphere related)

2014-12-09 Thread Daniel Stoch
Hi,

I have a behavior which implements IResourceListener
(AtmosphereBehavior). The problem is when this behavior is added to
page during ajax request (eg. some panel is dynamically added to page)
- then onResourceRequested is not invoked for page. So when using
AtmosphereBehavior the suspended connection from the client is not
registered.

How should I solve this problem: how and when call this
onResourceRequested method?

--
Best regards,
Daniel

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



Wicket-Ajax-BaseURL encoding problem when uploading file using ajax

2014-11-07 Thread Daniel Stoch
Hi,

I have a strange error when uploading file using ajax request. I have
a page with parameters whit url like:
http://localhost:8080/myapp/customer/id/1234

When I am opening a modal window with upload form the Wicket-Ajax-BaseURL is:
  customer/id/1234?1
and all links in ajax response are properly constructed, eg.:
  
../../wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-140930656.js

But when I choose a file and press upload (using AjaxSubmitButton)
then in the followed request Wicket-Ajax-BaseURL is encoded like:
  customer%2Fid%2F1234
so the code inside UrlRenderer.renderRelativeUrl does not find a
proper baseUrlSegments so the calculated renderedUrl is wrong. This
leads to invalid url paths, eg.:
  
./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-140930656.js
and other errors with resolving urls.

I cannot find where this base url can be broken? Maybe the problem is
somewhere in my code, but I don't know where to search for this.

PS. The same error is in FF and Chrome. Wicket 6.17.0.

--
Best regards,
Daniel

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



Re: Wicket-Ajax-BaseURL encoding problem when uploading file using ajax

2014-11-07 Thread Daniel Stoch
I think the problem is in POST request when submitting a form. In
wicket-ajax-jquery.js wicket-ajax-baseurl parametr is appended to
request url. It is encoded using Wicket.Form.encode:
  form.action = attrs.u + separator +
wicket-ajax=truewicket-ajax-baseurl= +
Wicket.Form.encode(getAjaxBaseUrl());

After this an url becomes encoded using escaped %2F instead of slashes
(eg. customer%2Fid%2F1234).
This leads to resolving urls problems, as I have described in my previous post.

--
Best regards,
Daniel

On Fri, Nov 7, 2014 at 1:30 PM, Daniel Stoch daniel.st...@gmail.com wrote:
 Hi,

 I have a strange error when uploading file using ajax request. I have
 a page with parameters whit url like:
 http://localhost:8080/myapp/customer/id/1234

 When I am opening a modal window with upload form the Wicket-Ajax-BaseURL is:
   customer/id/1234?1
 and all links in ajax response are properly constructed, eg.:
   
 ../../wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-140930656.js

 But when I choose a file and press upload (using AjaxSubmitButton)
 then in the followed request Wicket-Ajax-BaseURL is encoded like:
   customer%2Fid%2F1234
 so the code inside UrlRenderer.renderRelativeUrl does not find a
 proper baseUrlSegments so the calculated renderedUrl is wrong. This
 leads to invalid url paths, eg.:
   
 ./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-140930656.js
 and other errors with resolving urls.

 I cannot find where this base url can be broken? Maybe the problem is
 somewhere in my code, but I don't know where to search for this.

 PS. The same error is in FF and Chrome. Wicket 6.17.0.

 --
 Best regards,
 Daniel

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



Add extra debug information to component markup

2014-10-02 Thread Daniel Stoch
Hi,

I want to add extra debug information to component markup or modify
existing wicketpath info.

For now it can be easily done by using a custom default
IMarkupSourcingStrategy which has onComponentTag() method. But inside
Component.getMarkupSourcingStrategy() the default strategy is get
using a static call to a singleton
DefaultMarkupSourcingStrategy.get(). Maybe there should be a method
inside IMarkupSettings:
  IMarkupSourcingStrategy getDefaultMarkupSourcingStrategy()
which can be used in Component.getMarkupSourcingStrategy() instead a
direct call to DefaultMarkupSourcingStrategy.get().

Another solution is to invent another extension point to allow to
customize all components tags, but this described above is very simple
to implement I think.

PS. I want to add some extra information about class names where every
component come from (to allow developers, especially not GUI guys, to
easily find a source code).

--
Daniel

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



Re: Add extra debug information to component markup

2014-10-02 Thread Daniel Stoch
You are fast :).
I wanted to write about this solution - came to my mind right now :)

--
Thanks,
Daniel

On Thu, Oct 2, 2014 at 12:38 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 You can use Behavior#onComponentTag().
 And IComponentInstantiationListenener to add this behavior to all/some
 components.

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

 On Thu, Oct 2, 2014 at 12:35 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 I want to add extra debug information to component markup or modify
 existing wicketpath info.

 For now it can be easily done by using a custom default
 IMarkupSourcingStrategy which has onComponentTag() method. But inside
 Component.getMarkupSourcingStrategy() the default strategy is get
 using a static call to a singleton
 DefaultMarkupSourcingStrategy.get(). Maybe there should be a method
 inside IMarkupSettings:
   IMarkupSourcingStrategy getDefaultMarkupSourcingStrategy()
 which can be used in Component.getMarkupSourcingStrategy() instead a
 direct call to DefaultMarkupSourcingStrategy.get().

 Another solution is to invent another extension point to allow to
 customize all components tags, but this described above is very simple
 to implement I think.

 PS. I want to add some extra information about class names where every
 component come from (to allow developers, especially not GUI guys, to
 easily find a source code).

 --
 Daniel

 -
 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: How to handle click on removed links - WicketRuntimeException (Component 'xxx' has been removed from page)?

2014-07-07 Thread Daniel Stoch
I think the simplest solution for now (until we invent a better one)
is to define a dedicated exception class for such case (similar to
ListenerInvocationNotAllowedException which is raised if user tries
click on disabled links). Then we can catch such exception and handle
it eg. as described by Martin in my previous post (How to handle
click on disabled links - ListenerInvocationNotAllowedException?).

--
Daniel

On Fri, Jul 4, 2014 at 5:38 PM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
 maybe what is needed is a fail silently ajax request ;-)


 On Fri, Jul 4, 2014 at 5:36 PM, Ernesto Reinaldo Barreiro 
 reier...@gmail.com wrote:

 Hi,


 On Fri, Jul 4, 2014 at 4:59 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Sorry, but for me all these solutions are hacks :).


 Why? As far as they are under control... Isn't software development
 production controlled hacks? Wicket itself is a hack and so do are
 other WEB frameworks like GWT. As far as you remain in control I do not see
 the problem. All frameworks have limitations... Why not get the best of
 them and circumvent those.


 I want to use standard components (eg. AjaxLink) to do simple things.
 I don't want to think everywhere how to handle such scenarios. It
 should be handled properly on a framework level. I think there is
 always possibility that component state on server and DOM tree on
 client browser are inconsistent (and not necessary because of push
 requests). Maybe it should be a dedicated exception on such situation
 (Component 'xxx' has been removed from page.) at least or maybe we
 can invent a better solution in core?


 I do agree that would be optimal.




 --
 Daniel

 On Fri, Jul 4, 2014 at 4:11 PM, Ernesto Reinaldo Barreiro
 reier...@gmail.com wrote:
  Maybe you could even just push JSON to client side and generate items
  content at client side which is going to be way faster
 
 
  On Fri, Jul 4, 2014 at 4:06 PM, Ernesto Reinaldo Barreiro 
  reier...@gmail.com wrote:
 
  Why don't you try routing all the click to a part of you application
 that
  is always available? E.g.
 
  1- You have a list of items that are pushed... They are in a certain
  container that is always there... At client and server side
  2- The items are pushed but instead of normal AJAX link you use link to
  the parent never changing container passing ID of item. This way click
 will
  never fail and it is still sort of object oriented...
 
 
 
  On Fri, Jul 4, 2014 at 3:59 PM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  On Fri, Jul 4, 2014 at 3:14 PM, Martin Grigorov mgrigo...@apache.org
 
  wrote:
   Hi,
  
   You can use Atmopshere to hide/disable the client side too, not
 just the
   server side.
 
  Of course, I already do that.
  But user can click the link after state was changed on the server side
  but before these changes are pushed to client browser.
 
  --
  Daniel
 
 
  
   Martin Grigorov
   Wicket Training and Consulting
   https://twitter.com/mtgrigorov
  
  
   On Fri, Jul 4, 2014 at 1:46 PM, Daniel Stoch 
 daniel.st...@gmail.com
  wrote:
  
   On Fri, Jul 4, 2014 at 12:33 PM, Sven Meier s...@meiers.net
 wrote:
So page was rendered in a browser,
on the server component tree was changed
   
   
What triggers the change to the component tree? On which thread?
 Are
  you
using websockets?
   
Sven
  
   In general this thread is not initialized by user action but by
   application. So yes, it can be push from a server (eg. using
   Atmosphere - this is my case) or by ajax self updating behavior.
  
   --
   DS
  
   
   
   
On 07/04/2014 12:13 PM, Daniel Stoch wrote:
   
Hi all,
   
I think such question occurs from time to time on this list,
 but I
have never found a good answer how to solve such problem in
 general.
The problem is similar to my last question:
   
   
  
 
 http://apache-wicket.1842946.n4.nabble.com/How-to-handle-click-on-disabled-links-ListenerInvocationNotAllowedException-td4666287.html
but now there is a situation when link was removed from page
 (not
disabled).
   
So page was rendered in a browser, on the server component tree
 was
changed, but user clicks a link in a browser before this changes
  will
be pushed to it. It leads to an exception:
   
org.apache.wicket.WicketRuntimeException: Component 'xxx' has
 been
removed from page.
at
   
  
 
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:178)
at
   
  
 
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
at
   
  
 
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at
   
  
 
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
at
   
  
 
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218

How to handle click on removed links - WicketRuntimeException (Component 'xxx' has been removed from page)?

2014-07-04 Thread Daniel Stoch
Hi all,

I think such question occurs from time to time on this list, but I
have never found a good answer how to solve such problem in general.
The problem is similar to my last question:
http://apache-wicket.1842946.n4.nabble.com/How-to-handle-click-on-disabled-links-ListenerInvocationNotAllowedException-td4666287.html
but now there is a situation when link was removed from page (not disabled).

So page was rendered in a browser, on the server component tree was
changed, but user clicks a link in a browser before this changes will
be pushed to it. It leads to an exception:

org.apache.wicket.WicketRuntimeException: Component 'xxx' has been
removed from page.
at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:178)
at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
at 
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

How it should be properly handled in application? Unfortunately this
is not a dedicated exception to catch somewhere, but a common
WicketRuntimeException.

--
Best regards,
Daniel

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



Re: How to handle click on removed links - WicketRuntimeException (Component 'xxx' has been removed from page)?

2014-07-04 Thread Daniel Stoch
This is a popular answer on such querstions (use veil and so on) :).
But it is not the case here, because we do not know whet to block here.
Beside this, in general I think it is not a good solution.

On Fri, Jul 4, 2014 at 12:30 PM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
 Block the UI?


 On Fri, Jul 4, 2014 at 12:13 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi all,

 I think such question occurs from time to time on this list, but I
 have never found a good answer how to solve such problem in general.
 The problem is similar to my last question:

 http://apache-wicket.1842946.n4.nabble.com/How-to-handle-click-on-disabled-links-ListenerInvocationNotAllowedException-td4666287.html
 but now there is a situation when link was removed from page (not
 disabled).

 So page was rendered in a browser, on the server component tree was
 changed, but user clicks a link in a browser before this changes will
 be pushed to it. It leads to an exception:

 org.apache.wicket.WicketRuntimeException: Component 'xxx' has been
 removed from page.
 at
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:178)
 at
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
 at
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
 at
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
 at
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
 at
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
 at
 org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
 at
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
 at
 org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

 How it should be properly handled in application? Unfortunately this
 is not a dedicated exception to catch somewhere, but a common
 WicketRuntimeException.

 --
 Best regards,
 Daniel

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




 --
 Regards - Ernesto Reinaldo Barreiro

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



Re: How to handle click on removed links - WicketRuntimeException (Component 'xxx' has been removed from page)?

2014-07-04 Thread Daniel Stoch
On Fri, Jul 4, 2014 at 12:33 PM, Sven Meier s...@meiers.net wrote:
 So page was rendered in a browser,
 on the server component tree was changed


 What triggers the change to the component tree? On which thread? Are you
 using websockets?

 Sven

In general this thread is not initialized by user action but by
application. So yes, it can be push from a server (eg. using
Atmosphere - this is my case) or by ajax self updating behavior.

--
DS




 On 07/04/2014 12:13 PM, Daniel Stoch wrote:

 Hi all,

 I think such question occurs from time to time on this list, but I
 have never found a good answer how to solve such problem in general.
 The problem is similar to my last question:

 http://apache-wicket.1842946.n4.nabble.com/How-to-handle-click-on-disabled-links-ListenerInvocationNotAllowedException-td4666287.html
 but now there is a situation when link was removed from page (not
 disabled).

 So page was rendered in a browser, on the server component tree was
 changed, but user clicks a link in a browser before this changes will
 be pushed to it. It leads to an exception:

 org.apache.wicket.WicketRuntimeException: Component 'xxx' has been
 removed from page.
 at
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:178)
 at
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
 at
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
 at
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
 at
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
 at
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
 at
 org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
 at
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
 at
 org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

 How it should be properly handled in application? Unfortunately this
 is not a dedicated exception to catch somewhere, but a common
 WicketRuntimeException.

 --
 Best regards,
 Daniel

 -
 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


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



Re: How to handle click on removed links - WicketRuntimeException (Component 'xxx' has been removed from page)?

2014-07-04 Thread Daniel Stoch
I have added the appropriate information in that thread.

On Fri, Jul 4, 2014 at 12:47 PM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
 Sven's question goes straight to the point: do you know what is causing the
 mismacth?


 On Fri, Jul 4, 2014 at 12:44 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 This is a popular answer on such querstions (use veil and so on) :).
 But it is not the case here, because we do not know whet to block here.
 Beside this, in general I think it is not a good solution.

 It works for me in many applications.


 On Fri, Jul 4, 2014 at 12:30 PM, Ernesto Reinaldo Barreiro
 reier...@gmail.com wrote:
  Block the UI?
 
 
  On Fri, Jul 4, 2014 at 12:13 PM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  Hi all,
 
  I think such question occurs from time to time on this list, but I
  have never found a good answer how to solve such problem in general.
  The problem is similar to my last question:
 
 
 http://apache-wicket.1842946.n4.nabble.com/How-to-handle-click-on-disabled-links-ListenerInvocationNotAllowedException-td4666287.html
  but now there is a situation when link was removed from page (not
  disabled).
 
  So page was rendered in a browser, on the server component tree was
  changed, but user clicks a link in a browser before this changes will
  be pushed to it. It leads to an exception:
 
  org.apache.wicket.WicketRuntimeException: Component 'xxx' has been
  removed from page.
  at
 
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:178)
  at
 
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
  at
 
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
  at
 
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
  at
 
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
  at
 
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
  at
 
 org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
  at
 
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
  at
 
 org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
 
  How it should be properly handled in application? Unfortunately this
  is not a dedicated exception to catch somewhere, but a common
  WicketRuntimeException.
 
  --
  Best regards,
  Daniel
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  Regards - Ernesto Reinaldo Barreiro

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




 --
 Regards - Ernesto Reinaldo Barreiro

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



Re: How to handle click on removed links - WicketRuntimeException (Component 'xxx' has been removed from page)?

2014-07-04 Thread Daniel Stoch
On Fri, Jul 4, 2014 at 3:14 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 You can use Atmopshere to hide/disable the client side too, not just the
 server side.

Of course, I already do that.
But user can click the link after state was changed on the server side
but before these changes are pushed to client browser.

--
Daniel



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


 On Fri, Jul 4, 2014 at 1:46 PM, Daniel Stoch daniel.st...@gmail.com wrote:

 On Fri, Jul 4, 2014 at 12:33 PM, Sven Meier s...@meiers.net wrote:
  So page was rendered in a browser,
  on the server component tree was changed
 
 
  What triggers the change to the component tree? On which thread? Are you
  using websockets?
 
  Sven

 In general this thread is not initialized by user action but by
 application. So yes, it can be push from a server (eg. using
 Atmosphere - this is my case) or by ajax self updating behavior.

 --
 DS

 
 
 
  On 07/04/2014 12:13 PM, Daniel Stoch wrote:
 
  Hi all,
 
  I think such question occurs from time to time on this list, but I
  have never found a good answer how to solve such problem in general.
  The problem is similar to my last question:
 
 
 http://apache-wicket.1842946.n4.nabble.com/How-to-handle-click-on-disabled-links-ListenerInvocationNotAllowedException-td4666287.html
  but now there is a situation when link was removed from page (not
  disabled).
 
  So page was rendered in a browser, on the server component tree was
  changed, but user clicks a link in a browser before this changes will
  be pushed to it. It leads to an exception:
 
  org.apache.wicket.WicketRuntimeException: Component 'xxx' has been
  removed from page.
  at
 
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:178)
  at
 
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
  at
 
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
  at
 
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
  at
 
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
  at
 
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
  at
 
 org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
  at
 
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
  at
 
 org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
 
  How it should be properly handled in application? Unfortunately this
  is not a dedicated exception to catch somewhere, but a common
  WicketRuntimeException.
 
  --
  Best regards,
  Daniel
 
  -
  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
 

 -
 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: How to handle click on removed links - WicketRuntimeException (Component 'xxx' has been removed from page)?

2014-07-04 Thread Daniel Stoch
Sorry, but for me all these solutions are hacks :).
I want to use standard components (eg. AjaxLink) to do simple things.
I don't want to think everywhere how to handle such scenarios. It
should be handled properly on a framework level. I think there is
always possibility that component state on server and DOM tree on
client browser are inconsistent (and not necessary because of push
requests). Maybe it should be a dedicated exception on such situation
(Component 'xxx' has been removed from page.) at least or maybe we
can invent a better solution in core?

--
Daniel

On Fri, Jul 4, 2014 at 4:11 PM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
 Maybe you could even just push JSON to client side and generate items
 content at client side which is going to be way faster


 On Fri, Jul 4, 2014 at 4:06 PM, Ernesto Reinaldo Barreiro 
 reier...@gmail.com wrote:

 Why don't you try routing all the click to a part of you application that
 is always available? E.g.

 1- You have a list of items that are pushed... They are in a certain
 container that is always there... At client and server side
 2- The items are pushed but instead of normal AJAX link you use link to
 the parent never changing container passing ID of item. This way click will
 never fail and it is still sort of object oriented...



 On Fri, Jul 4, 2014 at 3:59 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 On Fri, Jul 4, 2014 at 3:14 PM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Hi,
 
  You can use Atmopshere to hide/disable the client side too, not just the
  server side.

 Of course, I already do that.
 But user can click the link after state was changed on the server side
 but before these changes are pushed to client browser.

 --
 Daniel


 
  Martin Grigorov
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
 
  On Fri, Jul 4, 2014 at 1:46 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:
 
  On Fri, Jul 4, 2014 at 12:33 PM, Sven Meier s...@meiers.net wrote:
   So page was rendered in a browser,
   on the server component tree was changed
  
  
   What triggers the change to the component tree? On which thread? Are
 you
   using websockets?
  
   Sven
 
  In general this thread is not initialized by user action but by
  application. So yes, it can be push from a server (eg. using
  Atmosphere - this is my case) or by ajax self updating behavior.
 
  --
  DS
 
  
  
  
   On 07/04/2014 12:13 PM, Daniel Stoch wrote:
  
   Hi all,
  
   I think such question occurs from time to time on this list, but I
   have never found a good answer how to solve such problem in general.
   The problem is similar to my last question:
  
  
 
 http://apache-wicket.1842946.n4.nabble.com/How-to-handle-click-on-disabled-links-ListenerInvocationNotAllowedException-td4666287.html
   but now there is a situation when link was removed from page (not
   disabled).
  
   So page was rendered in a browser, on the server component tree was
   changed, but user clicks a link in a browser before this changes
 will
   be pushed to it. It leads to an exception:
  
   org.apache.wicket.WicketRuntimeException: Component 'xxx' has been
   removed from page.
   at
  
 
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:178)
   at
  
 
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
   at
  
 
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
   at
  
 
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
   at
  
 
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
   at
  
 
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
   at
  
 
 org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
   at
  
 
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
   at
  
 
 org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
  
   How it should be properly handled in application? Unfortunately this
   is not a dedicated exception to catch somewhere, but a common
   WicketRuntimeException.
  
   --
   Best regards,
   Daniel
  
  
 -
   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
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail

How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Daniel Stoch
Hi,

I have a link (or ajax link) which executes some system command. This
system gives me an information if this command is enabled or not, so I
can mark my link as enabled or disabled (by calling
setEnabled(command.isEnabled()) or overriding link.isEnabled()
method).

1. Page is being rendered, command is enabled so link is rendered as enabled.
2. In the meantime system state is changed so command became disabled.
3. User clicks link on a page rendered in step 1 where link is
rendered as enabled but it is disabled now.

In Wicket 1.4 nothing happens in such situation and only warning was logged:
component not enabled or visible; ignoring call. Component:
[MarkupContainer [Component id = link]]

In Wicket 6 in such situation the exception is raised:
ListenerInvocationNotAllowedException: Behavior rejected interface invocation.

How should I handle this correctly to show some information to user,
that this is link is no longer active (but user should stay on the
same page)?
Should I catch ListenerInvocationNotAllowedException inside
IRequestCycleListener.onException()?

--
Daniel

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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Daniel Stoch
On Tue, Jun 17, 2014 at 4:14 PM, Sven Meier s...@meiers.net wrote:
 Hi,

 when you alter the enabled state in #onConfigure() - this is recommended
 instead of overriding #isEnabled() - the link will still be enabled when the
 next click comes in.

Hmmm, I think I don't understand :). The next click does not come
because exception is raised. If I catch exception and do nothing the
link is still enabled to user, because page is not rerendered,

 You can handle the changed system state in your application logic.

How?
The only solution I know is to auto-refresh a page (eg. using push),
but user can always click faster ;).


 Best regards
 Sven


 On 06/17/2014 03:55 PM, Daniel Stoch wrote:

 Hi,

 I have a link (or ajax link) which executes some system command. This
 system gives me an information if this command is enabled or not, so I
 can mark my link as enabled or disabled (by calling
 setEnabled(command.isEnabled()) or overriding link.isEnabled()
 method).

 1. Page is being rendered, command is enabled so link is rendered as
 enabled.
 2. In the meantime system state is changed so command became disabled.
 3. User clicks link on a page rendered in step 1 where link is
 rendered as enabled but it is disabled now.

 In Wicket 1.4 nothing happens in such situation and only warning was
 logged:
 component not enabled or visible; ignoring call. Component:
 [MarkupContainer [Component id = link]]

 In Wicket 6 in such situation the exception is raised:
 ListenerInvocationNotAllowedException: Behavior rejected interface
 invocation.

 How should I handle this correctly to show some information to user,
 that this is link is no longer active (but user should stay on the
 same page)?
 Should I catch ListenerInvocationNotAllowedException inside
 IRequestCycleListener.onException()?

 --
 Daniel

 -
 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


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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Daniel Stoch
On Tue, Jun 17, 2014 at 4:00 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,


 On Tue, Jun 17, 2014 at 4:55 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 I have a link (or ajax link) which executes some system command. This
 system gives me an information if this command is enabled or not, so I
 can mark my link as enabled or disabled (by calling
 setEnabled(command.isEnabled()) or overriding link.isEnabled()
 method).

 1. Page is being rendered, command is enabled so link is rendered as
 enabled.
 2. In the meantime system state is changed so command became disabled.
 3. User clicks link on a page rendered in step 1 where link is
 rendered as enabled but it is disabled now.

 In Wicket 1.4 nothing happens in such situation and only warning was
 logged:
 component not enabled or visible; ignoring call. Component:
 [MarkupContainer [Component id = link]]

 In Wicket 6 in such situation the exception is raised:
 ListenerInvocationNotAllowedException: Behavior rejected interface
 invocation.

 How should I handle this correctly to show some information to user,
 that this is link is no longer active (but user should stay on the
 same page)?
 Should I catch ListenerInvocationNotAllowedException inside
 IRequestCycleListener.onException()?


 Yes. This is the best you can do in this case.


Thanks for very fast answer :)
But what should I return as a IRequestHandler in
IRequestCycleListener.onException()? I can return EmptyRequestHandler
to silently catch an exception, but if I want show some info to user
then...?

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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Daniel Stoch
On Tue, Jun 17, 2014 at 4:27 PM, Sven Meier s...@meiers.net wrote:
 Hi,


 The next click does not come because exception is raised.


 if the link is still enabled, which exception should be thrown then?

 Sven


Please read again steps 1,2,3 ;).
Link is rendered as enabled in the browser (1), but on the server is
not enabled anymore (3).

--
Daniel

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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Daniel Stoch
On Tue, Jun 17, 2014 at 5:08 PM, Sven Meier s...@meiers.net wrote:
 If you alter the enabled state of your links in #onConfigure(), they will
 still be enabled - even if the server state already changed.

 Sven

Yes, you're right!

I have investigated two scenarios just before your last answer :).
1. Link has overriden isEnabled() - then
ListenerInvocationNotAllowedException is when command is not (as I
described in my first post).
2. The enabled state of links are altered in #onConfigure() - link is
still enabled even if the server state already changed. So we must do
an extra check in onClick() method.

So now I try to use the second solution (I have an abstraction over
all links so it would be easy to implement) and add an extra check
before calling a link code.
Thanks for your help.

--
Daniel




 On 06/17/2014 04:32 PM, Daniel Stoch wrote:

 On Tue, Jun 17, 2014 at 4:27 PM, Sven Meier s...@meiers.net wrote:

 Hi,


 The next click does not come because exception is raised.


 if the link is still enabled, which exception should be thrown then?

 Sven

 Please read again steps 1,2,3 ;).
 Link is rendered as enabled in the browser (1), but on the server is
 not enabled anymore (3).

 --
 Daniel

 -
 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


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



Atmosphere - multiple browser tabs and page versioning

2014-04-29 Thread Daniel Stoch
Hi,

I have modified wicket-atmosphere example with sending messages, to display
a browser (DataView) with all received messages. So when user sends a
message (String) it will be added to list of messages stored in a page and
the browser is refreshed. There is a strange behavior when we open two
browser tabs (FF 28, Wicket 6.15.0, Wicket-Atmosphere 0.18).

1. Start example app and opens home page in two tabs:
   tab0 = http://localhost:8080/app/?0
   tab1 = http://localhost:8080/app/?1
2. Enter 1 in input field on tab0, click Send message. Both tabs
receive 1 message and it will be displayed in a browser.
3. Send 2 in tab0:
- on tab1 browser displays 2 rows: 2, 1
- on tab0 browser displays only 1 row: 2
4. Test sending another messages on tab0 or tab1 - you will see that not
all messages are received.

It looks like a problem with page versioning or something similar. The list
of messages (messages field in a page) is not properly restored in
following requests. Here is a simple log from example app using above
scenario:

- sending 1
BEFORE: 1, messages=[]
AFTER: 1, messages=[1]
BEFORE: 1, messages=[]
AFTER: 1, messages=[1]
- sending 2
BEFORE: 2, messages=[1]
AFTER: 2, messages=[2, 1]
BEFORE: 2, messages=[]
AFTER: 2, messages=[2]

As you can see a list of messages on one tab becomes empty on the second
send. You can try to send messages from tab0 or tab1 and you should see
that strange behavior (messages list is not updated properly).

Is it a bug or maybe it is something wrong in my example? Maybe I should
turn on (somehow) multiple tabs support, there is such setting in Wicket
1.4 but in Wicket 6 I belive there is not necessary to configure such
support in any special way?

BTW: Why in the original example page versioning is disabled:
setVersioned(false); ?


Example project:
https://dl.dropboxusercontent.com/u/138504/wicket-atmosphere-tabs-example.zip

--
Best regards,
Daniel


Session size vs detached models

2014-02-14 Thread Daniel Stoch
Hi,

In Wicket 1.4 the last page reference is hold in a session (is it in 6.x
also?). So after a request has been processed all components and models
should be detached, so this last page reference should not hold transient
LDM values. Is it true?

When we are using DebugBar with SessionSizeDebugPanel, it displays session
size and totalSize (by SessionTotalSizeModel). Does this totalSize includes
size of object loaded by LDM or it counts all components and models size in
detached state?

--
Daniel


Re: Session size vs detached models

2014-02-14 Thread Daniel Stoch
On Fri, Feb 14, 2014 at 4:12 PM, Martin Grigorov mgrigo...@apache.orgwrote:


  should be detached, so this last page reference should not hold transient
  LDM values. Is it true?
 

 LDM null-yfies its transien field explicitly:

 https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/model/LoadableDetachableModel.java?source=cc#L104

 But if your custom model uses transient that is not null-yfied in
 onDetach() then it will be kept alive in the http session.


You mean in detach(), not onDetach() ;)



 
  When we are using DebugBar with SessionSizeDebugPanel, it displays
 session
  size and totalSize (by SessionTotalSizeModel). Does this totalSize
 includes
  size of object loaded by LDM or it counts all components and models size
 in
  detached state?
 

 I have to check what is th difference between size and totalSize, but since
 https://issues.apache.org/jira/browse/WICKET-4867 the detachable is
 detached before measuring its size.

 Ok, great to know. So it looks in 1.4.x totalSize is measured before
detaching.


Thanks for the answer.

--
Daniel


Re: WicketTester.isRenderedPage() in 6.13

2014-02-06 Thread Daniel Stoch
I have created a new page with link and then execute:
DummyBasePage page = new DummyBasePage(action);
startPage(page);
clickLink(page.getActionLink());
where action link is a link to another page.
But it is still not working, only DummyBasePage is rendered. Then I look
into WicketTester code and I have found that there are hard coded links'
classes! So the code that is implemented inside a link class is ommited and
its logic is doubled inside WicketTester. It looks to me as a very bad
design (eg. I cannot test other link implementations).

Finally it looks like WicketTester functionality was degraded comparing to
1.4, where application code could be easily testable in WicketTester and in
6.x the code that works ok in real application is not supported by
WicketTester :(.
Could it be possible to add to WicketTester handling such methods from
RequestCycle: setResponsePage(), setResponse()?

--
Daniel




On Wed, Feb 5, 2014 at 1:51 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 Component#setResponsePage() just delegates to
 RequestCycle#setResponsePage(). So it is the same.

 I'm saying that you should not use tester.getRequestCycle().xyz(). I.e. do
 not set the new page in the test code. Set it in the real application code.

 Martin Grigorov
 Wicket Training and Consulting


 On Wed, Feb 5, 2014 at 1:47 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

  In my real application there are calls to
 RequestCycle.setResponsePage(...)
  which are hidden by more advanced action/navigation framework. So I
 cannot
  simply replace them by component.setResponsePage().
  I think that if RequestCycle.setResponsePage(...) is valid for real
  application, it should also be valid for tests. Am I wrong?
 
  --
  Daniel
 
 
  On Wed, Feb 5, 2014 at 1:14 PM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   You should not use
   tester.getRequestCycle().setResponsePage(DummyBasePage.
   class);
  
   You should do something like:
   - in the test code: tester.startPage(Page1.class)
   - in your real application code: Page1 or in its components you can use
   setResponsePage(Page2.class)
   - finally in the test code: tester.assertRenderedPage(Page2.class)
  
  
   Martin Grigorov
   Wicket Training and Consulting
  
  
   On Wed, Feb 5, 2014 at 12:18 PM, Daniel Stoch daniel.st...@gmail.com
   wrote:
  
Ok, but what I should call to render DummyBasePage after calling:
  tester.getRequestCycle().setResponsePage(DummyBasePage.class);
without making a new request?
   
--
Daniel
   
   
On Wed, Feb 5, 2014 at 12:01 PM, Martin Grigorov 
 mgrigo...@apache.org
wrote:
   
 #processRequest() triggers a new request to the server
 so first the page is rendered, then a new request to the default
 destination is made, so the home page is rendered and
   lastRenderedPage
 changes

 Martin Grigorov
 Wicket Training and Consulting


 On Wed, Feb 5, 2014 at 11:39 AM, Daniel Stoch 
  daniel.st...@gmail.com
 wrote:

  One more question: what is a difference between these two calls:
 
  1.
  tester.startPage(DummyBasePage.class);
  Result result = tester.isRenderedPage(DummyBasePage.class);
 
  2.
 
 tester.getRequestCycle().setResponsePage(DummyBasePage.class);
  tester.processRequest();
  Result result = tester.isRenderedPage(DummyBasePage.class);
 
  The first one works ok (DummyBasePage is rendered), but the
 second
fails:
  HomePage is rendered instead of DummyBasePage. Why?
 
  --
  Daniel
 
 
 
  On Wed, Feb 5, 2014 at 10:40 AM, Martin Grigorov 
   mgrigo...@apache.org
  wrote:
 
   Try with tester.setExposeExceptions(false) before making the
   request
to
  the
   secured page
  
   Martin Grigorov
   Wicket Training and Consulting
  
  
   On Wed, Feb 5, 2014 at 10:33 AM, Daniel Stoch 
daniel.st...@gmail.com
   wrote:
  
Hi,
   
I'm during migration from Wicket 1.4.x to 6.x and I have the
 following
problem with WicketTester.
I have some secured page, during its initialization some kind
  of
AuthorizationException is raised. It should end with
 displaying
  standard
AccessDeniedPage. Here is a code fragment from test case:
   
1.4.x:
   
 RequestCycle.get().setResponsePage(SecuredDummyPage.class);
tester.processRequestCycle(requestCycle);
Result result =
   tester.isRenderedPage(AccessDeniedPage.class);
assertFalse(result.getMessage(), result.wasFailed());
   
This test is passed.
   
But in 6.13 the similar test:
   
 RequestCycle.get().setResponsePage(SecuredDummyPage.class);
tester.processRequest();
// or tester.startPage(SecuredDummyPage.class)
Result result =
   tester.isRenderedPage(AccessDeniedPage.class

Re: WicketTester.isRenderedPage() in 6.13

2014-02-06 Thread Daniel Stoch
I have looked inside 1.4 and the code inside a clickLink() is very similar,
so this is not a case to 6.x. But still it would be nice to have
RequestCycle#setResponsePage() working ;).

--
Daniel


On Thu, Feb 6, 2014 at 10:00 AM, Daniel Stoch daniel.st...@gmail.comwrote:

 I have created a new page with link and then execute:
 DummyBasePage page = new DummyBasePage(action);
 startPage(page);
 clickLink(page.getActionLink());
 where action link is a link to another page.
 But it is still not working, only DummyBasePage is rendered. Then I look
 into WicketTester code and I have found that there are hard coded links'
 classes! So the code that is implemented inside a link class is ommited and
 its logic is doubled inside WicketTester. It looks to me as a very bad
 design (eg. I cannot test other link implementations).

 Finally it looks like WicketTester functionality was degraded comparing to
 1.4, where application code could be easily testable in WicketTester and in
 6.x the code that works ok in real application is not supported by
 WicketTester :(.
 Could it be possible to add to WicketTester handling such methods from
 RequestCycle: setResponsePage(), setResponse()?

 --
 Daniel




 On Wed, Feb 5, 2014 at 1:51 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 Component#setResponsePage() just delegates to
 RequestCycle#setResponsePage(). So it is the same.

 I'm saying that you should not use tester.getRequestCycle().xyz(). I.e. do
 not set the new page in the test code. Set it in the real application
 code.

 Martin Grigorov
 Wicket Training and Consulting


 On Wed, Feb 5, 2014 at 1:47 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

  In my real application there are calls to
 RequestCycle.setResponsePage(...)
  which are hidden by more advanced action/navigation framework. So I
 cannot
  simply replace them by component.setResponsePage().
  I think that if RequestCycle.setResponsePage(...) is valid for real
  application, it should also be valid for tests. Am I wrong?
 
  --
  Daniel
 
 
  On Wed, Feb 5, 2014 at 1:14 PM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   You should not use
   tester.getRequestCycle().setResponsePage(DummyBasePage.
   class);
  
   You should do something like:
   - in the test code: tester.startPage(Page1.class)
   - in your real application code: Page1 or in its components you can
 use
   setResponsePage(Page2.class)
   - finally in the test code: tester.assertRenderedPage(Page2.class)
  
  
   Martin Grigorov
   Wicket Training and Consulting
  
  
   On Wed, Feb 5, 2014 at 12:18 PM, Daniel Stoch daniel.st...@gmail.com
   wrote:
  
Ok, but what I should call to render DummyBasePage after calling:
  tester.getRequestCycle().setResponsePage(DummyBasePage.class);
without making a new request?
   
--
Daniel
   
   
On Wed, Feb 5, 2014 at 12:01 PM, Martin Grigorov 
 mgrigo...@apache.org
wrote:
   
 #processRequest() triggers a new request to the server
 so first the page is rendered, then a new request to the default
 destination is made, so the home page is rendered and
   lastRenderedPage
 changes

 Martin Grigorov
 Wicket Training and Consulting


 On Wed, Feb 5, 2014 at 11:39 AM, Daniel Stoch 
  daniel.st...@gmail.com
 wrote:

  One more question: what is a difference between these two calls:
 
  1.
  tester.startPage(DummyBasePage.class);
  Result result = tester.isRenderedPage(DummyBasePage.class);
 
  2.
 
 tester.getRequestCycle().setResponsePage(DummyBasePage.class);
  tester.processRequest();
  Result result = tester.isRenderedPage(DummyBasePage.class);
 
  The first one works ok (DummyBasePage is rendered), but the
 second
fails:
  HomePage is rendered instead of DummyBasePage. Why?
 
  --
  Daniel
 
 
 
  On Wed, Feb 5, 2014 at 10:40 AM, Martin Grigorov 
   mgrigo...@apache.org
  wrote:
 
   Try with tester.setExposeExceptions(false) before making the
   request
to
  the
   secured page
  
   Martin Grigorov
   Wicket Training and Consulting
  
  
   On Wed, Feb 5, 2014 at 10:33 AM, Daniel Stoch 
daniel.st...@gmail.com
   wrote:
  
Hi,
   
I'm during migration from Wicket 1.4.x to 6.x and I have the
 following
problem with WicketTester.
I have some secured page, during its initialization some
 kind
  of
AuthorizationException is raised. It should end with
 displaying
  standard
AccessDeniedPage. Here is a code fragment from test case:
   
1.4.x:
   
 RequestCycle.get().setResponsePage(SecuredDummyPage.class);
tester.processRequestCycle(requestCycle);
Result result =
   tester.isRenderedPage(AccessDeniedPage.class);
assertFalse(result.getMessage(), result.wasFailed());
   
This test is passed

WicketTester.isRenderedPage() in 6.13

2014-02-05 Thread Daniel Stoch
Hi,

I'm during migration from Wicket 1.4.x to 6.x and I have the following
problem with WicketTester.
I have some secured page, during its initialization some kind of
AuthorizationException is raised. It should end with displaying standard
AccessDeniedPage. Here is a code fragment from test case:

1.4.x:
RequestCycle.get().setResponsePage(SecuredDummyPage.class);
tester.processRequestCycle(requestCycle);
Result result = tester.isRenderedPage(AccessDeniedPage.class);
assertFalse(result.getMessage(), result.wasFailed());

This test is passed.

But in 6.13 the similar test:
RequestCycle.get().setResponsePage(SecuredDummyPage.class);
tester.processRequest();
// or tester.startPage(SecuredDummyPage.class)
Result result = tester.isRenderedPage(AccessDeniedPage.class);
assertFalse(result.getMessage(), result.wasFailed());

is not passed. It is end up on this AuthorizationException and
AccessDeniedPage is not rendered.
Should it be rendered or should I have to change my test, because in 6.x it
works in different way?

--
Daniel


Re: WicketTester.isRenderedPage() in 6.13

2014-02-05 Thread Daniel Stoch
It works!
Thanks for your fast replay :)

--
Daniel


On Wed, Feb 5, 2014 at 10:40 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Try with tester.setExposeExceptions(false) before making the request to the
 secured page

 Martin Grigorov
 Wicket Training and Consulting


 On Wed, Feb 5, 2014 at 10:33 AM, Daniel Stoch daniel.st...@gmail.com
 wrote:

  Hi,
 
  I'm during migration from Wicket 1.4.x to 6.x and I have the following
  problem with WicketTester.
  I have some secured page, during its initialization some kind of
  AuthorizationException is raised. It should end with displaying standard
  AccessDeniedPage. Here is a code fragment from test case:
 
  1.4.x:
  RequestCycle.get().setResponsePage(SecuredDummyPage.class);
  tester.processRequestCycle(requestCycle);
  Result result = tester.isRenderedPage(AccessDeniedPage.class);
  assertFalse(result.getMessage(), result.wasFailed());
 
  This test is passed.
 
  But in 6.13 the similar test:
  RequestCycle.get().setResponsePage(SecuredDummyPage.class);
  tester.processRequest();
  // or tester.startPage(SecuredDummyPage.class)
  Result result = tester.isRenderedPage(AccessDeniedPage.class);
  assertFalse(result.getMessage(), result.wasFailed());
 
  is not passed. It is end up on this AuthorizationException and
  AccessDeniedPage is not rendered.
  Should it be rendered or should I have to change my test, because in 6.x
 it
  works in different way?
 
  --
  Daniel
 



Re: WicketTester.isRenderedPage() in 6.13

2014-02-05 Thread Daniel Stoch
For fast REPLY, of course ;)


On Wed, Feb 5, 2014 at 10:45 AM, Daniel Stoch daniel.st...@gmail.comwrote:

 It works!
 Thanks for your fast replay :)

 --
 Daniel


 On Wed, Feb 5, 2014 at 10:40 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Try with tester.setExposeExceptions(false) before making the request to
 the
 secured page

 Martin Grigorov
 Wicket Training and Consulting


 On Wed, Feb 5, 2014 at 10:33 AM, Daniel Stoch daniel.st...@gmail.com
 wrote:

  Hi,
 
  I'm during migration from Wicket 1.4.x to 6.x and I have the following
  problem with WicketTester.
  I have some secured page, during its initialization some kind of
  AuthorizationException is raised. It should end with displaying standard
  AccessDeniedPage. Here is a code fragment from test case:
 
  1.4.x:
  RequestCycle.get().setResponsePage(SecuredDummyPage.class);
  tester.processRequestCycle(requestCycle);
  Result result = tester.isRenderedPage(AccessDeniedPage.class);
  assertFalse(result.getMessage(), result.wasFailed());
 
  This test is passed.
 
  But in 6.13 the similar test:
  RequestCycle.get().setResponsePage(SecuredDummyPage.class);
  tester.processRequest();
  // or tester.startPage(SecuredDummyPage.class)
  Result result = tester.isRenderedPage(AccessDeniedPage.class);
  assertFalse(result.getMessage(), result.wasFailed());
 
  is not passed. It is end up on this AuthorizationException and
  AccessDeniedPage is not rendered.
  Should it be rendered or should I have to change my test, because in
 6.x it
  works in different way?
 
  --
  Daniel
 





Re: WicketTester.isRenderedPage() in 6.13

2014-02-05 Thread Daniel Stoch
One more question: what is a difference between these two calls:

1.
tester.startPage(DummyBasePage.class);
Result result = tester.isRenderedPage(DummyBasePage.class);

2.
tester.getRequestCycle().setResponsePage(DummyBasePage.class);
tester.processRequest();
Result result = tester.isRenderedPage(DummyBasePage.class);

The first one works ok (DummyBasePage is rendered), but the second fails:
HomePage is rendered instead of DummyBasePage. Why?

--
Daniel



On Wed, Feb 5, 2014 at 10:40 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Try with tester.setExposeExceptions(false) before making the request to the
 secured page

 Martin Grigorov
 Wicket Training and Consulting


 On Wed, Feb 5, 2014 at 10:33 AM, Daniel Stoch daniel.st...@gmail.com
 wrote:

  Hi,
 
  I'm during migration from Wicket 1.4.x to 6.x and I have the following
  problem with WicketTester.
  I have some secured page, during its initialization some kind of
  AuthorizationException is raised. It should end with displaying standard
  AccessDeniedPage. Here is a code fragment from test case:
 
  1.4.x:
  RequestCycle.get().setResponsePage(SecuredDummyPage.class);
  tester.processRequestCycle(requestCycle);
  Result result = tester.isRenderedPage(AccessDeniedPage.class);
  assertFalse(result.getMessage(), result.wasFailed());
 
  This test is passed.
 
  But in 6.13 the similar test:
  RequestCycle.get().setResponsePage(SecuredDummyPage.class);
  tester.processRequest();
  // or tester.startPage(SecuredDummyPage.class)
  Result result = tester.isRenderedPage(AccessDeniedPage.class);
  assertFalse(result.getMessage(), result.wasFailed());
 
  is not passed. It is end up on this AuthorizationException and
  AccessDeniedPage is not rendered.
  Should it be rendered or should I have to change my test, because in 6.x
 it
  works in different way?
 
  --
  Daniel
 



Re: WicketTester.isRenderedPage() in 6.13

2014-02-05 Thread Daniel Stoch
Ok, but what I should call to render DummyBasePage after calling:
  tester.getRequestCycle().setResponsePage(DummyBasePage.class);
without making a new request?

--
Daniel


On Wed, Feb 5, 2014 at 12:01 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 #processRequest() triggers a new request to the server
 so first the page is rendered, then a new request to the default
 destination is made, so the home page is rendered and lastRenderedPage
 changes

 Martin Grigorov
 Wicket Training and Consulting


 On Wed, Feb 5, 2014 at 11:39 AM, Daniel Stoch daniel.st...@gmail.com
 wrote:

  One more question: what is a difference between these two calls:
 
  1.
  tester.startPage(DummyBasePage.class);
  Result result = tester.isRenderedPage(DummyBasePage.class);
 
  2.
  tester.getRequestCycle().setResponsePage(DummyBasePage.class);
  tester.processRequest();
  Result result = tester.isRenderedPage(DummyBasePage.class);
 
  The first one works ok (DummyBasePage is rendered), but the second fails:
  HomePage is rendered instead of DummyBasePage. Why?
 
  --
  Daniel
 
 
 
  On Wed, Feb 5, 2014 at 10:40 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   Try with tester.setExposeExceptions(false) before making the request to
  the
   secured page
  
   Martin Grigorov
   Wicket Training and Consulting
  
  
   On Wed, Feb 5, 2014 at 10:33 AM, Daniel Stoch daniel.st...@gmail.com
   wrote:
  
Hi,
   
I'm during migration from Wicket 1.4.x to 6.x and I have the
 following
problem with WicketTester.
I have some secured page, during its initialization some kind of
AuthorizationException is raised. It should end with displaying
  standard
AccessDeniedPage. Here is a code fragment from test case:
   
1.4.x:
RequestCycle.get().setResponsePage(SecuredDummyPage.class);
tester.processRequestCycle(requestCycle);
Result result = tester.isRenderedPage(AccessDeniedPage.class);
assertFalse(result.getMessage(), result.wasFailed());
   
This test is passed.
   
But in 6.13 the similar test:
RequestCycle.get().setResponsePage(SecuredDummyPage.class);
tester.processRequest();
// or tester.startPage(SecuredDummyPage.class)
Result result = tester.isRenderedPage(AccessDeniedPage.class);
assertFalse(result.getMessage(), result.wasFailed());
   
is not passed. It is end up on this AuthorizationException and
AccessDeniedPage is not rendered.
Should it be rendered or should I have to change my test, because in
  6.x
   it
works in different way?
   
--
Daniel
   
  
 



Re: WicketTester.isRenderedPage() in 6.13

2014-02-05 Thread Daniel Stoch
In my real application there are calls to RequestCycle.setResponsePage(...)
which are hidden by more advanced action/navigation framework. So I cannot
simply replace them by component.setResponsePage().
I think that if RequestCycle.setResponsePage(...) is valid for real
application, it should also be valid for tests. Am I wrong?

--
Daniel


On Wed, Feb 5, 2014 at 1:14 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 You should not use  tester.getRequestCycle().setResponsePage(DummyBasePage.
 class);

 You should do something like:
 - in the test code: tester.startPage(Page1.class)
 - in your real application code: Page1 or in its components you can use
 setResponsePage(Page2.class)
 - finally in the test code: tester.assertRenderedPage(Page2.class)


 Martin Grigorov
 Wicket Training and Consulting


 On Wed, Feb 5, 2014 at 12:18 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

  Ok, but what I should call to render DummyBasePage after calling:
tester.getRequestCycle().setResponsePage(DummyBasePage.class);
  without making a new request?
 
  --
  Daniel
 
 
  On Wed, Feb 5, 2014 at 12:01 PM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   #processRequest() triggers a new request to the server
   so first the page is rendered, then a new request to the default
   destination is made, so the home page is rendered and
 lastRenderedPage
   changes
  
   Martin Grigorov
   Wicket Training and Consulting
  
  
   On Wed, Feb 5, 2014 at 11:39 AM, Daniel Stoch daniel.st...@gmail.com
   wrote:
  
One more question: what is a difference between these two calls:
   
1.
tester.startPage(DummyBasePage.class);
Result result = tester.isRenderedPage(DummyBasePage.class);
   
2.
tester.getRequestCycle().setResponsePage(DummyBasePage.class);
tester.processRequest();
Result result = tester.isRenderedPage(DummyBasePage.class);
   
The first one works ok (DummyBasePage is rendered), but the second
  fails:
HomePage is rendered instead of DummyBasePage. Why?
   
--
Daniel
   
   
   
On Wed, Feb 5, 2014 at 10:40 AM, Martin Grigorov 
 mgrigo...@apache.org
wrote:
   
 Try with tester.setExposeExceptions(false) before making the
 request
  to
the
 secured page

 Martin Grigorov
 Wicket Training and Consulting


 On Wed, Feb 5, 2014 at 10:33 AM, Daniel Stoch 
  daniel.st...@gmail.com
 wrote:

  Hi,
 
  I'm during migration from Wicket 1.4.x to 6.x and I have the
   following
  problem with WicketTester.
  I have some secured page, during its initialization some kind of
  AuthorizationException is raised. It should end with displaying
standard
  AccessDeniedPage. Here is a code fragment from test case:
 
  1.4.x:
  RequestCycle.get().setResponsePage(SecuredDummyPage.class);
  tester.processRequestCycle(requestCycle);
  Result result =
 tester.isRenderedPage(AccessDeniedPage.class);
  assertFalse(result.getMessage(), result.wasFailed());
 
  This test is passed.
 
  But in 6.13 the similar test:
  RequestCycle.get().setResponsePage(SecuredDummyPage.class);
  tester.processRequest();
  // or tester.startPage(SecuredDummyPage.class)
  Result result =
 tester.isRenderedPage(AccessDeniedPage.class);
  assertFalse(result.getMessage(), result.wasFailed());
 
  is not passed. It is end up on this AuthorizationException and
  AccessDeniedPage is not rendered.
  Should it be rendered or should I have to change my test, because
  in
6.x
 it
  works in different way?
 
  --
  Daniel
 

   
  
 



Wicket, Guice and the $Proxy object

2013-07-23 Thread Daniel Watrous
Hi,

I'm having an issue that I suspect is related to the wicket integration
with Guice. Any help is appreciated.

I have a Page class that uses field injection to inject a DAO. I then want
to cast my DAO to a more specific type (what I inject is the interface).
Here's what that looks like

public class CnavModify extends ConsoleBasePage {

@Inject private CnavUrlDAO cnavUrlDAO;
public CnavModify(PageParameters parameters) {
super(parameters);
if (parameters.get(cnavid).toString() != null) {
cnavid = new ObjectId(parameters.get(cnavid).toString());
}
if (cnavid != null) {
cnavUrlModel = new
DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
}
}
}

When I try to cast it I get the following error:

Last cause: $Proxy23 cannot be cast to
com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO

I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23
and I am unable to cast it to a concrete type.

Is this Guice or Wicket related? Any idea how to get around this?

Thanks,
Daniel


Re: Wicket, Guice and the $Proxy object

2013-07-23 Thread Daniel Watrous
Here's a little more detail when I debug and attempt to do just the cast:

Cannot cast an instance of class $Proxy23 (loaded by instance of
org.eclipse.jetty.webapp.WebAppClassLoader(id=3511)) to an instance of
class com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO (loaded
by instance of sun.misc.Launcher$AppClassLoader(id=2450))


On Tue, Jul 23, 2013 at 9:20 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 Hi,

 I'm having an issue that I suspect is related to the wicket integration
 with Guice. Any help is appreciated.

 I have a Page class that uses field injection to inject a DAO. I then want
 to cast my DAO to a more specific type (what I inject is the interface).
 Here's what that looks like

 public class CnavModify extends ConsoleBasePage {

 @Inject private CnavUrlDAO cnavUrlDAO;
 public CnavModify(PageParameters parameters) {
 super(parameters);
 if (parameters.get(cnavid).toString() != null) {
 cnavid = new ObjectId(parameters.get(cnavid).toString());
 }
 if (cnavid != null) {
 cnavUrlModel = new
 DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
 }
 }
 }

 When I try to cast it I get the following error:

 Last cause: $Proxy23 cannot be cast to
 com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO

 I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23
 and I am unable to cast it to a concrete type.

 Is this Guice or Wicket related? Any idea how to get around this?

 Thanks,
 Daniel



Re: Wicket, Guice and the $Proxy object

2013-07-23 Thread Daniel Watrous
That being the case, is there any way to get an instance that I can cast to
a concrete type?


On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,


 On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com
 wrote:

  Hi,
 
  I'm having an issue that I suspect is related to the wicket integration
  with Guice. Any help is appreciated.
 
  I have a Page class that uses field injection to inject a DAO. I then
 want
  to cast my DAO to a more specific type (what I inject is the interface).
  Here's what that looks like
 
  public class CnavModify extends ConsoleBasePage {
 
  @Inject private CnavUrlDAO cnavUrlDAO;
  public CnavModify(PageParameters parameters) {
  super(parameters);
  if (parameters.get(cnavid).toString() != null) {
  cnavid = new ObjectId(parameters.get(cnavid).toString());
  }
  if (cnavid != null) {
  cnavUrlModel = new
 
 
 DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
  }
  }
  }
 
  When I try to cast it I get the following error:
 
  Last cause: $Proxy23 cannot be cast to
  com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO
 
  I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23
  and I am unable to cast it to a concrete type.
 
  Is this Guice or Wicket related? Any idea how to get around this?
 

 It is an error in your assumption.

 Wicket injects a proxy that implements CnavUrlDAO but knows nothing about
 the specific implementation about this interface.
 Whenever the proxy is used it delegates the call to the bean/service
 returned by Guice's injector (something like:
 Injector.getBinding(CnavUrlDAO.class).doSomething()).


 
  Thanks,
  Daniel
 



Re: Wicket, Guice and the $Proxy object

2013-07-23 Thread Daniel Watrous
Dan,

Good point. After considering I decided to modify my interface to expose
the function I need and let the implementation worry about casting where
necessary.

Thanks,
Daniel


On Tue, Jul 23, 2013 at 9:58 AM, Dan Retzlaff dretzl...@gmail.com wrote:

 @Inject the implementation, not the interface. @Inject'd implementations
 have some code smell, but no more than downcasting.


 On Tue, Jul 23, 2013 at 8:40 AM, Daniel Watrous dwmaill...@gmail.com
 wrote:

  That being the case, is there any way to get an instance that I can cast
 to
  a concrete type?
 
 
  On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   Hi,
  
  
   On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com
   wrote:
  
Hi,
   
I'm having an issue that I suspect is related to the wicket
 integration
with Guice. Any help is appreciated.
   
I have a Page class that uses field injection to inject a DAO. I then
   want
to cast my DAO to a more specific type (what I inject is the
  interface).
Here's what that looks like
   
public class CnavModify extends ConsoleBasePage {
   
@Inject private CnavUrlDAO cnavUrlDAO;
public CnavModify(PageParameters parameters) {
super(parameters);
if (parameters.get(cnavid).toString() != null) {
cnavid = new
 ObjectId(parameters.get(cnavid).toString());
}
if (cnavid != null) {
cnavUrlModel = new
   
   
  
 
 DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
}
}
}
   
When I try to cast it I get the following error:
   
Last cause: $Proxy23 cannot be cast to
com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO
   
I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is
  $Proxy23
and I am unable to cast it to a concrete type.
   
Is this Guice or Wicket related? Any idea how to get around this?
   
  
   It is an error in your assumption.
  
   Wicket injects a proxy that implements CnavUrlDAO but knows nothing
 about
   the specific implementation about this interface.
   Whenever the proxy is used it delegates the call to the bean/service
   returned by Guice's injector (something like:
   Injector.getBinding(CnavUrlDAO.class).doSomething()).
  
  
   
Thanks,
Daniel
   
  
 



Re: Form questions

2013-07-23 Thread Daniel Watrous
I've had a difficult time following your recommendations. However I think
I'm getting closer.

Part of the disconnect is that right now, as I show above, the model object
I create is in the Form, not the Page. In my Page I create an instance of
my Form like this:

Form form = new CnavForm(cnavForm);
add(form);

So, the first step I've taken is to implement a constructor for my Form
that receives an IModel and, rather than create my CnavUrl, I get it from
the IModel:

CnavUrl cnavUrl = (CnavUrl) model.getObject();
setModel(new Model((Serializable) cnavUrl));

Now I create my Form object like this:

DetachableCnavUrlModel cnavUrlModel = new
DetachableCnavUrlModel(new MorphiaCnavUrl());
Form form = new CnavForm(cnavForm, cnavUrlModel);
add(form);

I'm now at the page level when I create my Model and I have a
DetachableCnavUrlModel, which I also use when displaying them.

if (cnavid != null) {
cnavUrlModel = new
DetachableCnavUrlModel(cnavUrlDAO.getCnavById(cnavid));
} else {
cnavUrlModel = new DetachableCnavUrlModel(new MorphiaCnavUrl());
}
Form form = new CnavForm(cnavForm, cnavUrlModel);
add(form);

This way on edit I have a prepopulated form.

To answer my other question about the link, I created a PageParameters
object and used setResponsePage like this

item.add(new Link(editlink) {
@Override
public void onClick() {
PageParameters editParameters = new
PageParameters();
editParameters.add(cnavid,
((MorphiaCnavUrl)cnavUrl).getId());

setResponsePage(CnavModify.class, editParameters);
}
});

I can then use the value in the parameters to set cnavid

if (parameters.get(cnavid).toString() != null) {
cnavid = new ObjectId(parameters.get(cnavid).toString());
}

Thanks for all the help.

Daniel


On Fri, Jul 19, 2013 at 9:38 AM, Paul Bors p...@bors.ws wrote:

 For stateless pages it would create a new one each time (add the DebugBar
 to
 your pages and see if your page is stateless or not and also see what the
 model is per component).

 For when Wicket serializes your page, you don't want a PropertyModel alone,
 you want a detachable model (see section 9.6 of the Wicket Free Guide or go
 over chapter 9 again Wicket models and forms). You need to wrap a
 Detachable model inside a Property model like so:

 add(new TextField(url, new PropertyModelMorphiaCnavUrl(new
 LoadableDetachableModelMorphiaCnavUrl(cnavUrl), URL))
  .setRequired(true)
  .add(new UrlValidator()));

 Is best to use a CompoundPropertyModel for the entire form and get to your
 POJO that feeds the entire form (or panel) via a detachable model.

 The LoadableDetachableModel is desined to only serialize the record ID for
 which you can later retrieve the entire object from your persistence layer.

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Friday, July 19, 2013 11:24 AM
 To: users@wicket.apache.org
 Subject: Re: Form questions

 Paul,

 Thanks. I get that and understand how the Model happens. As you can see,
 the
 instance of the model object is created in the constructor. So the first
 question I had is whether a new instance is created for every request or if
 there's one instance that's serialized. I suspect it's the second, knowing
 how Wicket treats sessions. In that case, I need some way on a per request
 basis to load the model from the database.

 The other question I had is how to create a link that sends the ID to the
 page that renders the form. I need to create a link to that page, include
 an
 ID value with the request and then access that ID within the form for my
 query to load that object from the DB.

 Daniel


 On Thu, Jul 18, 2013 at 5:14 PM, Paul Bors p...@bors.ws wrote:

  Okay let's pre-populate this field:
 
  add(new TextField(url, new PropertyModel(cnavUrl, URL))
  .setRequired(true)
  .add(new UrlValidator()));
 
  Its mode is a new PropertyModel(cnavUrl, URL), which is the CnavUrl
  cnavUrl = new MorphiaCnavUrl();.
  So it's the cnavUrl.getUrl() value.
 
  What do you get when you call new MorphiaCnavUrl().getUrl()?
  That's what should appear in the TextField when you first load the
  page (normally read form the DB).
 
  ~ Thank you,
Paul Bors
 
  -Original Message-
  From: Daniel Watrous [mailto:dwmaill...@gmail.com]
  Sent: Thursday, July 18, 2013 6:03 PM
  To: users@wicket.apache.org
  Subject: Re: Form questions
 
  I've made a lot of progress and been through chapters 9 and 10 of
  Wicket Free Guide, but I'm still stumped on point #2, pre-populating the
 form.
  Here's what I have right now:
 
  public class CnavForm extends Form {
 
  @Inject private

Re: Wicket, Guice and the $Proxy object

2013-07-23 Thread Daniel Watrous
Here's a post that helped me understand this better:

http://stackoverflow.com/questions/16047829/proxy-cannot-be-cast-to-class


On Tue, Jul 23, 2013 at 2:15 PM, Daniel Watrous dwmaill...@gmail.comwrote:

 Dan,

 Good point. After considering I decided to modify my interface to expose
 the function I need and let the implementation worry about casting where
 necessary.

 Thanks,
 Daniel


 On Tue, Jul 23, 2013 at 9:58 AM, Dan Retzlaff dretzl...@gmail.com wrote:

 @Inject the implementation, not the interface. @Inject'd implementations
 have some code smell, but no more than downcasting.


 On Tue, Jul 23, 2013 at 8:40 AM, Daniel Watrous dwmaill...@gmail.com
 wrote:

  That being the case, is there any way to get an instance that I can
 cast to
  a concrete type?
 
 
  On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   Hi,
  
  
   On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com
   wrote:
  
Hi,
   
I'm having an issue that I suspect is related to the wicket
 integration
with Guice. Any help is appreciated.
   
I have a Page class that uses field injection to inject a DAO. I
 then
   want
to cast my DAO to a more specific type (what I inject is the
  interface).
Here's what that looks like
   
public class CnavModify extends ConsoleBasePage {
   
@Inject private CnavUrlDAO cnavUrlDAO;
public CnavModify(PageParameters parameters) {
super(parameters);
if (parameters.get(cnavid).toString() != null) {
cnavid = new
 ObjectId(parameters.get(cnavid).toString());
}
if (cnavid != null) {
cnavUrlModel = new
   
   
  
 
 DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
}
}
}
   
When I try to cast it I get the following error:
   
Last cause: $Proxy23 cannot be cast to
com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO
   
I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is
  $Proxy23
and I am unable to cast it to a concrete type.
   
Is this Guice or Wicket related? Any idea how to get around this?
   
  
   It is an error in your assumption.
  
   Wicket injects a proxy that implements CnavUrlDAO but knows nothing
 about
   the specific implementation about this interface.
   Whenever the proxy is used it delegates the call to the bean/service
   returned by Guice's injector (something like:
   Injector.getBinding(CnavUrlDAO.class).doSomething()).
  
  
   
Thanks,
Daniel
   
  
 





Re: Form questions

2013-07-19 Thread Daniel Watrous
Paul,

Thanks. I get that and understand how the Model happens. As you can see,
the instance of the model object is created in the constructor. So the
first question I had is whether a new instance is created for every request
or if there's one instance that's serialized. I suspect it's the second,
knowing how Wicket treats sessions. In that case, I need some way on a per
request basis to load the model from the database.

The other question I had is how to create a link that sends the ID to the
page that renders the form. I need to create a link to that page, include
an ID value with the request and then access that ID within the form for my
query to load that object from the DB.

Daniel


On Thu, Jul 18, 2013 at 5:14 PM, Paul Bors p...@bors.ws wrote:

 Okay let's pre-populate this field:

 add(new TextField(url, new PropertyModel(cnavUrl, URL))
 .setRequired(true)
 .add(new UrlValidator()));

 Its mode is a new PropertyModel(cnavUrl, URL), which is the CnavUrl
 cnavUrl = new MorphiaCnavUrl();.
 So it's the cnavUrl.getUrl() value.

 What do you get when you call new MorphiaCnavUrl().getUrl()?
 That's what should appear in the TextField when you first load the page
 (normally read form the DB).

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Thursday, July 18, 2013 6:03 PM
 To: users@wicket.apache.org
 Subject: Re: Form questions

 I've made a lot of progress and been through chapters 9 and 10 of Wicket
 Free Guide, but I'm still stumped on point #2, pre-populating the form.
 Here's what I have right now:

 public class CnavForm extends Form {

 @Inject private CnavUrlDAO cnavUrlDAO;

 public CnavForm(String id) {
 super(id);
 CnavUrl cnavUrl = new MorphiaCnavUrl();
 setModel(new Model((Serializable) cnavUrl));

 add(new TextField(url, new PropertyModel(cnavUrl, URL))
 .setRequired(true)
 .add(new UrlValidator()));
 add(new HiddenField(objectid, new PropertyModel(cnavUrl, id)));

 add(new Button(publish) {
 @Override
 public void onSubmit() {
 CnavUrl cnavUrl = (CnavUrl) CnavForm.this.getModelObject();
 // check for existing record to know if this is a create or
 update
 if (((MorphiaCnavUrlModel)cnavUrl).getId() == null) {
 // create
 cnavUrlDAO.save(cnavUrl);
 } else {
 // update
 cnavUrlDAO.save(cnavUrl);
 }
 }
 });
 }
 }

 I need to know how to do two things.
 1) how to link to the page that displays the form, and pass it the ID for
 the record I want to edit
 2) load the object from the database and have it replace the model I create
 in the constructor

 Obviously I can make a database call and get the object. Is the constructor
 called every time the page is requested, so that I could check for an ID
 and
 either create the model or load it from the database? If so, then I just
 need help with #1.

 Thanks,
 Daniel


 On Wed, Jul 17, 2013 at 10:19 AM, Daniel Watrous
 dwmaill...@gmail.comwrote:

  I think I'm getting it now. The Form needs to be embedded in a panel
  for the type of inclusion that I'm interested in.
 
  I created a CnavFormPanel.java and changed CnavForm.html to
  CnavFormPanel.html. I left CnavForm.java alone.
 
  In CnavModify.java I removed this
 
  Form form = new CnavForm(cnavFormArea);
  add(form);
 
  And added this
 
  add(new CnavFormPanel(cnavFormArea));
 
  That works. Thanks for your help.
 
  Daniel
 
 
  On Wed, Jul 17, 2013 at 10:07 AM, Daniel Watrous
 dwmaill...@gmail.comwrote:
 
  I can make it work if I put the markup from CnavForm.html directly
  into CnavModify, but the form is not as reusable then. I would have
  to duplicate the markup for other pages that use the same form...
 
  Dnaiel
 
 
  On Wed, Jul 17, 2013 at 9:55 AM, Daniel Watrous
 dwmaill...@gmail.comwrote:
 
  That's what I tried to do. I created CnavForm.java and
  CnavForm.html. In the latter file I have this
wicket:panel
  form wicket:id=cnavForm...
  // form details
  /form
  /wicket:panel
 
  Then I have CnavModify.java and CnavModify.html. You already see
  what I have in CnavModify.java from my last email. My CnavModify.html
 has this.
  wicket:extend
  span wicket:id=cnavFormAreaHere's the form/span
  /wicket:extend
 
  Rather than render I'm getting this error:
  Last cause: Component [cnavFormArea] (path = [0:cnavFormArea]) must
  be applied to a tag of type [form], not: 'span
 wicket:id=cnavFormArea
  id=cnavFormArea3' (line 0, column 0)
 
  I'll keep trying and report back when I figure it out.
 
  Daniel
 
 
  On Tue, Jul 16, 2013 at 10:50 PM, Paul Bors p...@bors.ws wrote:
 
  Wicket is a MVC component driven framework similar to Swing.
  In short, what

Re: http://wicketinaction.com/ broken?

2013-07-19 Thread Daniel Watrous
This looks like a wordpress issue. Look for a problem with the .htaccess
file.

It should include something like this:

IfModule mod_rewrite.c
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
/IfModule

Daniel


On Fri, Jul 19, 2013 at 2:42 PM, Gabriel Landon glan...@piti.pf wrote:

 The home page dos work :

 wget http://wicketinaction.com/
 --2013-07-19 10:40:45--  http://wicketinaction.com/
 Résolution de wicketinaction.com... 94.124.120.40
 Connexion vers wicketinaction.com|94.124.120.40|:80...connecté.
 requête HTTP transmise, en attente de la réponse...*200 OK*

 But not the other pages :
 wget http://wicketinaction.com/2013/02/replace-components-with-animation/
 --2013-07-19 10:41:45--
 http://wicketinaction.com/2013/02/replace-components-with-animation/
 Résolution de wicketinaction.com... 94.124.120.40
 Connexion vers wicketinaction.com|94.124.120.40|:80...connecté.
 requête HTTP transmise, en attente de la réponse...*404 Not Found*
 2013-07-19 10:41:46 ERREUR 404: Not Found.







 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/http-wicketinaction-com-broken-tp4660379p4660385.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




Last cause: can't serialize class $Proxy23

2013-07-18 Thread Daniel Watrous
)
 at 
org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
 at 
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
 at 
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
 at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)
 at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
 at 
org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
 at 
org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
 at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
 at 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
 at java.lang.Thread.run(Thread.java:722)

Complete stack:

org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of
interface org.apache.wicket.markup.html.form.IFormSubmitListener
targeted at [CnavForm [Component id = cnavForm]] on component
[CnavForm [Component id = cnavForm]] threw an exception
 at 
org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:268)
 at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
 at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:240)
 at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:226)
 at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:854)
 at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
 at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:254)
 at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:211)
 at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:282)
 at 
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)

java.lang.reflect.InvocationTargetException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at 
org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
 at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
 at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:240)
 at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:226)
 at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:854)
 at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
 at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:254)
 at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:211)
 at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:282)
 at 
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)


This is the Form class. It never makes it past the line
cnavUrlDAO.save(cnavUrl);

public class CnavForm extends Form {

@Inject private CnavUrlDAO cnavUrlDAO;

class MorphiaCnavUrlModel extends MorphiaCnavUrl implements
Serializable {}

public CnavForm(String id) {
super(id);
CnavUrl cnavUrl = new MorphiaCnavUrlModel();
setModel(new Model((Serializable) cnavUrl));

add(new TextField(url, new PropertyModel(cnavUrl, URL))
.setRequired(true)
.add(new UrlValidator()));
add(new HiddenField(objectid, new PropertyModel(cnavUrl, id)));

add(new Button(publish) {
@Override
public void onSubmit() {
CnavUrl cnavUrl = (CnavUrl) CnavForm.this.getModelObject();
// check for existing record to know if this is a create or
update
if (((MorphiaCnavUrlModel)cnavUrl).getId() == null) {
// create
cnavUrlDAO.save(cnavUrl);
} else {
// update
cnavUrlDAO.save(cnavUrl);
}
}
});
}
}

Any idea what could be going on? It may be related to this:
http://apache-wicket.1842946.n4.nabble.com/Unserializable-exceptions-on-declaring-springs-org-springframework-dao-annotation-PersistenceExceptir-td3172785.html

Thanks,
Daniel


Re: Last cause: can't serialize class $Proxy23

2013-07-18 Thread Daniel Watrous
I found that having my DAO implement Serializable got me past the
exception.

Is Wicket attempting to serialize my DAO?


On Thu, Jul 18, 2013 at 11:24 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 My Wicket application uses Guice for DI and some AOP. I have successfully
 injected a DAO and used that to display records. However, when I try to
 save a new record in my form, I get the following exception

 

 Root cause:

 java.lang.IllegalArgumentException: can't serialize class $Proxy23
  at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:270)
  at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)

  at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:226)
  at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
  at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:226)

  at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
  at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:120)
  at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27)

  at com.mongodb.OutMessage.putObject(OutMessage.java:289)
  at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:239)
  at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:204)
  at com.mongodb.DBCollection.insert(DBCollection.java:148)

  at com.mongodb.DBCollection.insert(DBCollection.java:91)
  at com.mongodb.DBCollection.save(DBCollection.java:810)
  at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:731)
  at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:793)

  at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:787)
  at 
 com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO.save(MorphiaCnavUrlDAO.java:50)
  at java.lang.reflect.Method.invoke(Method.java:601)

  at 
 org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:435)
  at $Proxy23.save(Unknown Source)
  at com.hp.honeybadger.console.forms.CnavForm$1.onSubmit(CnavForm.java:72)

  at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1253)
  at org.apache.wicket.markup.html.form.Form.process(Form.java:925)
  at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:771)

  at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:704)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at 
 org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)

  at 
 org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
  at 
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:240)

  at 
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:226)
  at 
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:854)

  at 
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
  at 
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:254)
  at 
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:211)

  at 
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:282)
  at 
 org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
  at 
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)

  at 
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
  at 
 com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
  at 
 com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)

  at 
 com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
  at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
  at 
 org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1332)

  at 
 org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
  at 
 org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
  at 
 org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)

  at 
 org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
  at 
 org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
  at 
 org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)

  at 
 org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
  at 
 org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965

  1   2   3   4   5   6   >