Re: Websocket redirect wrong url

2017-05-23 Thread Martin Grigorov
Hi,

I'm afraid a quickstart would be needed to be able to tell what goes wrong
there.

The appearance of /wicket/ in the url looks like either BookmarkableMapper
(responsible for urls like /wicket/bookmarkable/com.example.Page) or
PageInstanceMapper (responsible for urls like /wicket/page?123) is used
instead of MountedMapper (used when the page path is configured with
WebApplication#mountPage(String, Class) method).

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

On Tue, May 23, 2017 at 2:46 PM, Peter Henderson <
peter.hender...@starjar.com> wrote:

> Hi all.
>
>
> I'm seeing a strange redirect problem which leads to a 404
>
>
> Scenario.
> 1) User is on fat bookmarkable page [1]
> 2) Ajax onClick redirects to non bookmarkable SendMessagePage
> 3) SendMessage page uses websockets + background threads.
> 4) SendMessage page receives a websocket push event which it responds to
> with [2] or [3]
>
> When redirecting back to a really simple DummyPage all is fine.
> When redirecting back to the fat bookmarkable page I get a 404 on url
> https://local.starjar.com:25000/Starjar/protected/wicket/35883
>
> Both DummyPage and PurchaseOrderPage are mounted the same way.
>
>
>
> What am I doing which is causing the incorrect redirect path?
>
>
> I'm (still) trying to build a quick start that reproduces this problem.
>
>
> Further testing.
>
> I created a new class called Dummy2 which is identical to
> PurchaseOrderPage. Just a different name and mount point.
> Redirecting to Dummy2 works fine .
>
> It looks like Dummy2 => Dummy2 and PurchaseOrderPage => PurchaseOrderPage
> both fail with the incorrect relative url.
>
>
>
>
> Many thanks
>
> Peter.
>
>
>
>
>
> [1]
> https://local.starjar.com:25000/Starjar/protected/purchaseOrder/35883
>
> [2]
> // This works as expected
> // https://local.starjar.com:25000/Starjar/protected/dummy/12334
> val pageCls = classOf[DummyDetailPage]
> val pp = new PageParameters()
> pp.set(WicketStarjarApplication.DetailPageIdParameterName, 12334)
> throw new RestartResponseException(pageCls, pp)
>
>
> [3]
> // This does not work 404
> // https://local.starjar.com:25000/Starjar/protected/wicket/35883
> val pageCls = classOf[PurchaseOrderDetailPage]
> val pp = new PageParameters()
> pp.set(WicketStarjarApplication.DetailPageIdParameterName, businessId.pk)
> throw new RestartResponseException(pageCls, pp)
>
>
>
> --
> Peter Henderson
>


Re: Questions regarding Wicket 8 and lambda expressions for models

2017-05-23 Thread Martin Grigorov
Hi,

On Tue, May 23, 2017 at 5:40 PM, Ihmehlmenn  wrote:

> Hello everyone,
>
> while trying out some of the very cool new features in Wicket 8,
> specifically replacing PropertyModels with lambda expressions, I had a few
> questions coming up. Most of them have been answered by the great guide
> provided, but following things are still a bit unclear to me:
>

Thank you for testing the milestone release and for the feedback!


>
> 1) Read-Only Models
> Let's say I want to replace the following PropertyModel for showing the
> "name" property of a Person obejct in a Label
>
>   new PropertyModel(personModel, "name");
>
> with a lambda expression. Which of the following would be the best approach
> and why?
>
>   LambdaModel.of(personModel, Person::getName);
>

This way of using LambdaModel is indeed the same as the second way. The
advantage LambdaModel has is that you can also set a value when you use the
method with the Supplier.


>   personModel.map(Person::getName);
>   personModel.flatMap(...); // not quite sure yet when to use this one. See
> next question as well


> The first two options seem to be identical at the first glance but I
> noticed
> that the LambdaModel does call detach() on the underlying base model (just
> like the PropertyModel does), whereas the model created by the map() method
> doesn't seem to do that.
>

This is a good point!
I think it is a bug that should be fixed!


>
>
> 2) Readable/Writeable Models
> The documentation has the following example for mapping a model to a
> readable/writeable model of a property
>
>   IModel personNameModel = personModel.flatMap(targetPerson ->
>   LambdaModel.of(
> () -> targetPerson::getName, targetPerson::setName
>   ));
>
> Why is the call to flatMap() needed? Isn't just using the LambdaModel the
> same but shorter?
>
>   IModel personNameModel = LambdaModel.of(personModel,
> Person::getName, Person::setName);
>

IModel#flatMap() is like java.util.Optional#flatMap().
It is useful when you already have another IModel impl that knows how to
set/get the name of a person.
LambdaModel#of(IModel, SerializableFunction,
SerializableBiConsumer) is an easy way to create such IModel impl by
using Java 8 lambdas.
We should cross-reference them in the javadoc!

Another discussion on this topic:
http://markmail.org/message/m6l2w3ryqbdew2co


>
>
> 3) Constants in Models
> In some cases I need to set a static constant value as read only model in a
> component. Up until now I simply used
>Model.of(Constants.MY_STATIC_VALUE);
> which probably results in the value being serialised into the session of
> the
> user.
>

The model and its content are serialized with the page.
The page is stored in the http session only after being rendered. Once you
move to another stateful page it is replaced by it and from there on it is
stored only on the disk.


>
> Am I assuming correctly, that using following lambda expression as model is
> more "efficient", since the static constant isn't serialised anymore this
> way?
>   () -> Constants.MY_STATIC_VALUE;
>

