Re: Static image

2013-01-10 Thread René Vangsgaard
The context image looks nice, but I cannot use it in a ClientSideImageMap -
is that on purpose?

For now UrlResourceReference serves my purpose.

Thank you for helping


On 8 January 2013 09:09, Martin Grigorov  wrote:

> Hi,
>
> Here is the source of
> org.apache.wicket.markup.html.image.Image#getStatelessHint()
> {
> return (getImageResource() == null || getImageResource() ==
> localizedImageResource.getResource()) &&
>  localizedImageResource.isStateless();
> }
>
> I.e. if the image uses a IResource then it is stateful because the url to
> the IResource is dependent on the component (e.g.
> ?2-IResourceListener-container~image).
> If you use ResourceReference then the url to reach it doesn't depend on the
> page/component (e.g. wicket/resource/).
>
> As Andrea mentioned you can use ContextImage which also doesn't use
> IResource and the generated url doesn't depend on the page/component.
>
>
> On Tue, Jan 8, 2013 at 12:30 AM, René Vangsgaard
> wrote:
>
> > Hi - I would like to link to a static image, and the link should be
> > stateless.
> >
> > I have tried this (using Scala):
> >
> > val img = new Image("img", new ContextRelativeResource("images/img" +
> imgId
> > + ".png"))
> >
> > But the link becomes stateful.
> >
> > I just found
> >
> > val img = new Image("img", new UrlResourceReference(new
> Url(listOfStrings,
> > Charset.defaultCharset(
> >
> > Is the last example the preferred way of achieving this?
> >
> > Thanks in advance,
> > René
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>


Static image

2013-01-07 Thread René Vangsgaard
Hi - I would like to link to a static image, and the link should be
stateless.

I have tried this (using Scala):

val img = new Image("img", new ContextRelativeResource("images/img" + imgId
+ ".png"))

But the link becomes stateful.

I just found

val img = new Image("img", new UrlResourceReference(new Url(listOfStrings,
Charset.defaultCharset(

Is the last example the preferred way of achieving this?

Thanks in advance,
René


Re: stateless pages

2012-12-11 Thread René Vangsgaard
Thank you

I understand that Wicket reverts back to statefulness if required. Can I
get Wicket to log when and why (the offending component) is reverts to
statefulness?

Is it correct that the number after an URL (ex. host/path?8) indicates the
page is stateful?

Statefulness concerns me, as I suppose statefulness creates a server side
session. The server side session make scaling difficult/more complex, as
the session must be replicated or use sticky sessions. My site have not
real use for state, but I really like how Wicket does components and
rendering.

Thanks,
-René


On 10 December 2012 22:43, Phillips, David  wrote:

> setStatelessHint() tells the page to attempt to be stateless, but if any
> of the components or the behaviors are not stateless than the page will
> revert back to statefulness.
>
> There are several components which have stateless alternatives
> (StatelessForm and StatelessLink for example), but the very nature of Ajax
> and it's callback functionality means that the page cannot be stateless.
> The server must maintain state about the current page for each Ajax request
> to have the correct starting point.
>
> If I may ask, what is it about statefulness that concerns you?
>
> Thanks,
> -David Phillips - USAA
>
> -Original Message-
> From: René Vangsgaard [mailto:rene.vangsga...@gmail.com]
> Sent: Monday, December 10, 2012 3:29 PM
> To: users@wicket.apache.org
> Subject: EXTERNAL: stateless pages
>
> I am looking into stateless wicket. Do the setStatelessHint() work as
> expected? My links are generated correctly, but when the page is rendered a
> ?#number is rendered - the #number being the "normal wicket counter". I
> read that the presence of this number indicates my page is not stateless.
>
> And it is true that any use of Ajax will make a page stateful.
>
> On a more general note, I am looking into creating a stateless
> application, mainly because of scaling. Do you think Wicket will fit, even
> though I will be using Ajax? I really think the separation of HTML and
> code, the approach with components and the use of wicket:id is the best,
> and I have not found it anywhere else. Basically I like Wicket, but do not
> need the statefulness.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


stateless pages

2012-12-10 Thread René Vangsgaard
I am looking into stateless wicket. Do the setStatelessHint() work as
expected? My links are generated correctly, but when the page is rendered a
?#number is rendered - the #number being the "normal wicket counter". I
read that the presence of this number indicates my page is not stateless.

And it is true that any use of Ajax will make a page stateful.

On a more general note, I am looking into creating a stateless application,
mainly because of scaling. Do you think Wicket will fit, even though I will
be using Ajax? I really think the separation of HTML and code, the approach
with components and the use of wicket:id is the best, and I have not found
it anywhere else. Basically I like Wicket, but do not need the statefulness.


Re: Recommended way to generate REST URLs in Wicket 6.3

2012-11-30 Thread René Vangsgaard
Using the class and PageParameters together did it. Thanks a lot.


On 30 November 2012 13:01, Martin Grigorov  wrote:

> No worries.
> I still have problem to understand why people call Urls with path
> parameters REST-urls. There is no problem to read query string parameters
> in RESTful app.
>
>
> On Fri, Nov 30, 2012 at 12:47 PM, René Vangsgaard <
> rene.vangsga...@gmail.com
> > wrote:
>
> > Thank you, but my second was more on generating REST-like URLs, not
> > consuming them. I have rephrased my example below.
> >
> > In init:
> > mountPage("/guide/${guideId}/step/${stepNo}", classOf[GuidePage])
> >
> > In StateLessLink.onClick:
> > setResponsePage(new GuidePage(1984, 1))
> >
> > It generate this URL (the last number changing):
> > http://localhost:8080/guide//step/?3
>
>
> There are two problems here.
> 1) encoded in the url path or query string these parameters are still
> parameters
> In your code about GuidePage is created without PageParameters being used,
> so Wicket has no way to find values for the placeholders
> Solution:
> val params = new PageParameters();
> params.set("guideId", 1984)
> params.set("stepNo", 1)
> setResponsePage(classOf[GuidePage], params)
>
>
> 2) the extra pageId in the query string is used internally by Wicket
> It is not needed only when your page is stateless
> If GuidePage has no stateful components/behaviors then all will be fine.
> Set log level to DEBUG for org.apache.wicket.Page to see whether a Page is
> stateful and why
>
>
>
> >
> >
> >
> > On 30 November 2012 12:03, Martin Grigorov  wrote:
> >
> > > Hi,
> > >
> > > Read http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/
> > >
> > >
> > > On Fri, Nov 30, 2012 at 11:52 AM, René Vangsgaard <
> > > rene.vangsga...@gmail.com
> > > > wrote:
> > >
> > > > Hi all
> > > >
> > > > Searching the net I found various ways to support RESTful URLs in
> > Wicket,
> > > > including the MixedParamUrlCodingStrategy. I am just curious if there
> > is
> > > an
> > > > easier way, as it looks cumbersome.
> > > >
> > > > I like the method mountPage (example in Scala below), but it does not
> > > > generate RESTful URLs, the URL looks like this: guide//step/?3 - the
> > > > guideId and stepNo is missing.
> > > >
> > > > What is the recommended way of generating REST URLs in Wicket 6.3?
> > > >
> > > > mountPage("/guide/${guideId}/step/${stepNo}", classOf[GuidePage])
> > > >
> > >
> > >
> > >
> > > --
> > > Martin Grigorov
> > > jWeekend
> > > Training, Consulting, Development
> > > http://jWeekend.com <http://jweekend.com/>
> > >
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>


Re: Recommended way to generate REST URLs in Wicket 6.3

2012-11-30 Thread René Vangsgaard
Thank you, but my second was more on generating REST-like URLs, not
consuming them. I have rephrased my example below.

In init:
mountPage("/guide/${guideId}/step/${stepNo}", classOf[GuidePage])

In StateLessLink.onClick:
setResponsePage(new GuidePage(1984, 1))

It generate this URL (the last number changing):
http://localhost:8080/guide//step/?3



On 30 November 2012 12:03, Martin Grigorov  wrote:

> Hi,
>
> Read http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/
>
>
> On Fri, Nov 30, 2012 at 11:52 AM, René Vangsgaard <
> rene.vangsga...@gmail.com
> > wrote:
>
> > Hi all
> >
> > Searching the net I found various ways to support RESTful URLs in Wicket,
> > including the MixedParamUrlCodingStrategy. I am just curious if there is
> an
> > easier way, as it looks cumbersome.
> >
> > I like the method mountPage (example in Scala below), but it does not
> > generate RESTful URLs, the URL looks like this: guide//step/?3 - the
> > guideId and stepNo is missing.
> >
> > What is the recommended way of generating REST URLs in Wicket 6.3?
> >
> > mountPage("/guide/${guideId}/step/${stepNo}", classOf[GuidePage])
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>


Recommended way to generate REST URLs in Wicket 6.3

2012-11-30 Thread René Vangsgaard
Hi all

Searching the net I found various ways to support RESTful URLs in Wicket,
including the MixedParamUrlCodingStrategy. I am just curious if there is an
easier way, as it looks cumbersome.

I like the method mountPage (example in Scala below), but it does not
generate RESTful URLs, the URL looks like this: guide//step/?3 - the
guideId and stepNo is missing.

What is the recommended way of generating REST URLs in Wicket 6.3?

mountPage("/guide/${guideId}/step/${stepNo}", classOf[GuidePage])