Re: stateless page + click on stateless link = stateful page

2011-09-13 Thread Mike Mander

Am 13.09.2011 23:59, schrieb Bertrand Guay-Paquet:

This is fixed in trunk. The fix will be available in 1.5.1

Martin wrote to me in a former post
> This is fixed in trunk. The fix will be available in 1.5.1
Maybe we should try it again with 1.5.1

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



Re: How to remove all previous pages from pagemap

2011-09-13 Thread rebecca
Hello,

Well i have to say that i spent hours yesterday trying to understand this.

It was exactly as Matthias described: On clicking the back button, wicket
goes to the server to fetch the page (which is o.k. - i asked browser not to
cache). But instead of rendering a new bookmarkable version of the page, it
rendered a wizard page that was stored in the server.

Nothing helped (getSession().clear(), getPageMap.clear()). Only Matt's
solution did the work (thanks Matt).

This scenario of a wizard page which redirects to a message page is a very
common one (and can't be defined as an ugly solution btw). Also, the need to
prevent the user from going back to a wizard he just completed is also very
common.

Do you precious wicketiers have added/found a solution to this need in
Wicket?

thanks
Rebecca


 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-remove-all-previous-pages-from-pagemap-tp3236570p3811843.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: stateless page + click on stateless link = stateful page

2011-09-13 Thread Pedro Santos
Yes, otherwise the F5 would not work. It can be prevented by redirecting to
a stateless page, even if it was the last accessed one.

2011/9/13 Bertrand Guay-Paquet 

> Hello,
>
> I have a stateless page with a stateless link on it. The stateless link is
> used to set the session locale and nothing more. In particular, it does not
> redirect to another page when clicked.
>
> On first access to the page, the url is: localhost/servlet/login
> After clicking on the stateless link, the url becomes something like:
> localhost/servlet/login?8-1.**ILinkListener-userPanel-en
>
> At this point, the page is now stateful. This is caused by the constructor
> PageProvider(IRequestablePage page) which has the following code:
>if (pageInstance instanceof Page)
>{
>((Page)pageInstance).**setStatelessHint(false);
>}
>
> I don't understand why this is done. Is it because Wicket needs to make the
> page stateful since the URL now contains an action listener parameter?
>
> Is there a way to prevent the stateless page from becoming stateful?
>
> Cheers,
> Bertrand
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Pedro Henrique Oliveira dos Santos


Re: Create a stand-alone link and get its URL

2011-09-13 Thread Igor Vaynberg
create a single metadata key that holds a map where
string is a uuid.

-igor

On Tue, Sep 13, 2011 at 5:40 PM, Alec Swan  wrote:
> Great idea, thanks.
>
> As I was working on passing template information as a part of the link
> URL I started thinking that it would be nice if I could store this
> information in session metadata and pass the metadata key as a part of
> the link URL. However, I am not sure if I can pass metadata key in the
> URL somehow.
>
> Thoughts?
>
> Thanks,
>
> Alec
>
> On Tue, Sep 13, 2011 at 10:44 AM, Igor Vaynberg  
> wrote:
>> add a single link to your page. expose its url as a variable to the
>> templating engine and append some sort of id to the url to
>> differentiate which template should be used. since you have to put the
>> link into markup put it inside an invisible div.
>>
>> -igor
>>
>> On Tue, Sep 13, 2011 at 8:37 AM, Alec Swan  wrote:
>>> I don't think this will work because the template could be a method
>>> invocation, e.g.
>>>
>>> Download
>>>
>>> Template-evaluation approach works great for generating HTML reports,
>>> i.e. the template evaluates to a string that contains raw HTML
>>> ".." and can be included on any page. So, here is what
>>> a page containing HTML report looks like:
>>>
>>> 
>>>  ${var.studentReportWithColumnsHTML('First Name', 'Last Name')}
>>> 
>>>
>>> My code runs templating engine on the content of the editableLabel
>>> before rendering it.
>>>
>>> However, the new requirement is to expose the same reports for
>>> download as CSV files and I would like to continue using the
>>> templating mechanism and be able to support something like:
>>>
>>> 
>>>  Download
>>> 
>>>
>>> Thoughts?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> On Tue, Sep 13, 2011 at 1:00 AM, Sven Meier  wrote:
 Why don't you just use a component for this, e.g. DownloadLink?

 Download

 No stable url involved.

 Sven

 On 09/13/2011 04:45 AM, Alec Swan wrote:
> Our templating engine is the one that needs to generate the link by
> evaluating a template similar to " href='${var.reportLink}'>Download". The engine does not have
> access to any Wicket components but can access Thread local
> properties, such as RequestCycle.get(). I guess we could add a
> behavior to RequestCycle.get().getResponsePage().
>
> Is this what you are suggesting or there is a more elegant way to
> implement this in Wicket?
>
> Thanks,
>
> Alec
>
> On Mon, Sep 12, 2011 at 5:27 PM, Igor Vaynberg  
> wrote:
>> the problem is when you say "build a url to an instance of this
>> request target" wicket doesnt hold on to the instance, nor does it
>> have any way to recreate it.
>>
>> what you can do is add a behavior to the page and construct a url to
>> that behavior.
>>
>> -igor
>>
>>
>> On Mon, Sep 12, 2011 at 4:16 PM, Alec Swan  wrote:
>>> I don't really need a stable URL. In fact, I would prefer if the link
>>> URL was session or page-specific so that it cannot be accessed by
>>> anybody unless they first accessed the page that contains the link.
>>>
>>> I would like to do something along the lines of the code in my
>>> original post. In other words, I would like to create a new
>>> RequestTarget and get its URL and display that URL to the user.
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>>
>>> On Mon, Sep 12, 2011 at 4:14 PM, Igor Vaynberg 
>>>  wrote:
 create a resource and register it in shared resources, this will allow
 you to create a stable url. the filename and reportdata you will have
 to pass on the url.

 -igor

 On Mon, Sep 12, 2011 at 2:25 PM, Alec Swan  wrote:
> Hello,
>
> We use a templating engine which generates parts of our pages.
> Templates can be included on any page. We need the engine to be able
> to generate a link which will display a report when clicked. I tried
> using the following code, but it returns null from
> RequestTarget.urlFor(..):
>
> public String getReportLink() {
>        return "" + RequestCycle.get().urlFor(new
> DownloadCsvRequestTarget(fileName, reportData));
> }
>
> Where DownloadCsvRequestTarget implements respond() method to write
> reportData our in CSV format.
>
> Thanks,
>
> Alec
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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


>

Re: Create a stand-alone link and get its URL

2011-09-13 Thread Alec Swan
Great idea, thanks.

As I was working on passing template information as a part of the link
URL I started thinking that it would be nice if I could store this
information in session metadata and pass the metadata key as a part of
the link URL. However, I am not sure if I can pass metadata key in the
URL somehow.

Thoughts?

Thanks,

Alec

On Tue, Sep 13, 2011 at 10:44 AM, Igor Vaynberg  wrote:
> add a single link to your page. expose its url as a variable to the
> templating engine and append some sort of id to the url to
> differentiate which template should be used. since you have to put the
> link into markup put it inside an invisible div.
>
> -igor
>
> On Tue, Sep 13, 2011 at 8:37 AM, Alec Swan  wrote:
>> I don't think this will work because the template could be a method
>> invocation, e.g.
>>
>> Download
>>
>> Template-evaluation approach works great for generating HTML reports,
>> i.e. the template evaluates to a string that contains raw HTML
>> ".." and can be included on any page. So, here is what
>> a page containing HTML report looks like:
>>
>> 
>>  ${var.studentReportWithColumnsHTML('First Name', 'Last Name')}
>> 
>>
>> My code runs templating engine on the content of the editableLabel
>> before rendering it.
>>
>> However, the new requirement is to expose the same reports for
>> download as CSV files and I would like to continue using the
>> templating mechanism and be able to support something like:
>>
>> 
>>  Download
>> 
>>
>> Thoughts?
>>
>> Thanks,
>>
>> Alec
>>
>> On Tue, Sep 13, 2011 at 1:00 AM, Sven Meier  wrote:
>>> Why don't you just use a component for this, e.g. DownloadLink?
>>>
>>> Download
>>>
>>> No stable url involved.
>>>
>>> Sven
>>>
>>> On 09/13/2011 04:45 AM, Alec Swan wrote:
 Our templating engine is the one that needs to generate the link by
 evaluating a template similar to ">>> href='${var.reportLink}'>Download". The engine does not have
 access to any Wicket components but can access Thread local
 properties, such as RequestCycle.get(). I guess we could add a
 behavior to RequestCycle.get().getResponsePage().

 Is this what you are suggesting or there is a more elegant way to
 implement this in Wicket?

 Thanks,

 Alec

 On Mon, Sep 12, 2011 at 5:27 PM, Igor Vaynberg  
 wrote:
> the problem is when you say "build a url to an instance of this
> request target" wicket doesnt hold on to the instance, nor does it
> have any way to recreate it.
>
> what you can do is add a behavior to the page and construct a url to
> that behavior.
>
> -igor
>
>
> On Mon, Sep 12, 2011 at 4:16 PM, Alec Swan  wrote:
>> I don't really need a stable URL. In fact, I would prefer if the link
>> URL was session or page-specific so that it cannot be accessed by
>> anybody unless they first accessed the page that contains the link.
>>
>> I would like to do something along the lines of the code in my
>> original post. In other words, I would like to create a new
>> RequestTarget and get its URL and display that URL to the user.
>>
>> Thanks,
>>
>> Alec
>>
>>
>> On Mon, Sep 12, 2011 at 4:14 PM, Igor Vaynberg  
>> wrote:
>>> create a resource and register it in shared resources, this will allow
>>> you to create a stable url. the filename and reportdata you will have
>>> to pass on the url.
>>>
>>> -igor
>>>
>>> On Mon, Sep 12, 2011 at 2:25 PM, Alec Swan  wrote:
 Hello,

 We use a templating engine which generates parts of our pages.
 Templates can be included on any page. We need the engine to be able
 to generate a link which will display a report when clicked. I tried
 using the following code, but it returns null from
 RequestTarget.urlFor(..):

 public String getReportLink() {
        return "" + RequestCycle.get().urlFor(new
 DownloadCsvRequestTarget(fileName, reportData));
 }

 Where DownloadCsvRequestTarget implements respond() method to write
 reportData our in CSV format.

 Thanks,

 Alec

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


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

stateless page + click on stateless link = stateful page

2011-09-13 Thread Bertrand Guay-Paquet

Hello,

I have a stateless page with a stateless link on it. The stateless link 
is used to set the session locale and nothing more. In particular, it 
does not redirect to another page when clicked.


On first access to the page, the url is: localhost/servlet/login
After clicking on the stateless link, the url becomes something like: 
localhost/servlet/login?8-1.ILinkListener-userPanel-en


At this point, the page is now stateful. This is caused by the 
constructor PageProvider(IRequestablePage page) which has the following 
code:

if (pageInstance instanceof Page)
{
((Page)pageInstance).setStatelessHint(false);
}

I don't understand why this is done. Is it because Wicket needs to make 
the page stateful since the URL now contains an action listener parameter?


Is there a way to prevent the stateless page from becoming stateful?

Cheers,
Bertrand

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



Re: Create a stand-alone link and get its URL

2011-09-13 Thread Igor Vaynberg
add a single link to your page. expose its url as a variable to the
templating engine and append some sort of id to the url to
differentiate which template should be used. since you have to put the
link into markup put it inside an invisible div.

-igor

On Tue, Sep 13, 2011 at 8:37 AM, Alec Swan  wrote:
> I don't think this will work because the template could be a method
> invocation, e.g.
>
> Download
>
> Template-evaluation approach works great for generating HTML reports,
> i.e. the template evaluates to a string that contains raw HTML
> ".." and can be included on any page. So, here is what
> a page containing HTML report looks like:
>
> 
>  ${var.studentReportWithColumnsHTML('First Name', 'Last Name')}
> 
>
> My code runs templating engine on the content of the editableLabel
> before rendering it.
>
> However, the new requirement is to expose the same reports for
> download as CSV files and I would like to continue using the
> templating mechanism and be able to support something like:
>
> 
>  Download
> 
>
> Thoughts?
>
> Thanks,
>
> Alec
>
> On Tue, Sep 13, 2011 at 1:00 AM, Sven Meier  wrote:
>> Why don't you just use a component for this, e.g. DownloadLink?
>>
>> Download
>>
>> No stable url involved.
>>
>> Sven
>>
>> On 09/13/2011 04:45 AM, Alec Swan wrote:
>>> Our templating engine is the one that needs to generate the link by
>>> evaluating a template similar to ">> href='${var.reportLink}'>Download". The engine does not have
>>> access to any Wicket components but can access Thread local
>>> properties, such as RequestCycle.get(). I guess we could add a
>>> behavior to RequestCycle.get().getResponsePage().
>>>
>>> Is this what you are suggesting or there is a more elegant way to
>>> implement this in Wicket?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> On Mon, Sep 12, 2011 at 5:27 PM, Igor Vaynberg  
>>> wrote:
 the problem is when you say "build a url to an instance of this
 request target" wicket doesnt hold on to the instance, nor does it
 have any way to recreate it.

 what you can do is add a behavior to the page and construct a url to
 that behavior.

 -igor


 On Mon, Sep 12, 2011 at 4:16 PM, Alec Swan  wrote:
> I don't really need a stable URL. In fact, I would prefer if the link
> URL was session or page-specific so that it cannot be accessed by
> anybody unless they first accessed the page that contains the link.
>
> I would like to do something along the lines of the code in my
> original post. In other words, I would like to create a new
> RequestTarget and get its URL and display that URL to the user.
>
> Thanks,
>
> Alec
>
>
> On Mon, Sep 12, 2011 at 4:14 PM, Igor Vaynberg  
> wrote:
>> create a resource and register it in shared resources, this will allow
>> you to create a stable url. the filename and reportdata you will have
>> to pass on the url.
>>
>> -igor
>>
>> On Mon, Sep 12, 2011 at 2:25 PM, Alec Swan  wrote:
>>> Hello,
>>>
>>> We use a templating engine which generates parts of our pages.
>>> Templates can be included on any page. We need the engine to be able
>>> to generate a link which will display a report when clicked. I tried
>>> using the following code, but it returns null from
>>> RequestTarget.urlFor(..):
>>>
>>> public String getReportLink() {
>>>        return "" + RequestCycle.get().urlFor(new
>>> DownloadCsvRequestTarget(fileName, reportData));
>>> }
>>>
>>> Where DownloadCsvRequestTarget implements respond() method to write
>>> reportData our in CSV format.
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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


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

Re: ajax and URLs

2011-09-13 Thread Igor Vaynberg
ive done some work on it here, maybe its of some use to you:

https://github.com/ivaynberg/wicket/tree/ajax-history

-igor

On Tue, Sep 13, 2011 at 12:11 AM, Martin Grigorov  wrote:
> Wicket doesn't support Ajax back/forward button out of the box for now.
> You'll have to do it by yourself.
>
> On Tue, Sep 13, 2011 at 3:45 AM, Alexander Gubin  
> wrote:
>> Sorry, if this question had been answered before,
>>
>> I am writing and AJAX app and looking into way to modify browser location
>> bar, when clicking on Ajax links. Currently I have two pages with a bunch on
>> panels, and when I hit back button I would like to go to previous panel, not
>> page.
>>
>> I see the recommended way for Ajax apps it to use hash #, a.k.a. anchor.
>> Does Wicket natively support anchor setting and parsing? Or do I need to use
>> history.js with/or JQuery plugins?
>>
>> Sincerely,
>>
>> Alexander
>>
>> -
>> 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
>
>

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



Re: Create a stand-alone link and get its URL

2011-09-13 Thread Alec Swan
I don't think this will work because the template could be a method
invocation, e.g.

Download

Template-evaluation approach works great for generating HTML reports,
i.e. the template evaluates to a string that contains raw HTML
".." and can be included on any page. So, here is what
a page containing HTML report looks like:


  ${var.studentReportWithColumnsHTML('First Name', 'Last Name')}


My code runs templating engine on the content of the editableLabel
before rendering it.

However, the new requirement is to expose the same reports for
download as CSV files and I would like to continue using the
templating mechanism and be able to support something like:


  Download


Thoughts?

Thanks,

Alec

On Tue, Sep 13, 2011 at 1:00 AM, Sven Meier  wrote:
> Why don't you just use a component for this, e.g. DownloadLink?
>
> Download
>
> No stable url involved.
>
> Sven
>
> On 09/13/2011 04:45 AM, Alec Swan wrote:
>> Our templating engine is the one that needs to generate the link by
>> evaluating a template similar to "> href='${var.reportLink}'>Download". The engine does not have
>> access to any Wicket components but can access Thread local
>> properties, such as RequestCycle.get(). I guess we could add a
>> behavior to RequestCycle.get().getResponsePage().
>>
>> Is this what you are suggesting or there is a more elegant way to
>> implement this in Wicket?
>>
>> Thanks,
>>
>> Alec
>>
>> On Mon, Sep 12, 2011 at 5:27 PM, Igor Vaynberg  
>> wrote:
>>> the problem is when you say "build a url to an instance of this
>>> request target" wicket doesnt hold on to the instance, nor does it
>>> have any way to recreate it.
>>>
>>> what you can do is add a behavior to the page and construct a url to
>>> that behavior.
>>>
>>> -igor
>>>
>>>
>>> On Mon, Sep 12, 2011 at 4:16 PM, Alec Swan  wrote:
 I don't really need a stable URL. In fact, I would prefer if the link
 URL was session or page-specific so that it cannot be accessed by
 anybody unless they first accessed the page that contains the link.

 I would like to do something along the lines of the code in my
 original post. In other words, I would like to create a new
 RequestTarget and get its URL and display that URL to the user.

 Thanks,

 Alec


 On Mon, Sep 12, 2011 at 4:14 PM, Igor Vaynberg  
 wrote:
> create a resource and register it in shared resources, this will allow
> you to create a stable url. the filename and reportdata you will have
> to pass on the url.
>
> -igor
>
> On Mon, Sep 12, 2011 at 2:25 PM, Alec Swan  wrote:
>> Hello,
>>
>> We use a templating engine which generates parts of our pages.
>> Templates can be included on any page. We need the engine to be able
>> to generate a link which will display a report when clicked. I tried
>> using the following code, but it returns null from
>> RequestTarget.urlFor(..):
>>
>> public String getReportLink() {
>>        return "" + RequestCycle.get().urlFor(new
>> DownloadCsvRequestTarget(fileName, reportData));
>> }
>>
>> Where DownloadCsvRequestTarget implements respond() method to write
>> reportData our in CSV format.
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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


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

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



Re: LazyInitializationException with CheckBoxMultipleChoice

2011-09-13 Thread Florian B.
Ahhh thanks for the tip. I totally overlook that there're also a constructor
which takes a IModel for the choices then of course there shouldn't be a
problem any more. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/LazyInitializationException-with-CheckBoxMultipleChoice-tp3806997p3809839.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: weekly memory usage increase by 500 Mb problem

2011-09-13 Thread Alex
I managed to run JProfiler. The startup command should be located not in
CATALINA_OPTS but in JAVA_OPTS. It is really good tool! In the mean time
JProfiler running in Production, I will look on Eclipse Memory Analyzer.
Thank you very much again for your help!

2011/9/13 Alex 

> Thank you very much for your answer. I tried to use JProfiler. Under
> Windows it works fine. But in the working environment (Ubuntu 9.10, Tomcat6,
> Java Sun 1.6.0_24 HotSpot 64 bit mixed mode) the list with running JVMs is
> empty. If I use jpenable it says: No unprofiled JVMs found. Unfortunately
> googling did not help. :)
>


