Re: How to create https link to a page?

2013-05-28 Thread Alexey Mukas
Hi Martin,

I've made further investigations and found the problem, it was an order of
'mounting pages' and 'setRootRequestMapper'.

If mounting goes first everything works fine (the URL to Loging generated
with HTTPS), but if I change the order the URL is generated for HTTP and
there is no redirect after transition to the Login page.

The source of the issue is resolving Url for IRequestHandler.
In method RequestCycle#mapUrlFor line 429, the mapHandler is called which
returns Url without protocol set.
The mapHandler goes through all registered mappers, so registration order
matters..

in class CompoundRequestMapper:

@Override
public Url mapHandler(final IRequestHandler handler)
{
for (IRequestMapper mapper : mappers)
{
Url url = mapper.mapHandler(handler);
if (url != null)
{
return url;
}
}
return null;
}

I've solved my issue by changing the order, but I would like to avoid this
in future, what would you recommend?




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-create-https-link-to-a-page-tp4659050p4659087.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to create https link to a page?

2013-05-28 Thread Martin Grigorov
Hi Alexey,


On Tue, May 28, 2013 at 11:21 AM, Alexey Mukas alexey.mu...@gmail.comwrote:

 Hi Martin,

 I've made further investigations and found the problem, it was an order of
 'mounting pages' and 'setRootRequestMapper'.

 If mounting goes first everything works fine (the URL to Loging generated
 with HTTPS), but if I change the order the URL is generated for HTTP and
 there is no redirect after transition to the Login page.

 The source of the issue is resolving Url for IRequestHandler.
 In method RequestCycle#mapUrlFor line 429, the mapHandler is called which
 returns Url without protocol set.
 The mapHandler goes through all registered mappers, so registration order
 matters..

 in class CompoundRequestMapper:

 @Override
 public Url mapHandler(final IRequestHandler handler)
 {
 for (IRequestMapper mapper : mappers)
 {
 Url url = mapper.mapHandler(handler);
 if (url != null)
 {
 return url;
 }
 }
 return null;
 }

 I've solved my issue by changing the order, but I would like to avoid this
 in future, what would you recommend?


I don't have a solution for this problem :-/

The javadoc of HttpsMapper says that it should be mounted as late as needed:
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/protocol/https/HttpsMapper.java?source=cc#L52

Mounting pages after configuring the HttpsMapper is a valid use case.






 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-create-https-link-to-a-page-tp4659050p4659087.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: How to create https link to a page?

2013-05-28 Thread Alexey Mukas
Thanks Martin



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-create-https-link-to-a-page-tp4659050p4659102.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to create https link to a page?

2013-05-27 Thread Martin Grigorov
Hi Alexey,

Wicket generates relative urls.
When the user clicks the link to LoginPage HttpsMapper will check that
LoginPage requires HTTPS and
that the current protocol is HTTP and will make a redirect with HTTPS.

So it will work automatically, with the price of an additional redirect.


On Mon, May 27, 2013 at 7:23 PM, Alexey Mukas alexey.mu...@gmail.comwrote:

 Hi all,

 In app I have several pages on http on those pages I need https link to the
 LoginPage.

 I have set HttpsMapper as a root mapper and added RequireHttps to the
 LoginPage class.

 I'm using Wicket 6.8.0



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-create-https-link-to-a-page-tp4659050.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: How to create https link to a page?

2013-05-27 Thread Alexey Mukas
Hi Martin,

Thanks for the super fast reply!
In my case I have no redirect, Login page opens with HTTP, but in the form
(in action attribute) I see correct HTTPS url.
Will try to reproduce in the Quickstart.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-create-https-link-to-a-page-tp4659050p4659052.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