Re: Link generation from outside of Wicket - was Re: [ANNOUNCE] Apache Wicket 6.7.0 Released!

2013-04-26 Thread Martin Grigorov
Hi,

In another thread I suggested an "insane" idea but maybe it could be useful
for someone.
You can expose Wicket IResource as a web service. Pass it the class name as
parameter and it can use normal Wicket functionality to return the full url
for that page.
The catch is that you need to know the url of the web service to be able to
use it.


On Fri, Apr 19, 2013 at 6:34 PM, Guillaume Smet wrote:

> On Fri, Apr 19, 2013 at 4:30 PM, Martin Grigorov 
> wrote:
> > What exactly you mean by "outside of Wicket" ?
> > What Wicket objects you have access to ?
> > The application name will be needed and a base url. Usually the current
> > request's baseUrl is used to construct a full url. Without the base url
> > Wicket can generate only context-absolute url.
>
> I'm in exactly the same situation as Martin Dietze.
>
> I have to generate URL to a Wicket page in a batch scheduled by Spring
> or Quartz.
>
> We did it following the guidance you gave to Martin but it's quite
> complicated. As you mentioned it, we have in a configuration parameter
> the scheme/host/port information and we generate an URL to a wicket
> page from there by getting the application by its name and building a
> fake request and a fake RequestCycle.
>
> FWIW, here is the current version of what we use:
> https://gist.github.com/gsmet/5421471
>
> --
> Guillaume
>
> -
> 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: Link generation from outside of Wicket - was Re: [ANNOUNCE] Apache Wicket 6.7.0 Released!

2013-04-19 Thread Guillaume Smet
On Fri, Apr 19, 2013 at 4:30 PM, Martin Grigorov  wrote:
> What exactly you mean by "outside of Wicket" ?
> What Wicket objects you have access to ?
> The application name will be needed and a base url. Usually the current
> request's baseUrl is used to construct a full url. Without the base url
> Wicket can generate only context-absolute url.

I'm in exactly the same situation as Martin Dietze.

I have to generate URL to a Wicket page in a batch scheduled by Spring
or Quartz.

We did it following the guidance you gave to Martin but it's quite
complicated. As you mentioned it, we have in a configuration parameter
the scheme/host/port information and we generate an URL to a wicket
page from there by getting the application by its name and building a
fake request and a fake RequestCycle.

FWIW, here is the current version of what we use:
https://gist.github.com/gsmet/5421471

-- 
Guillaume

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



Re: Link generation from outside of Wicket - was Re: [ANNOUNCE] Apache Wicket 6.7.0 Released!

2013-04-19 Thread Martin Grigorov
On Fri, Apr 19, 2013 at 5:12 PM, Guillaume Smet wrote:

> Hi,
>
> On Thu, Apr 18, 2013 at 11:36 AM, Martijn Dashorst 
> wrote:
> > Render a page or component to a String
> >
> > ComponentRenderer exposes two methods: `renderComponent` and
> > `renderPage` and they do exactly what their names suggest. Happy
> > emailing!
>
> This is really nice. We did it in a quite complicated way before that.
>
> Any chance the same could be done to generate links from outside of
> Wicket, which is also quite difficult to get right at the moment?
>
> I'm especially thinking about this recent thread on this subject:
> http://markmail.org/thread/a34vmcm6ulxgr3ed


What exactly you mean by "outside of Wicket" ?
What Wicket objects you have access to ?
The application name will be needed and a base url. Usually the current
request's baseUrl is used to construct a full url. Without the base url
Wicket can generate only context-absolute url.


>
>
> --
> Guillaume
>
> -
> 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