Re: weekly memory usage increase by 500 Mb problem

2011-09-13 Thread Alex
Thank you very much for your answer. I tried to use JProfiler. Under Windows
it works fine. But in the working environment (Ubuntu 9.10, Tomcat6, Java
Sun 1.6.0_24 HotSpot 64 bit mixed mode) the list with running JVMs is empty.
If I use jpenable it says: No unprofiled JVMs found. Unfortunately googling
did not help. :)


Re: why generate hybrid URL for stateless page?

2011-09-13 Thread Martin Grigorov
Hi Kent,

Indeed the URL is hybrid but only the component info is actually used.
Since the page is stateless the page is not stored and the next
request recreates a new instance of this page class and uses the
component info (e.g. ILinkListener-form-link) to find the link and
execute its onClick method.

Maybe we can optimize this a bit by changing the page id to -1 and
don't do the lookup by page id when the link is clicked.
I.e. the generated url for components in stateless page will look
like: -1-1.ILinkListener-form-link

I'll experiment with that.

On Tue, Sep 13, 2011 at 9:00 AM, Kent Tong  wrote:
> Hi,
>
> In 1.5 I found that even if a page is stateless, Wicket still generates
> hybrid URLs (with PageInfo) for stateless links/forms. This is done in
> AbstractBookmarkableMapper (see below). Any idea why? Thanks!
>
>
> if (requestHandler instanceof BookmarkableListenerInterfaceRequestHandler)
> {
>        // listener interface URL with page class information
>        BookmarkableListenerInterfaceRequestHandler handler =
> (BookmarkableListenerInterfaceRequestHandler)requestHandler;
>        Class pageClass = handler.getPageClass();
>        if (!checkPageClass(pageClass))
>        {
>                return null;
>        }
>        Integer renderCount = null;
>        if (handler.getListenerInterface().isIncludeRenderCount())
>        {
>                renderCount = handler.getRenderCount();
>        }
>        PageInfo pageInfo = new PageInfo(handler.getPageId());
>        ComponentInfo componentInfo = new ComponentInfo(renderCount,
>        requestListenerInterfaceToString(handler.getListenerInterface()),
>                                handler.getComponentPath(),
>                                handler.getBehaviorIndex());
>        UrlInfo urlInfo = new UrlInfo(new PageComponentInfo(pageInfo,
> componentInfo),
>                                pageClass, handler.getPageParameters());
>        return buildUrl(urlInfo);
> }
>
>
>
> -
> 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: ajax and URLs

