Re: How to invalidate session after panel replacement?

2010-12-11 Thread bht
Thanks Ernesto.

It is doable without JavaScript:

WebRequestCycle requestCycle = (WebRequestCycle) RequestCycle.get();
WebRequest webRequest = (WebRequest) requestCycle.getRequest();
HttpServletRequest httpServletRequest =
webRequest.getHttpServletRequest();
httpServletRequest.getSession().setMaxInactiveInterval(5);

It is not perfect, and I thought that Wicket, depending so heavily on
the session, would provide a means to destroy it after use.

Regards,

Bernard


On Fri, 10 Dec 2010 11:08:58 +0100, you wrote:

>Bernard,
>
>There was someone asking something similar a few day ago... One idea
>that might work is
>
>-Put an ajax behavior on your page (AbstractDefaultAjaxBehavior) and
>use it to generate a callback url.
>-Use a non wicket AJAX (e.g. jquery AJAX) to call this behavior.
>-Make your panel call back this behavior when it is loaded. E.g make
>it implement IHeaderContributor and on
>
>public void renderHead(IHeaderResponse response)
>{
>   response.renderOnDomReadyJavascript("Put your AJAX call here!");
>}
>I think you can't use wicket AJAX because it will redirect you if you
>invalidate the session.
> -On the AbstractDefaultAjaxBehavior.respond(AjaxRequestTarget target)
>invalidate your session.
>
>Regards.
>
>Ernesto
>
>
>On Fri, Dec 10, 2010 at 9:47 AM,   wrote:
>> Hi,
>>
>> I need to invalidate the web session after a panel of the current page
>> is replaced.
>>
>> All my attempts are failing because webSession.invalidate() or even
>> webSession.replaceSession(); have an influence on the current
>> request/response.
>>
>> Typically, one would just show a new page, e.g.
>>
>> Session.invalidate();
>> setResponsePage(...);
>>
>> but I don't have this option.
>>
>> Is there any hook that I can use to expire the session after the work
>> on the current page is done? It is quite tricky because the page that
>> is loaded back into the browser with redirect after post needs the
>> session to replace the panel.
>>
>> I have tried this but it doesn't work:
>>
>> replacedPanel.getPage().add(new AbstractBehavior(){
>>    private boolean lastTime = false;
>>   �...@override
>>    public void detach(Component component) {
>>        super.detach(component);
>>        if(lastTime){
>>            AuthenticatedWebSession webSession =
>> (AuthenticatedWebSession)Session.get();
>>            webSession.replaceSession();
>>        }else{
>>            lastTime = true;
>>        }
>>    }
>> });
>> replacedPanel.replaceWith(newPanel);
>>
>> Many thanks,
>>
>> Bernard
>>
>>
>> -
>> 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: Saving an Excel file using WebResource

2010-12-11 Thread drf

This worked:

@Override 
public IResourceStream getResourceStream() {
   HSSFWorkbook workbook = getExcelWorkbook(new HSSFWorkbook());
   byte[] bai = workbook.getBytes();
   ByteArrayResource bar = new ByteArrayResource("application/vnd.ms-excel",
bai);
   return bar.getResourceStream();
} 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Saving-an-Excel-file-using-WebResource-tp3083581p3083657.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: wicket-velocity velocimacro.library

2010-12-11 Thread richard emberson

Funny, just yesterday I was trying to get wicket-velocity to work.
So, I downloaded the velocity source and went code spelunking.
The singleton, org.apache.velocity.app,Velocity,
has a method setProperty which, if set before the init
method is called, allows you to override the velocimacro.library
property.
The Velocity.init method is called in 
org.apache.wicket.velocity.Initializer which, in turn,

is created and call from Application.scala (the wicket.properties
file contains: initializer=org.apache.wicket.velocity.Initializer
which is read by Application.scala). Now, Application.scala
does this work from the call to its initApplication method.
So, if you set the Velocity property before calling
Application.initApplication it should work.

I said, should, since this is not what I did; I simply commented
out the line
velocimacro.library = VM_global_library.vm
in the velocity.properties file.

