Re: Close Browser Behavior

2014-03-17 Thread Daniela L
Hi,
I have solved the problem, overriding valueUnbound in my custom session and
updating the database
with my @SpringBeans works when the session is expiring. My problem was
that I was using data
from my session in the @Repository Dao impl class like this:
MyCustomSession.get() and that issued the "There is no application attached
to current thread ContainerBackgroundProcessor" exception.
Many thanks for the help.
Best regards
Daniela


2014-03-14 14:51 GMT+01:00 Daniela L :

> Hi Martin,
> it is definitely a problem in my code :-))
> But unfortunately I do not understand how to update the database at that
> stage using
> @SpringBean? Is that impossible? Do I have to do this outside Wicket using
> a HttpSessionListener?
> I also tryid to make my custom session implement
> HttpSessionBindingListener and override valueUnbound
> but that makes no difference. Is there a example for this anywhere, that
> seems to be such a common use case?
> Best Regards
> Daniela
>
>
> 2014-03-13 15:40 GMT+01:00 Martin Grigorov :
>
> Hi,
>>
>> Maybe it is a problem in your code ;-)
>>
>>  In case of session expiration this method is called in a non-worker
>> thread, i.e.
>>  * there are no thread locals exported for the Application, RequestCycle
>> and Session.
>>  * The Session is the current instance. The Application can be found by
>> using
>>  * {@link Application#get(String)}. There is no way to get a reference to
>> a
>> RequestCycle
>>  */
>> public void onInvalidate()
>> {
>> }
>>
>> The javadoc clearly says that when this method is called by the web
>> container due to session expiration there are no thread locals.
>> The thread locals are available in #onInvalidate() only if the application
>> code called Session#invalidate[Now]() explicitly.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>>
>>
>> On Thu, Mar 13, 2014 at 4:34 PM, Daniela L  wrote:
>>
>> > Hi Martin,
>> > if found the reason why the data is not freed in onInvalidate,
>> > the Spring/Hibernate update to the database issues a "There is no
>> > application attached to current thread
>> > ContainerBackgroundProcessor[StandardEngine[Catalina]]". Is this a
>> wicket
>> > or a tomcat issue?
>> > Best Regards
>> > Daniela
>> >
>> >
>> > 2014-03-12 14:31 GMT+01:00 Martin Grigorov :
>> >
>> > > On Wed, Mar 12, 2014 at 3:20 PM, Daniela L 
>> wrote:
>> > >
>> > > > Hi Martin,
>> > > > thank you very much for your quick and brilliant answer :-)
>> > > > Changing to AjaxCheckBox did the trick.
>> > > > It seems to be very difficult to provide a secure way to invalidate
>> > user
>> > > > data
>> > > > cross browser compliant. I noticed that using a tablet with android
>> or
>> > > IOS
>> > > > the
>> > > > beforeunload is not triggered at all. Therefor I added a cleanup
>> method
>> > > to
>> > > > the onInvalidate
>> > > > of my custom session which should be triggered by the tomcats
>> > > > session-timeout, but
>> > > > it seems using mobile devices onInvalidate is not triggered?
>> > > >
>> > >
>> > > onInvalidate() is called by the server when the client hasn't
>> > touched/used
>> > > its http session for session-timeout minutes.
>> > > It shouldn't matter whether it is a desktop or mobile client.
>> > >
>> > >
>> > > > Best Regards
>> > > > Daniela
>> > > >
>> > > >
>> > > > 2014-03-12 13:21 GMT+01:00 Martin Grigorov :
>> > > >
>> > > > > Hi,
>> > > > >
>> > > > > On Wed, Mar 12, 2014 at 1:15 PM, Daniela L 
>> > > wrote:
>> > > > >
>> > > > > > Hi,
>> > > > > > I am using a close browser behavior to clean up user data if the
>> > user
>> > > > > > closes
>> > > > > > the browser window. I also use a CheckBox to toggle the
>> visibility
>> > of
>> > > > > some
>> > > > > > Textfields. Unfortunately the refresh through the click of the
>> > > CheckBox
>> > > > > > triggers the close browser
>> > > > > > behavior. How can this be avoided?
>> > > > > > Here is what I did (with wicket 6.12.0):
>> > > > > >
>> > > > > >
>> > > > > > customerFirstName = new
>> > > > RequiredTextField("customer.firstName");
>> > > > > > customerFirstName.setOutputMarkupPlaceholderTag(true);
>> > > > > > closeBrowserBehavior =  new AbstractDefaultAjaxBehavior() {
>> > > > > >@Override
>> > > > > > protected void respond(AjaxRequestTarget target) {
>> > > > > >
>> > > > > > AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent();
>> > > > > > }
>> > > > > >
>> > > > > > @Override
>> > > > > > public void renderHead(Component component,
>> > > IHeaderResponse
>> > > > > > response) {
>> > > > > > super.renderHead(component, response);
>> > > > > > response.render(new
>> > > > > >
>> > OnDomReadyHeaderItem("window.onbeforeunload =
>> > > > > > function (e) {"
>> > > > > > + "if (!window.dontAsk) {"
>> > > > > > + "Wicket.Ajax.get({u:
>> > > > > > '"+getCallbackUrl()+"', async: false});"
>> > > > >

Re: Link to Wicket page from Javascript

2014-03-17 Thread Bruce Lombardi
Thanks, tis is very helpful.

Bruce

Sent from my iPad

> On Mar 17, 2014, at 4:52 AM, Ernesto Reinaldo Barreiro  
> wrote:
> 
> You can see it at work here
> 
> http://107.170.4.97:9080/client-sign-out-demo/
> 
> 
> On Mon, Mar 17, 2014 at 9:18 AM, Ernesto Reinaldo Barreiro <
> reier...@gmail.com> wrote:
> 
>> Martin,
>> 
>> What I mean is something that triggers the sign out before serve side
>> session expires... and trigger this expire event.
>> 
>> 
>> https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.java
>> 
>> https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.js
>> 
>> The above seem to work. You use it as in
>> 
>> 
>> https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out-demo/src/main/java/com/antilia/HomePage.java
>> 
>> 
>> 
>> 
>> On Mon, Mar 17, 2014 at 9:11 AM, Martin Grigorov wrote:
>> 
>>> Hi,
>>> 
>>> On Fri, Mar 14, 2014 at 9:25 PM, Ernesto Reinaldo Barreiro <
>>> reier...@gmail.com> wrote:
>>> 
 Hi,
 
 I would implement this as..
 
 1- A JS function that counts how much time has passed since last AJAX
 request. Once a certain threshold is passed an AJAX request is sent to
>>> the
 page.
 2- An AbstractAjaxBehavior that is added to the page. I would use it as
 context for AJAX request on 1).
>>> 
>>> at that time the session should be already expired.
>>> 
>>> But this can be used to do what is needed here - Wicket will redirect to
>>> the configured PageExpiredErrorPage.
>>> 
>>> 
 3- On the respond of AJAXBehavior you redirect to  SessionTimeoutPage
>>> and
 invalidate the session.
 
 
 
 On Fri, Mar 14, 2014 at 8:07 PM, Bruce Lombardi 
 wrote:
 
> Hi,
> 
> 
> 
> An earlier question I asked about session timeouts was answered by
>>> Martin
> Grigorov. I am implementing his suggestion and have a JQuery script
>>> what
> sets a timer that times out after a certain period of inactivity. The
> timeout triggers a function call.  Currently,  for a quick test,  I
>>> have
> that function use location.href to go to an arbitrary static web page
 like
> this:
> 
> 
> 
> function whenUserIdle(){
> 
>location.href = 'http://www.natural-environment.com';
> 
> }
> 
> 
> 
> That works fine, but now I need to make it go to a Wicket page in my
> application, similar to what would happen if I had an anchor tag like:
> 
> 
> 
> SessionTimeoutPage
> 
> 
> 
> But I can't figure out how to do this in the javascript function. Can
> anyone
> tell me how to call the Wicket page from the javascript function?
>>> 
>>> You can use  and a
>>> Label("expirationUrl", "window.expirePageUrl ='" +
>>> urlFor(SessionTimeoutPage.class) + "';");
>>> Then use it with: location.href = window.expirePageUrl';
>>> 
>>> 
> 
> 
> 
> Thanks,
> 
> 
> 
> Bruce
 
 
 --
 Regards - Ernesto Reinaldo Barreiro
>> 
>> 
>> 
>> --
>> Regards - Ernesto Reinaldo Barreiro
> 
> 
> 
> -- 
> Regards - Ernesto Reinaldo Barreiro

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



Re: Testing a panel in isolation (component id not found).

2014-03-17 Thread Jens Jahnke
On Mon, 17 Mar 2014 13:58:59 +0200
Martin Grigorov  wrote:

MG> This method doesn't add the children components.
MG> So trying to render this panel (via #startComponentInPag(panelInstance))
MG> will fail because there are HTML elements with wicket:id in the markup
MG> which have no Java counterparts.

*ouch* Stupid me. Thanks for pointing that out.

Regards,

Jens

-- 
17. Lenzing 2014, 13:03
Homepage : http://www.wegtam.com

Death is a spirit leaving a body, sort
of like a shell leaving the nut behind.
-- Erma Bombeck


pgpz_UQ6p7BjM.pgp
Description: PGP signature


Re: Testing a panel in isolation (component id not found).

2014-03-17 Thread Martin Grigorov
OK,

I think I understand now.

Martin Grigorov
Wicket Training and Consulting


On Mon, Mar 17, 2014 at 1:31 PM, Jens Jahnke  wrote:

> Hi,
>
> On Mon, 17 Mar 2014 13:05:57 +0200
> Martin Grigorov  wrote:
>
> MG> This is the right way.
> MG> Can you show us the code that causes this error ?
> MG> #startComponentInPage() should not fail with such error ...
>
> the exception is thrown at the line with tester.startComponentInPage,
> but here is the code of my custom panel:
>
> public class MyCustomPanel extends Panel {
> protected String name = "";
> protected String icon = "";
> protected String genre = "";
> protected String description = "";
>
> public MyCustomPanel(String id, IModel model) {
> super(id, model);
> prepareDefaultVariables(model.getObject());
> }
>
> protected void prepareDefaultVariables(MyDataModel data) {
>

This method doesn't add the children components.
So trying to render this panel (via #startComponentInPag(panelInstance))
will fail because there are HTML elements with wicket:id in the markup
which have no Java counterparts.


> name = data.getName();
> icon = data.getIconName();
> genre = data.getGenre();
> description = data.getDescription();
> }
>
> protected void renderDefaultVariables() {
> add(new Label("name", name));
> PackageResourceReference iconRef = new
> PackageResourceReference(getClass(), icon);
> add(new Image("icon", iconRef));
> add(new Label("genre", genre));
> add(new Label("description", description));
> }
> }
>
> BTW: I'm using wicket 6.12 and are currently unable to upgrade to 6.14. :-|
>
> Regards,
>
> Jens
>
> --
> 17. Lenzing 2014, 12:19
> Homepage : http://www.wegtam.com
>
> SAFETY
> I can live without
> Someone I love
> But not without
> Someone I need.
>


Re: Testing a panel in isolation (component id not found).

2014-03-17 Thread Jens Jahnke
On Mon, 17 Mar 2014 13:38:29 +0200
Martin Grigorov  wrote:

MG> I meant the test code that leads to the exception.

Okay, here it is:

private WicketTester tester;

@Before
public void setUp() throws Exception {
tester = new WicketTester(new MyApplication());
}

@Test
public void testRenderPanel() throws Exception {
MyDataModel d = new MyDataModel("name", "icon.png", "genre", "description");
Panel info = new MyCustomPanel("id", new LoadableDataModel(d));
tester.startComponentInPage(info);
}

And thanks for the hints regarding the other code. I'll rework it accordingly.

Regards,

Jens

-- 
17. Lenzing 2014, 12:46
Homepage : http://www.wegtam.com

We are all in the gutter, but some of us are looking at the stars.
-- Oscar Wilde


pgpuwyr7OUxgv.pgp
Description: PGP signature


Re: Testing a panel in isolation (component id not found).

2014-03-17 Thread Martin Grigorov
Hi,

I meant the test code that leads to the exception.


On Mon, Mar 17, 2014 at 1:31 PM, Jens Jahnke  wrote:

> Hi,
>
> On Mon, 17 Mar 2014 13:05:57 +0200
> Martin Grigorov  wrote:
>
> MG> This is the right way.
> MG> Can you show us the code that causes this error ?
> MG> #startComponentInPage() should not fail with such error ...
>
> the exception is thrown at the line with tester.startComponentInPage,
> but here is the code of my custom panel:
>
> public class MyCustomPanel extends Panel {
> protected String name = "";
> protected String icon = "";
> protected String genre = "";
> protected String description = "";
>
> public MyCustomPanel(String id, IModel model) {
> super(id, model);
> prepareDefaultVariables(model.getObject());
>

This is usually not good.
You better pass the model itself to the children components and let them
pull their values when really needed (e.g. at render phase).


> }
>
> protected void prepareDefaultVariables(MyDataModel data) {
> name = data.getName();
> icon = data.getIconName();
> genre = data.getGenre();
> description = data.getDescription();
> }
>
> protected void renderDefaultVariables() {
> add(new Label("name", name));
>

e.g. replace with:
add(new Label("name", new PropertyModel(getDefaultModel(), "name"));


> PackageResourceReference iconRef = new
> PackageResourceReference(getClass(), icon);
> add(new Image("icon", iconRef));
> add(new Label("genre", genre));
> add(new Label("description", description));
> }
> }
>
> BTW: I'm using wicket 6.12 and are currently unable to upgrade to 6.14. :-|
>
> Regards,
>
> Jens
>
> --
> 17. Lenzing 2014, 12:19
> Homepage : http://www.wegtam.com
>
> SAFETY
> I can live without
> Someone I love
> But not without
> Someone I need.
>


Re: Testing a panel in isolation (component id not found).

2014-03-17 Thread Jens Jahnke
Hi,

On Mon, 17 Mar 2014 13:05:57 +0200
Martin Grigorov  wrote:

MG> This is the right way.
MG> Can you show us the code that causes this error ?
MG> #startComponentInPage() should not fail with such error ...

the exception is thrown at the line with tester.startComponentInPage, 
but here is the code of my custom panel:

public class MyCustomPanel extends Panel {
protected String name = "";
protected String icon = "";
protected String genre = "";
protected String description = "";

public MyCustomPanel(String id, IModel model) {
super(id, model);
prepareDefaultVariables(model.getObject());
}

protected void prepareDefaultVariables(MyDataModel data) {
name = data.getName();
icon = data.getIconName();
genre = data.getGenre();
description = data.getDescription();
}

protected void renderDefaultVariables() {
add(new Label("name", name));
PackageResourceReference iconRef = new 
PackageResourceReference(getClass(), icon);
add(new Image("icon", iconRef));
add(new Label("genre", genre));
add(new Label("description", description));
}
}

BTW: I'm using wicket 6.12 and are currently unable to upgrade to 6.14. :-|

Regards,

Jens

-- 
17. Lenzing 2014, 12:19
Homepage : http://www.wegtam.com

SAFETY
I can live without
Someone I love
But not without
Someone I need.


pgpkvJDO2pdn8.pgp
Description: PGP signature


Re: Testing a panel in isolation (component id not found).

2014-03-17 Thread Martin Grigorov
Hi,

This is the right way.
Can you show us the code that causes this error ?
#startComponentInPage() should not fail with such error ...

Martin Grigorov
Wicket Training and Consulting


On Mon, Mar 17, 2014 at 1:00 PM, Jens Jahnke  wrote:

> Hi,
>
> I'm trying to test a panel in isolation using `startComponentInPage(C)`.
> The test goes as follows:
>
> MyDataModel d = ...
> Panel p = new MyCustomPanel("id", new LoadableDataModel(d));
> tester.startComponentInPage(p);
>
> Upon execution I get this output:
>
> Unable to find component with id 'id' in [MyCustomPanel [Component id =
> id]]
> Expected: 'id:name'.
> Found with similar names: ''
> MarkupStream: [markup = file:...]
> http://wicket.apache.org";>
>   
> 
>   
> 
> 
>   
>   
> 
> 
>   
> 
>   
> , index = 2, current =  '' (line 0,
> column 0)]
> ...
>
> Is there a way to get the id right or do I have to provide a custom
> page markup for testing?
>
> Regards,
>
> Jens
>
> --
> 17. Lenzing 2014, 11:58
> Homepage : http://www.wegtam.com
>
> This is a country where people are free to practice their religion,
> regardless of race, creed, color, obesity, or number of dangling keys...
>


Testing a panel in isolation (component id not found).

2014-03-17 Thread Jens Jahnke
Hi,

I'm trying to test a panel in isolation using `startComponentInPage(C)`.
The test goes as follows:

MyDataModel d = ...
Panel p = new MyCustomPanel("id", new LoadableDataModel(d));
tester.startComponentInPage(p);

Upon execution I get this output:

Unable to find component with id 'id' in [MyCustomPanel [Component id = id]]
Expected: 'id:name'.
Found with similar names: ''
MarkupStream: [markup = file:...]
http://wicket.apache.org";>
  

  


  
  


  

  
, index = 2, current =  '' (line 0, 
column 0)]
...

Is there a way to get the id right or do I have to provide a custom 
page markup for testing?

Regards,

Jens

-- 
17. Lenzing 2014, 11:58
Homepage : http://www.wegtam.com

This is a country where people are free to practice their religion,
regardless of race, creed, color, obesity, or number of dangling keys...


pgp3tcNjGGLPI.pgp
Description: PGP signature


Re: Link to Wicket page from Javascript

2014-03-17 Thread Ernesto Reinaldo Barreiro
You can see it at work here

http://107.170.4.97:9080/client-sign-out-demo/


On Mon, Mar 17, 2014 at 9:18 AM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> Martin,
>
> What I mean is something that triggers the sign out before serve side
> session expires... and trigger this expire event.
>
>
> https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.java
>
> https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.js
>
> The above seem to work. You use it as in
>
>
> https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out-demo/src/main/java/com/antilia/HomePage.java
>
>
>
>
> On Mon, Mar 17, 2014 at 9:11 AM, Martin Grigorov wrote:
>
>> Hi,
>>
>> On Fri, Mar 14, 2014 at 9:25 PM, Ernesto Reinaldo Barreiro <
>> reier...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > I would implement this as..
>> >
>> > 1- A JS function that counts how much time has passed since last AJAX
>> > request. Once a certain threshold is passed an AJAX request is sent to
>> the
>> > page.
>> > 2- An AbstractAjaxBehavior that is added to the page. I would use it as
>> > context for AJAX request on 1).
>> >
>>
>> at that time the session should be already expired.
>>
>> But this can be used to do what is needed here - Wicket will redirect to
>> the configured PageExpiredErrorPage.
>>
>>
>> > 3- On the respond of AJAXBehavior you redirect to  SessionTimeoutPage
>> and
>> > invalidate the session.
>> >
>> >
>> >
>> > On Fri, Mar 14, 2014 at 8:07 PM, Bruce Lombardi 
>> > wrote:
>> >
>> > > Hi,
>> > >
>> > >
>> > >
>> > > An earlier question I asked about session timeouts was answered by
>> Martin
>> > > Grigorov. I am implementing his suggestion and have a JQuery script
>>  what
>> > > sets a timer that times out after a certain period of inactivity. The
>> > > timeout triggers a function call.  Currently,  for a quick test,  I
>> have
>> > > that function use location.href to go to an arbitrary static web page
>> > like
>> > > this:
>> > >
>> > >
>> > >
>> > > function whenUserIdle(){
>> > >
>> > > location.href = 'http://www.natural-environment.com';
>> > >
>> > > }
>> > >
>> > >
>> > >
>> > > That works fine, but now I need to make it go to a Wicket page in my
>> > > application, similar to what would happen if I had an anchor tag like:
>> > >
>> > >
>> > >
>> > > SessionTimeoutPage
>> > >
>> > >
>> > >
>> > > But I can't figure out how to do this in the javascript function. Can
>> > > anyone
>> > > tell me how to call the Wicket page from the javascript function?
>> >
>>
>> You can use  and a
>> Label("expirationUrl", "window.expirePageUrl ='" +
>> urlFor(SessionTimeoutPage.class) + "';");
>> Then use it with: location.href = window.expirePageUrl';
>>
>>
>> >  >
>> > >
>> > >
>> > > Thanks,
>> > >
>> > >
>> > >
>> > > Bruce
>> > >
>> > >
>> >
>> >
>> > --
>> > Regards - Ernesto Reinaldo Barreiro
>> >
>>
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>



-- 
Regards - Ernesto Reinaldo Barreiro


Re: Link to Wicket page from Javascript

2014-03-17 Thread Ernesto Reinaldo Barreiro
Martin,

What I mean is something that triggers the sign out before serve side
session expires... and trigger this expire event.

https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.java
https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.js

The above seem to work. You use it as in

https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out-demo/src/main/java/com/antilia/HomePage.java




On Mon, Mar 17, 2014 at 9:11 AM, Martin Grigorov wrote:

> Hi,
>
> On Fri, Mar 14, 2014 at 9:25 PM, Ernesto Reinaldo Barreiro <
> reier...@gmail.com> wrote:
>
> > Hi,
> >
> > I would implement this as..
> >
> > 1- A JS function that counts how much time has passed since last AJAX
> > request. Once a certain threshold is passed an AJAX request is sent to
> the
> > page.
> > 2- An AbstractAjaxBehavior that is added to the page. I would use it as
> > context for AJAX request on 1).
> >
>
> at that time the session should be already expired.
>
> But this can be used to do what is needed here - Wicket will redirect to
> the configured PageExpiredErrorPage.
>
>
> > 3- On the respond of AJAXBehavior you redirect to  SessionTimeoutPage and
> > invalidate the session.
> >
> >
> >
> > On Fri, Mar 14, 2014 at 8:07 PM, Bruce Lombardi 
> > wrote:
> >
> > > Hi,
> > >
> > >
> > >
> > > An earlier question I asked about session timeouts was answered by
> Martin
> > > Grigorov. I am implementing his suggestion and have a JQuery script
>  what
> > > sets a timer that times out after a certain period of inactivity. The
> > > timeout triggers a function call.  Currently,  for a quick test,  I
> have
> > > that function use location.href to go to an arbitrary static web page
> > like
> > > this:
> > >
> > >
> > >
> > > function whenUserIdle(){
> > >
> > > location.href = 'http://www.natural-environment.com';
> > >
> > > }
> > >
> > >
> > >
> > > That works fine, but now I need to make it go to a Wicket page in my
> > > application, similar to what would happen if I had an anchor tag like:
> > >
> > >
> > >
> > > SessionTimeoutPage
> > >
> > >
> > >
> > > But I can't figure out how to do this in the javascript function. Can
> > > anyone
> > > tell me how to call the Wicket page from the javascript function?
> >
>
> You can use  and a
> Label("expirationUrl", "window.expirePageUrl ='" +
> urlFor(SessionTimeoutPage.class) + "';");
> Then use it with: location.href = window.expirePageUrl';
>
>
> >  >
> > >
> > >
> > > Thanks,
> > >
> > >
> > >
> > > Bruce
> > >
> > >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> >
>



-- 
Regards - Ernesto Reinaldo Barreiro


Re: Link to Wicket page from Javascript

2014-03-17 Thread Martin Grigorov
Hi,

On Fri, Mar 14, 2014 at 9:25 PM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> Hi,
>
> I would implement this as..
>
> 1- A JS function that counts how much time has passed since last AJAX
> request. Once a certain threshold is passed an AJAX request is sent to the
> page.
> 2- An AbstractAjaxBehavior that is added to the page. I would use it as
> context for AJAX request on 1).
>