Correct!
The static constant won't be serialized but the closure will be.
So this version should be close memory-wise to using AbstractReadOnlyModel
for this use case but anonymous inner classes have a reference to the outer
instance and afaik lambdas don't have it.


>
>
> Thanks to everybody pouring so much time into developing Wicket!
>
> Daniel Radünz
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Questions-regarding-Wicket-8-and-lambda-
> expressions-for-models-tp4677918.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Question about

2017-05-23 Thread Martin Grigorov
Hi,

It is not very clear how your code looks like.
Could you please provide more information the setup and how WICKET-6289
breaks it ?
A quickstart application would be the best way to show us! You can share it
via GitHub/BitBucket or even attach it to a ticket in JIRA!
Thank you!

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

On Tue, May 23, 2017 at 9:47 PM, Claudia Hirt  wrote:

> Hi all,
>
> there's something I came across when trying to migrate an application to
> Wicket 7.7.
> When using an anchor link like  with autmatic linking
> activated (getMarkupSettings().setAutomaticLinking(true)) the
> AutolinkResolver breaks my hierarchy. This does not appear when
> encapsulating the  tag inside a  Tag.
> I saw that this appears since Bugfix from https://issues.apache.org/jira
> /browse/WICKET-6289 was implemented.
>
> Do I really have to use  for this kind of anchors or is it a
> Bug?
>
> Best regards,
> Claudia
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Question about

2017-05-23 Thread Claudia Hirt

Hi all,

there's something I came across when trying to migrate an application to 
Wicket 7.7.
When using an anchor link like  with autmatic linking 
activated (getMarkupSettings().setAutomaticLinking(true)) the 
AutolinkResolver breaks my hierarchy. This does not appear when 
encapsulating the  tag inside a  Tag.
I saw that this appears since Bugfix from 
https://issues.apache.org/jira/browse/WICKET-6289 was implemented.


Do I really have to use  for this kind of anchors or is it 
a Bug?


Best regards,
Claudia



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



Questions regarding Wicket 8 and lambda expressions for models

2017-05-23 Thread Ihmehlmenn
Hello everyone,

while trying out some of the very cool new features in Wicket 8,
specifically replacing PropertyModels with lambda expressions, I had a few
questions coming up. Most of them have been answered by the great guide
provided, but following things are still a bit unclear to me: 

1) Read-Only Models
Let's say I want to replace the following PropertyModel for showing the
"name" property of a Person obejct in a Label

  new PropertyModel(personModel, "name");

with a lambda expression. Which of the following would be the best approach
and why?

  LambdaModel.of(personModel, Person::getName);
  personModel.map(Person::getName);
  personModel.flatMap(...); // not quite sure yet when to use this one. See
next question as well

The first two options seem to be identical at the first glance but I noticed
that the LambdaModel does call detach() on the underlying base model (just
like the PropertyModel does), whereas the model created by the map() method
doesn't seem to do that.


2) Readable/Writeable Models
The documentation has the following example for mapping a model to a
readable/writeable model of a property

  IModel personNameModel = personModel.flatMap(targetPerson ->
  LambdaModel.of(
() -> targetPerson::getName, targetPerson::setName
  ));

Why is the call to flatMap() needed? Isn't just using the LambdaModel the
same but shorter?

  IModel personNameModel = LambdaModel.of(personModel,
Person::getName, Person::setName);


3) Constants in Models
In some cases I need to set a static constant value as read only model in a
component. Up until now I simply used
   Model.of(Constants.MY_STATIC_VALUE);
which probably results in the value being serialised into the session of the
user.

Am I assuming correctly, that using following lambda expression as model is
more "efficient", since the static constant isn't serialised anymore this
way?
  () -> Constants.MY_STATIC_VALUE;


Thanks to everybody pouring so much time into developing Wicket!

Daniel Radünz

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Questions-regarding-Wicket-8-and-lambda-expressions-for-models-tp4677918.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



Websocket redirect wrong url

2017-05-23 Thread Peter Henderson
Hi all.


I'm seeing a strange redirect problem which leads to a 404


Scenario.
1) User is on fat bookmarkable page [1]
2) Ajax onClick redirects to non bookmarkable SendMessagePage
3) SendMessage page uses websockets + background threads.
4) SendMessage page receives a websocket push event which it responds to
with [2] or [3]

When redirecting back to a really simple DummyPage all is fine.
When redirecting back to the fat bookmarkable page I get a 404 on url
https://local.starjar.com:25000/Starjar/protected/wicket/35883

Both DummyPage and PurchaseOrderPage are mounted the same way.



What am I doing which is causing the incorrect redirect path?


I'm (still) trying to build a quick start that reproduces this problem.


Further testing.

I created a new class called Dummy2 which is identical to
PurchaseOrderPage. Just a different name and mount point.
Redirecting to Dummy2 works fine .

It looks like Dummy2 => Dummy2 and PurchaseOrderPage => PurchaseOrderPage
both fail with the incorrect relative url.




Many thanks

Peter.





[1]
https://local.starjar.com:25000/Starjar/protected/purchaseOrder/35883

[2]
// This works as expected
// https://local.starjar.com:25000/Starjar/protected/dummy/12334
val pageCls = classOf[DummyDetailPage]
val pp = new PageParameters()
pp.set(WicketStarjarApplication.DetailPageIdParameterName, 12334)
throw new RestartResponseException(pageCls, pp)


[3]
// This does not work 404
// https://local.starjar.com:25000/Starjar/protected/wicket/35883
val pageCls = classOf[PurchaseOrderDetailPage]
val pp = new PageParameters()
pp.set(WicketStarjarApplication.DetailPageIdParameterName, businessId.pk)
throw new RestartResponseException(pageCls, pp)



-- 
Peter Henderson