Re: How to override URLs generated by bookmarkable mapper

2012-11-21 Thread shimin_q
Just want to report that the #mountPage() option first suggested by Martin
seems to have done the trick for me.

Now I am hit with the AJAX onUpdate() not getting called problem with Wicket
6.3.0 after I tested the same wicket code fine in 1.5.5, see the new message
I posted with my code snippet:

http://apache-wicket.1842946.n4.nabble.com/AJAX-not-working-after-migrating-from-wicket-1-5-5-to-6-3-0-tc4654065.html

Martin, any ideas what I need to do to get the AJAX onUpdate() to work with
wicket 6.3.0?  Thanks a lot for your help!!



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-override-URLs-generated-by-bookmarkable-mapper-tp4654005p4654072.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 override URLs generated by bookmarkable mapper

2012-11-21 Thread Martin Grigorov
Hi,

You can set request header 'Wicket-Ajax-BaseURL' for your Ajax calls.
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L433

With 'beforeSend' handler you can override it.
Example:
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L541

This way you can cheat Wicket that the current page is the first requested
one.

Read https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax for
more info.


On Tue, Nov 20, 2012 at 9:00 PM, shimin_q  wrote:

> Thanks, Martin!
>
> I just updated wicket to 6.3.0 and removed the href="#" from my html
> template.  Wicket does generate a relative url in "href=" relative to the
> current url.   This, however, does not solve the issue with JQuery Mobile,
> which loads
> href="com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage"
> based on the first page it loads, not the current url.
>
> The following links to JQuery Mobile explain its model:
>
> http://jquerymobile.com/demos/1.2.0/docs/pages/page-links.html
> http://jquerymobile.com/demos/1.2.0/docs/pages/page-navmodel.html
>
> Basically in JQM the first page of a site that is visited is a "base". It
> constructs the URLs for other pages by appending # and the URL to that page
> to the base URL. So, if the first page visited is
> http://example.com/index.html and the user then clicks on a link to
> someotherpage.html, the URL is
> http://example.com/index.html#someotherpage.html. But it fixes up the URL
> shown in the navigation bar of your browser so that it appears as
> http://example.com/someotherpage.html.
>
> In my case, the first page of my site is http://127.0.0.1:7999, which is
> the
> "base", so the URLs of all the other pages of this site are constructed
> based on this "base", not the current url.  Therefore, if
>
>
> href="./com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage"
>
> JQM will load
>
>
> http://127.0.0.1:7999/com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage
>
> which will not find the page since Wicket has the page at
>
>
> http://127.0.0.1:7999/wicket/bookmarkable/com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage
>
> I also posted the question at JQM forum, it appears there is no way to
> change JQM behavior.  So my remaining options are to change my wicket code
> to either 1) generate href= with absolute/full path (i.e.,
>
> href="wicket/bookmarkable/com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage)
> OR 2) override the wicket default bookmarkable mapper not to store the page
> under wicket/bookmarkable but to the base so
> href="com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage"
> will find the page.
>
> Could you suggest any mechanisms in Wicket, which I hope exists, to
> accomplish either 1) or 2) above?   some code example/snippet would be even
> better.   I have been struggling with this issue for a long while... your
> help would be much appreciated!!  Thanks.
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-override-URLs-generated-by-bookmarkable-mapper-tp4654005p4654045.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 


Re: How to override URLs generated by bookmarkable mapper

2012-11-20 Thread shimin_q
Thanks, Martin! 

I just updated wicket to 6.3.0 and removed the href="#" from my html
template.  Wicket does generate a relative url in "href=" relative to the
current url.   This, however, does not solve the issue with JQuery Mobile,
which loads
href="com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage"
based on the first page it loads, not the current url.  

The following links to JQuery Mobile explain its model: 

http://jquerymobile.com/demos/1.2.0/docs/pages/page-links.html
http://jquerymobile.com/demos/1.2.0/docs/pages/page-navmodel.html

Basically in JQM the first page of a site that is visited is a "base". It
constructs the URLs for other pages by appending # and the URL to that page
to the base URL. So, if the first page visited is
http://example.com/index.html and the user then clicks on a link to
someotherpage.html, the URL is
http://example.com/index.html#someotherpage.html. But it fixes up the URL
shown in the navigation bar of your browser so that it appears as
http://example.com/someotherpage.html.  

In my case, the first page of my site is http://127.0.0.1:7999, which is the
"base", so the URLs of all the other pages of this site are constructed
based on this "base", not the current url.  Therefore, if 

href="./com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage"

JQM will load 

http://127.0.0.1:7999/com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage

which will not find the page since Wicket has the page at 