at that time the session should be already expired.

But this can be used to do what is needed here - Wicket will redirect to
the configured PageExpiredErrorPage.


> 3- On the respond of AJAXBehavior you redirect to  SessionTimeoutPage and
> invalidate the session.
>
>
>
> On Fri, Mar 14, 2014 at 8:07 PM, Bruce Lombardi 
> wrote:
>
> > Hi,
> >
> >
> >
> > An earlier question I asked about session timeouts was answered by Martin
> > Grigorov. I am implementing his suggestion and have a JQuery script  what
> > sets a timer that times out after a certain period of inactivity. The
> > timeout triggers a function call.  Currently,  for a quick test,  I have
> > that function use location.href to go to an arbitrary static web page
> like
> > this:
> >
> >
> >
> > function whenUserIdle(){
> >
> > location.href = 'http://www.natural-environment.com';
> >
> > }
> >
> >
> >
> > That works fine, but now I need to make it go to a Wicket page in my
> > application, similar to what would happen if I had an anchor tag like:
> >
> >
> >
> > SessionTimeoutPage
> >
> >
> >
> > But I can't figure out how to do this in the javascript function. Can
> > anyone
> > tell me how to call the Wicket page from the javascript function?
>

You can use  and a
Label("expirationUrl", "window.expirePageUrl ='" +
urlFor(SessionTimeoutPage.class) + "';");
Then use it with: location.href = window.expirePageUrl';