2011-09-13 Thread Martin Grigorov
Wicket doesn't support Ajax back/forward button out of the box for now.
You'll have to do it by yourself.

On Tue, Sep 13, 2011 at 3:45 AM, Alexander Gubin  wrote:
> Sorry, if this question had been answered before,
>
> I am writing and AJAX app and looking into way to modify browser location
> bar, when clicking on Ajax links. Currently I have two pages with a bunch on
> panels, and when I hit back button I would like to go to previous panel, not
> page.
>
> I see the recommended way for Ajax apps it to use hash #, a.k.a. anchor.
> Does Wicket natively support anchor setting and parsing? Or do I need to use
> history.js with/or JQuery plugins?
>
> Sincerely,
>
> Alexander
>
> -
> 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: Create a stand-alone link and get its URL

2011-09-13 Thread Sven Meier
Why don't you just use a component for this, e.g. DownloadLink?

Download

No stable url involved.

Sven

On 09/13/2011 04:45 AM, Alec Swan wrote:
> Our templating engine is the one that needs to generate the link by
> evaluating a template similar to " href='${var.reportLink}'>Download". The engine does not have
> access to any Wicket components but can access Thread local
> properties, such as RequestCycle.get(). I guess we could add a
> behavior to RequestCycle.get().getResponsePage().
> 
> Is this what you are suggesting or there is a more elegant way to
> implement this in Wicket?
> 
> Thanks,
> 
> Alec
> 
> On Mon, Sep 12, 2011 at 5:27 PM, Igor Vaynberg  
> wrote:
>> the problem is when you say "build a url to an instance of this
>> request target" wicket doesnt hold on to the instance, nor does it
>> have any way to recreate it.
>>
>> what you can do is add a behavior to the page and construct a url to
>> that behavior.
>>
>> -igor
>>
>>
>> On Mon, Sep 12, 2011 at 4:16 PM, Alec Swan  wrote:
>>> I don't really need a stable URL. In fact, I would prefer if the link
>>> URL was session or page-specific so that it cannot be accessed by
>>> anybody unless they first accessed the page that contains the link.
>>>
>>> I would like to do something along the lines of the code in my
>>> original post. In other words, I would like to create a new
>>> RequestTarget and get its URL and display that URL to the user.
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>>
>>> On Mon, Sep 12, 2011 at 4:14 PM, Igor Vaynberg  
>>> wrote:
 create a resource and register it in shared resources, this will allow
 you to create a stable url. the filename and reportdata you will have
 to pass on the url.

 -igor

 On Mon, Sep 12, 2011 at 2:25 PM, Alec Swan  wrote:
> Hello,
>
> We use a templating engine which generates parts of our pages.
> Templates can be included on any page. We need the engine to be able
> to generate a link which will display a report when clicked. I tried
> using the following code, but it returns null from
> RequestTarget.urlFor(..):
>
> public String getReportLink() {
>return "" + RequestCycle.get().urlFor(new
> DownloadCsvRequestTarget(fileName, reportData));
> }
>
> Where DownloadCsvRequestTarget implements respond() method to write
> reportData our in CSV format.
>
> Thanks,
>
> Alec
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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


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


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