http://127.0.0.1:7999/wicket/bookmarkable/com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage

I also posted the question at JQM forum, it appears there is no way to
change JQM behavior.  So my remaining options are to change my wicket code
to either 1) generate href= with absolute/full path (i.e.,
href="wicket/bookmarkable/com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage)
 
OR 2) override the wicket default bookmarkable mapper not to store the page
under wicket/bookmarkable but to the base so
href="com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage"
will find the page.

Could you suggest any mechanisms in Wicket, which I hope exists, to
accomplish either 1) or 2) above?   some code example/snippet would be even
better.   I have been struggling with this issue for a long while... your
help would be much appreciated!!  Thanks.




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-override-URLs-generated-by-bookmarkable-mapper-tp4654005p4654045.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 override URLs generated by bookmarkable mapper

2012-11-20 Thread Martin Grigorov
You can remove href="#" from your template markup completely.
With will set href=something, where something is the relative url to the
destination page. Relative against the current url !
I.e. if you are at .../wicket/bookmarkable/com.example.PageA and the
destination is wicket/bookmarkable/com.example.PageB then the relative will
be just ./com.example.PageB


On Tue, Nov 20, 2012 at 6:04 PM, shimin_q  wrote:

> Thanks for the reply!  Just wanted to clarify, are you saying that, with
> Wicket 6.2, the href="#" will be replaced with the full path including the
> "wicket/bookmarkable" part:
>
> List
>
> <./wicket/bookmarkable/com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage>
>
> instead of what I see with wicket 1.5.5
>
> List 
>
> ?
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-override-URLs-generated-by-bookmarkable-mapper-tp4654005p4654037.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 


Re: How to override URLs generated by bookmarkable mapper

2012-11-20 Thread Martin Grigorov
Hi,

I suggest you to upgrade to latest version of Wicket and try.
The generated Urls should be like: ./bookmarkable/wicket/com.example.MyPage

>From your description I didn't understand why JQuery Mobile doesn't like
'bookmarkable/wicket' ? This is just a part of the Url path.
You can always #mountPage() the problematic page and use your own mount
path that has JQuery Mobile-friendly url (whatever that should mean).

On Mon, Nov 19, 2012 at 10:14 PM, shimin_q  wrote:

> I have an Apache Wicket-based application that I'd like to integrate with
> JQuery Mobile on so it looks more pleasing on mobile devices.
> Unfortunately, I am getting "Error Loading Page" errors for all the
> bookmarkable page links, which I never had problems with before JQuery
> Mobile was added to the mix.  The root cause appears to be the URL
> contained in the HTTP requests.  I used Wicket 1.5.5, locally tested using
> jetty server 6.1.26 and FireFox 16.0, JQuery Mobile 1.2.0, JQuery 1.8.0.
> Here is the code snippet:
>
>
> 
>List <#>
>   
> 
>
> The corresponding java code:
>
> add(new BookmarkablePageLink(
> "metaprofileList", MetaprofileListPage.class));
>
>
> Based on the above, Wicket correctly replaced "#" in href="#" with real
> URLs
> where the pages are, so the final HTML looks like the following:
>
> 
>List
> 
>   
> 
>
> When the link is clicked , Jetty server sends the following HTTP Request
> with the following URL:
>
> GET
>
> http://127.0.0.1:7999/com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage
> [HTTP/1.1 404 Not Found 0ms]
>
> This is not a correct URL for the MetaprofileListPage.  As I understand,
> with the default bookmarkable mapper in Wicket, the correct URL is:
>
>
> http://127.0.0.1:7999/wicket/bookmarkable/com.alcatel_lucent.nms8770.awol.client.web.page.MetaprofileListPage
>
> As far as I know, I have no way of changing the way that JQuery Mobile
> constructs the URLs from the href=, I am looking for ways in Wicket to
> override the default "wicket/bookmarkable" context path to just "/"...
>
>
> For your reference, the only JQuery Mobile-related change I did was
> switching the headers in the HTML file from:
>
>  media="only screen and (max-width: 480px)"/>
>  media="only screen and (min-width: 1025px)"/>
>  media="all and (max-device-width: 1024px) and (orientation:portrait)"/>
>  media="all and (max-device-width: 1024px) and (orientation:landscape)"/>
> 
>
> To the standard boilerplate jquery mobile includes:
>
> 
>  href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css"; />
>
>
>
> I have been struggling with this for 2 weeks now :-(  What do I need to do
> to get Wicket and Jquery mobile to work loading the correct urls/pages?
> Please help!!  Many thanks!!
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-override-URLs-generated-by-bookmarkable-mapper-tp4654005.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