>  >
> >
> >
> > Thanks,
> >
> >
> >
> > Bruce
> >
> >
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>


Re: Can't access to the resources bundled in external jar files

2014-03-17 Thread Martin Grigorov
Hi,

Put a breakpoint at
org.apache.wicket.core.request.mapper.BasicResourceReferenceMapper#mapRequest(Request)
and see what happens.
If you are able to reproduce it with a quickstart application then please
attach it to a ticket in Jira and we will check it.

Martin Grigorov
Wicket Training and Consulting


On Sun, Mar 16, 2014 at 5:50 PM, Linh Bui  wrote:

> Hi,
>
> I'm working on a project using Wicket 6.14. I created a separate Maven
> project for all wicket plugins. This project uses JQuery UI 1.9.2. Then, I
> declared this project as a dependency in my main project. After deploying
> to JBoss AS, I noticed that the system generated a HTML file which includes
> the following declarations in :
>
> 
> src="../wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-1.11.0-ver-1392362624000.js"
> type="text/javascript">
> 
> src="../wicket/resource/wicket.plugin.tokeninput.TokenInputAjaxBehavior/resources/jquery-ui-1.9.2.min-ver-1394982966000.js"
> type="text/javascript">
>
> I could retrieve jquery-1.11.0 from the system by accessing to either of
> the following addresses:
>
>
> http://localhost:8080/mysystem-web/wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-1.11.0-ver-1392362624000.js
>
> http://localhost:8080/mysystem-web/wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-1.11.0.js
>
> However, I could only retrieve jquery-ui-1.9.2 from the system by accessing
> to the following address:
>
>
> http://localhost:8080/mysystem-web/wicket/resource/wicket.plugin.tokeninput.TokenInputAjaxBehavior/resources/jquery-ui-1.9.2.min.js
>
> If I access:
>
>
> http://localhost:8080/mysystem-web/wicket/resource/wicket.plugin.tokeninput.TokenInputAjaxBehavior/resources/jquery-ui-1.9.2.min-ver-1394982966000.js
>
> I encounter this error:
>
> HTTP Status 404 - Unable to find resource
> type Status report
> message Unable to find resource
> description The requested resource (Unable to find resource) is not
> available.
> JBoss Web/7.0.13.Final
>
> I have checked my local Maven repository and seen that the artifact for my
> plugin project does include the jquery-ui-1.9.2.js file in the correct
> package (wicket.plugin.tokeninput.resources).
>
> Could any one give me a hint about this issue? Thank you very much.
>


