How can I correctly add (by Ajax) and remove (by Ajax) an AjaxSelfUpdatingTimerBehavior?

2009-11-02 Thread Ambrose Wheatcroft
Hello,

Is it possible to correctly add and then remove an
AjaxSelfUpdatingTimerBehavior from a component, all by Ajax?  At the
moment I'm running into problems - the browser gets a Page Expired
response soon after I remove the behavior.  I think I have an idea why
it doesn't work in its current form - is there any way to get
something similar working?

Thanks,
Ambrose

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



Re: How can I correctly add (by Ajax) and remove (by Ajax) an AjaxSelfUpdatingTimerBehavior?

2009-11-02 Thread Ambrose Wheatcroft
Okay,

So I got it working.  As you suggest - stop() works.  I then also
store the behavior so that it can be removed permanently on a later
Ajax trip.  That way I can keep adding and removing timers with
different intervals.

Thanks!

2009/11/2 Ernesto Reinaldo Barreiro reier...@gmail.com:
 Remember having the same problem with panel and I have dome something like

 for(Object behavior : getBehaviors()) {
 if(behavior instanceof AjaxSelfUpdatingTimerBehavior) {
 remove((AjaxSelfUpdatingTimerBehavior)behavior);
 }
 }
 add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(1000)));
 So, that refresh is delayed a lot... but now that I look to it again I see
 there is an stop() method on AbstractAjaxTimerBehavior.

 Regards,

 Ernesto

 On Mon, Nov 2, 2009 at 12:20 PM, Ambrose Wheatcroft 
 ambrosewheatcr...@gmail.com wrote:

 Hello,

 Is it possible to correctly add and then remove an
 AjaxSelfUpdatingTimerBehavior from a component, all by Ajax?  At the
 moment I'm running into problems - the browser gets a Page Expired
 response soon after I remove the behavior.  I think I have an idea why
 it doesn't work in its current form - is there any way to get
 something similar working?

 Thanks,
 Ambrose

 -
 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



Write XML response

2008-10-28 Thread Ambrose . Wheatcroft
Hello,

I wonder if you can help.  I'm trying to send back some XML from an 
AbstractAjaxBehavior  like this:

public class MyAjaxBehavior extends AbstractAjaxBehavior {

@Override
public void onRequest() {
 
String reply = XML document as String.
RequestCycle.get().setRequestTarget(new 
StringRequestTarget(reply));
 
} 
}

How can I set the response type to text/xml ?  The clients get the 
response okay, but the fact that they don't know it's XML is causing 
problems in Firefox and Chrome.

Many thanks,

JHC 

Ambrose Wheatcroft 
Analyst / Programmer 

Email: [EMAIL PROTECTED]

London office • Cottons Centre, Cottons Lane, London SE1 2QG • Telephone: 
+44 (0)20 7367 6500 • Fax: +44 (0)20 7367 6501 

This message is private and confidential. If you have received this message in 
error, please notify us and remove it from your system. 
This message has been scanned for all known viruses. However, recipients are 
advised to apply their own antivirus detection measures to this message and any 
attachments upon receipt. 

JHC Plc is a limited company registered in England and Wales. Registered 
number: 2243258. Registered office:Canterbury House, 85 Newhall Street, 
Birmingham, B3 1LH, England.  

Re: Write XML response

2008-10-28 Thread Ambrose . Wheatcroft
Hello,

Yes, sorry and thanks - missed the StringRequestTarget(String contentType, 
String charSet, String content) constrcutor.

Thanks again.

JHC 

Ambrose Wheatcroft 
Analyst / Programmer 

Email: [EMAIL PROTECTED]

London office • Cottons Centre, Cottons Lane, London SE1 2QG • Telephone: 
+44 (0)20 7367 6500 • Fax: +44 (0)20 7367 6501 




From:
Igor Vaynberg [EMAIL PROTECTED]
To:
users@wicket.apache.org
Date:
28/10/2008 16:46
Subject:
Re: Write XML response



is it not just a matter of setting the right header?

-igor

On Tue, Oct 28, 2008 at 9:19 AM,  [EMAIL PROTECTED] wrote:
 Hello,

 I wonder if you can help.  I'm trying to send back some XML from an
 AbstractAjaxBehavior  like this:

 public class MyAjaxBehavior extends AbstractAjaxBehavior {

@Override
public void onRequest() {

String reply = XML document as String.
RequestCycle.get().setRequestTarget(new
 StringRequestTarget(reply));

}
 }

 How can I set the response type to text/xml ?  The clients get the
 response okay, but the fact that they don't know it's XML is causing
 problems in Firefox and Chrome.

 Many thanks,

 JHC

 Ambrose Wheatcroft
 Analyst / Programmer

 Email: [EMAIL PROTECTED]

 London office • Cottons Centre, Cottons Lane, London SE1 2QG • 
Telephone:
 +44 (0)20 7367 6500 • Fax: +44 (0)20 7367 6501

 This message is private and confidential. If you have received this 
message in error, please notify us and remove it from your system.
 This message has been scanned for all known viruses. However, recipients 
are advised to apply their own antivirus detection measures to this 
message and any attachments upon receipt.

 JHC Plc is a limited company registered in England and Wales. Registered 
number: 2243258. Registered office:Canterbury House, 85 Newhall Street, 
Birmingham, B3 1LH, England.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





This message is private and confidential. If you have received this message in 
error, please notify us and remove it from your system. 
This message has been scanned for all known viruses. However, recipients are 
advised to apply their own antivirus detection measures to this message and any 
attachments upon receipt. 

JHC Plc is a limited company registered in England and Wales. Registered 
number: 2243258. Registered office:Canterbury House, 85 Newhall Street, 
Birmingham, B3 1LH, England.  

Returning XML to JS

2008-10-21 Thread Ambrose . Wheatcroft
Hi,

What's the nice / correct way to do this in Wicket:

I have a client side bit of JS that looks something like

getData(URL);

It expects to get back an XML document like

data
  entryfoo/entry
  entrybar/entry
/data

On the wicket side, I want the Java object that spits back the XML to be 
part of a component.  This parent component will have supplied the URL in 
question.

Any ideas how I should do this?

Thanks,

Ambrose Wheatcroft
Analyst / Programmer, JHC PLC

+44 (0)20 7367 6500