Re: Mounting URLs with locale prefix

2012-08-28 Thread asfernandes
I succedded to make it work without mess with autoLinking seeting, but it's
just for my case. I believe this is a Wicket bug, but I have no idea on a
better fix.

I installed a new RequestCycleProvider to override the UrlRenderer. I
recreated UrlRenderer#renderContextRelativeUrl replacing:

for (int i = 0; i  getBaseUrl().getSegments().size() - 1; ++i)

by:

for (int i = 1; i  getBaseUrl().getSegments().size() - 1; ++i)

So now it doesn't strip the ${locale} part of the URL to relativize
resources paths.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Mounting-URLs-with-locale-prefix-tp4651528p4651560.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: Mounting URLs with locale prefix

2012-08-28 Thread Martin Grigorov
The segment with the locale should be removed by the IRequestMapper as
LocaleFirstMapper does.
But in your case you have the locale hardcoded in the .css file, or at
least this is what I understood, and Wicket should not remove anything
that is not added by it.

There could be a bug in UrlRenderer. If you can add failing unit
test(s) for UrlRendererTest then please attach it to a ticket in Jira
and we will fix it.

On Tue, Aug 28, 2012 at 1:34 PM, asfernandes adrian...@gmail.com wrote:
 I succedded to make it work without mess with autoLinking seeting, but it's
 just for my case. I believe this is a Wicket bug, but I have no idea on a
 better fix.

 I installed a new RequestCycleProvider to override the UrlRenderer. I
 recreated UrlRenderer#renderContextRelativeUrl replacing:

 for (int i = 0; i  getBaseUrl().getSegments().size() - 1; ++i)

 by:

 for (int i = 1; i  getBaseUrl().getSegments().size() - 1; ++i)

 So now it doesn't strip the ${locale} part of the URL to relativize
 resources paths.



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Mounting-URLs-with-locale-prefix-tp4651528p4651560.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




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

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



Re: Mounting URLs with locale prefix

2012-08-28 Thread asfernandes

Martin Grigorov-4 wrote
 
 The segment with the locale should be removed by the IRequestMapper as
 LocaleFirstMapper does.
 

But on UrlRenderer#renderContextRelativeUrl, getBaseUrl() shows pt-br/home
when I'm accessing http://localhost:8990/Site/pt-br/home

This caused my tags to be rewritten from:
link rel=stylesheet type=text/css href=styles/cssreset-min.css /
to:
link rel=stylesheet type=text/css 
href=../styles/cssreset-min.css /

The first is the one I want, since the resources is also mounted with
LocaleFirstMapper, and I want it there.

So maybe some setBaseUrl call is missing, to adjust the URL on the
UrlRenderer.


Martin Grigorov-4 wrote
 
 But in your case you have the locale hardcoded in the .css file, or at
 least this is what I understood, and Wicket should not remove anything
 that is not added by it.
 

It's not hardcoded. It's relative and I want Wicket to preserve the locale
on the URL, but it's stripping it.

My resources are not localized, but looks better for me to mount them under
the locale prefix, since Wicket could not rewrite embedded or inline CSS,
and I want to use relative paths there too.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Mounting-URLs-with-locale-prefix-tp4651528p4651562.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



Mounting URLs with locale prefix

2012-08-27 Thread Adriano dos Santos Fernandes
Hi!

I do want to mount our application URLs as following:

/${locale}/PageName

So I can access Page1 as:
/pt-br/Page1
/en-us/Page1

The application is a simple website with not so many dynamic content, so
in most cases it directly uses a href=... /, img src=... /
without wicket:id.

That's fine. hrefs and image srcs are resolved correct (wicket strips
the locale from images), but if they're referenced in CSS
(background-image, for example), Wicket does not do it, so I end with
some images going to /image and another ones going to /${locale}/image.

I may mount the resources in two different places, like:
/res/${name}
/${locale}/res/${name}

But this does not seems good for me.

What's the best practice to mount pages with a URL prefix and still make
HTML/CSS to work without needing to use Wicket components (wicket:id)
for everything?


Adriano


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



Re: Mounting URLs with locale prefix

2012-08-27 Thread Martin Grigorov
Hi,

Check http://www.wicket-library.com/wicket-examples/mappers/en_US
example. It shows how to do this with LocaleFirstMapper.java

On Mon, Aug 27, 2012 at 2:20 PM, Adriano dos Santos Fernandes
adrian...@gmail.com wrote:
 Hi!

 I do want to mount our application URLs as following:

 /${locale}/PageName

 So I can access Page1 as:
 /pt-br/Page1
 /en-us/Page1

 The application is a simple website with not so many dynamic content, so
 in most cases it directly uses a href=... /, img src=... /
 without wicket:id.

 That's fine. hrefs and image srcs are resolved correct (wicket strips
 the locale from images), but if they're referenced in CSS
 (background-image, for example), Wicket does not do it, so I end with
 some images going to /image and another ones going to /${locale}/image.

 I may mount the resources in two different places, like:
 /res/${name}
 /${locale}/res/${name}

 But this does not seems good for me.

 What's the best practice to mount pages with a URL prefix and still make
 HTML/CSS to work without needing to use Wicket components (wicket:id)
 for everything?


 Adriano


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




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

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



Re: Mounting URLs with locale prefix

2012-08-27 Thread asfernandes
Martin,

Thanks for the Mapper hint, but things still don't work well in my case
(html files without wicket:id tags).

I had it almost working, but I need to call
getMarkupSettings().setAutomaticLinking(true), but this caused another
problem: Wicket is putting an onclick in   tags inside   redirecting to the
image (via window.location.href). I do not want it, I want just my links ( )
work.

When I remove setAutomaticLinking(true), Wickets sets wrong directory. It
appends a ../ before src, hrefs, etc.

This is what I said initially on the need to mount things in two different
places. I mount my resources inside the locale directory, so CSS
background-image in HTML files work, but then it fails on the other
resources (caused by this ../ prefix).



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Mounting-URLs-with-locale-prefix-tp4651528p4651539.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