Re: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

2014-03-17 Thread Martin Grigorov
Hi,

On Sun, Mar 16, 2014 at 1:58 AM, lumo  wrote:

> I cant get rid of the message, nor can I log to a file.
>
> 
> Im my pom.xml I have the following dependency:
>
> 
> org.slf4j
> slf4j-log4j12
> 1.7.6
> 
>
> 
> I also include the following jars into my classpath:
>
> log4j-1.2.17.jar
> slf4j-api-1.7.6.jar
> slf4j-log4j12-1.7.6.jar
>
> 
> My log4j.properies is located under WEB-INF/classes and contains the
>

Make sure that log4j.properties is in the produced .war file:
my.war#WEB-INF/classes/
Usually I put it in src/main/resources and Maven copies it in
my.war#WEB-INF/classes/

Also I see a missing 't' in log4j.properies. But maybe this is just a typo
in your mail.


> following:
>
> log4j.rootLogger=DEBUG, INFO
>
> log4j.logger.org.apache.wicket=INFO
> log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
> log4j.logger.org.apache.wicket.version=INFO
> log4j.logger.org.apache.wicket.RequestCycle=INFO
>
> log4j.category.com.googlecode.wicket.jquery.ui.plugins.whiteboard=DEBUG
>
> ### direct log messages to stdout ###
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{dd-mm HH:mm:ss,SSS}
> %p/%c{1}:%L - %m%n
>
> ### direct log messages to slf4j ###
> log4j.appender.file=org.apache.log4j.RollingFileAppender
> log4j.appender.file.maxFileSize=2MB
> log4j.appender.file.maxBackupIndex=5
> log4j.appender.file.File=./checkout.log
> log4j.appender.file.threshold=info
> log4j.appender.file.layout=org.apache.log4j.PatternLayout
> log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
> %m%n
>
> 
> I have no idea what's going on.
>
> Thanks,
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/SLF4J-Failed-to-load-class-org-slf4j-impl-StaticLoggerBinder-tp4664986.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: WildCard URL strategy for E-Commerce Products