An alternative is to find the VM_global_library.vm file in the
Velocity distribution (under test/templates) and put it where
it can be loaded. Again, I did not do this.

Richard

On 12/10/2010 08:08 PM, fachhoch wrote:


I want to use   wicketstuff  yui  and this has dependency on wicket-velocity
, this was failing my application becasue of property

velocimacro.library = VM_global_library.vm



its working after  disabling the property , I disabled the porperty by
modifying the velocity.property from the jar wicket-velocity.jar  , Please
tell me how to remove this  property programatically.


--
Quis custodiet ipsos custodes

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



Re: Remove busy indicator from ajax timer behavior?

2010-12-11 Thread fachhoch

 please tell me more  on what javascript flag my polling behavior should set, 
are there any examples ?

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Remove-busy-indicator-from-ajax-timer-behavior-tp2195698p3083221.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



multi-window support, pagestores and wicket 1.5

2010-12-11 Thread Michal Kurtak
Hi folks,

I know that there has been a lot of written about pagestores and
multi-window support in wicket 1.5, but i have several other
questions:

1. Is multi-window supported for non-versioned pages?

If page is versioned everything works ok, but i always get
StalePageExceptions when i use multiple windows/tabs with
non-versioned pages.
I think that StalePageException is useful in some cases when you wanna
be sure that user has same page in all windows, but in older versions
of wicket it was possible to have non versioned pages and multi-window
support together (e.g. we have an application written in wicket 1.2.6
that uses non-versioned pages in multiple windows)

2. How page stores work in clustered environment?

In older versions of wicket we used pagemaps stored in HttpSession.
When one node in cluster refuses to handle request, it was
successfully handled by another nod, because HttpSession was
replicated to another node. We have used non-versioned pages (no back
button support needed) and in one pagemap there was max 5 pages.
Wicket provided this functionality out-of-box.

3. How to achieve this in wicket 1.5?

I have found PersistentPageManager which uses IPageStore to store
pages. Pages are stored on disk by default, but there is also thread
safe SerializedPagesCache with SoftReferences. Theres no out-of-box
solution to store pages in HttpSession.

I have also found file page-management.txt in org.apache.wicket.page
package. It contains proposal of other pagamanagers and multi-window
support for non-versioned pages.

The proposal contains classes

PersistentPageManager with DiskPageStore and
SecondLevelCacheSessionStore for versioned pages
SessionManager for holding non versioned pages in HttpSession.

4. Can we expect that this proposal will be implemented in wicket 1.5
final version?

Thanks for your replies.

BR,
Michal Kurtak

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



Re: StalePageException and AJAX possible bug

2010-12-11 Thread Martin Grigorov
Yes, please.
Create a ticket with a quickstart.
Even better - with a patch ;-)

On Sat, Dec 11, 2010 at 10:26 AM, Michal Kurtak wrote:

> Hi,
>
> I have encountered a problem when using not versioned page with AJAX
> in multiple tabs/windows .
>
> Suppose I have ajax link which changes its model in non versioned
> page. I open the same page in new tab/window and click on the link.
> When i click the link in the first tab/window i get javascript error
>
> Wicket.Ajax: Wicket.Ajax.Call.failure: Error while parsing response:
> Could not find root  element
> This occurs because theres a hole page rendered in response
> (ajax-response element is missing)
>
> Should i create JIRA issue or is this a known bug?
>
> BR,
> Michal
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


StalePageException and AJAX possible bug

2010-12-11 Thread Michal Kurtak
Hi,

I have encountered a problem when using not versioned page with AJAX
in multiple tabs/windows .

Suppose I have ajax link which changes its model in non versioned
page. I open the same page in new tab/window and click on the link.
When i click the link in the first tab/window i get javascript error

Wicket.Ajax: Wicket.Ajax.Call.failure: Error while parsing response:
Could not find root  element
This occurs because theres a hole page rendered in response
(ajax-response element is missing)

Should i create JIRA issue or is this a known bug?

BR,
Michal

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