2014-03-17 Thread Martin Grigorov
Hi,

Thanks for sharing your solution!

If you use Wicket 1.5+ it will be a bit easier - with your own impl of
IRequestMapper you can read the passed request's url. This Url has
#getSegments() method that returns a list of all path parameters. If the
last segment is "productDetails" then you have to use ProductDetails.class
page. All previous segments are the categories.

Martin Grigorov
Wicket Training and Consulting


On Sun, Mar 16, 2014 at 10:13 AM, Arjun Dhar  wrote:

> Ok, for lack of any conclusive existing solution; the following is what I
> developed and works for the use case described:
>
> Step 1: Create a BookmarkablePageRequestTargetUrlCodingStrategy that can
> accept RegularExpressions:
>
>
> Step 2: The default WebRequestCodingStrategy uses a MountMap that
> unfortunately uses path.startsWith(...) . So we have to write a
> WebRequestCodingStrategy that will make use of Regular Expressions.
>
>
> Step 3: The Strategies have to be called via the WebApplication. Hence in
> ones implementation/extension of WebApplication; do:
>
>
> Now run the App. Sample Run/Demo:
>
> If you define RegexQueryStringUrlCodingStrategy("productDetails",
> "^(.)*productDetails", ProductDetails.class);
>
> Then all the following will work:
> /productDetails
> /AnyCat/productDetails
> /AnySubCat/productDetails
> etc.
>
> Q.E.D
> -Arjun
>
> -
> Software documentation is like sex: when it is good, it is very, very
> good; and when it is bad, it is still better than nothing!
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/WildCard-URL-strategy-for-E-Commerce-Products-tp4664984p4664988.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
>
>