You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2013/09/13 21:50:12 UTC

AJAX event response headers - redirect

We have alot of ajax events in our app.  Wicket makes it very easy to do so. 
However, all of our applications have Novell Access Manager (NAM) in front
of them for single-sign-on.  When the NAM session times out, it sends a
redirect to the browser to bring them to a login page.  But for ajax events
this just means the page breaks.

So I would like to slip some code in to our ajax events as a standard bit of
code to detect ajax responses that contain redirect headers, and issue them
to the page.  However, I am not sure where to hook into such an event in
wicket.  I know how I would do it in naked ajax, but not within wicket.  Can
someone fill me in?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AJAX-event-response-headers-redirect-tp4661308.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AJAX event response headers - redirect

Posted by Martin Grigorov <mg...@apache.org>.
new AnyAjaxBehavior() {

  @Override
  protected void updateAjaxAttributes(AjaxRequestAttributes attrs) {
    super.updateAjaxAttributes(attrs);

    AjaxCallListener listener = new AjaxCallListener();

    // Wicket passes the following parameters to onSuccess listeners:
(attrs, jqXHR, data, textStatus). So:
    listener.onSuccess("alert(jqXHR.getAllResponseHeaders());");

    attrs.getAjaxCallListeners().add(listener);

  }
}


On Sat, Sep 14, 2013 at 5:44 PM, Entropy <bl...@gmail.com> wrote:

> In jQuery:
>
> var ajax = $.ajax({
>     type: "GET",
>     url: 'http://your.site.here/something',
>     success: function () {
>       alert(ajax.getAllResponseHeaders());
>     }
>   });
>
> In just bare bones ajax:
>
> req.onreadystatechange = function (aEvt) {
>        if (this.readyState == 4) {
>             test123 = this.getAllResponseHeaders();
>             }
>       };
>
>
>
> Brian Mulholland
> "For every complex problem, there is an answer that is clear, simple and
> wrong."
> --H.L. Mencken
> "Politics is the art of looking for trouble, finding it everywhere,
> diagnosing it incorrectly, and applying the wrong remedies."
> --Groucho Marx
>
>
> On Sat, Sep 14, 2013 at 12:58 AM, Martin Grigorov-4 [via Apache
> Wicket] <ml...@n4.nabble.com> wrote:
> > how you would do it with naked Ajax?
> > On Sep 13, 2013 10:50 PM, "Entropy" <[hidden email]> wrote:
> >
> >> We have alot of ajax events in our app.  Wicket makes it very easy to do
> >> so.
> >> However, all of our applications have Novell Access Manager (NAM) in
> front
> >> of them for single-sign-on.  When the NAM session times out, it sends a
> >> redirect to the browser to bring them to a login page.  But for ajax
> >> events
> >> this just means the page breaks.
> >>
> >> So I would like to slip some code in to our ajax events as a standard
> bit
> >> of
> >> code to detect ajax responses that contain redirect headers, and issue
> >> them
> >> to the page.  However, I am not sure where to hook into such an event in
> >> wicket.  I know how I would do it in naked ajax, but not within wicket.
> >>  Can
> >> someone fill me in?
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> >>
> http://apache-wicket.1842946.n4.nabble.com/AJAX-event-response-headers-redirect-tp4661308.html
> >> Sent from the Users forum mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
> >
> >
> > ________________________________
> > If you reply to this email, your message will be added to the discussion
> > below:
> >
> http://apache-wicket.1842946.n4.nabble.com/AJAX-event-response-headers-redirect-tp4661308p4661314.html
> > To unsubscribe from AJAX event response headers - redirect, click here.
> > NAML
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AJAX-event-response-headers-redirect-tp4661308p4661319.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: AJAX event response headers - redirect

Posted by Entropy <bl...@gmail.com>.
In jQuery:

var ajax = $.ajax({
    type: "GET",
    url: 'http://your.site.here/something',
    success: function () {
      alert(ajax.getAllResponseHeaders());
    }
  });

In just bare bones ajax:

req.onreadystatechange = function (aEvt) {
       if (this.readyState == 4) {
            test123 = this.getAllResponseHeaders();
            }
      };



Brian Mulholland
"For every complex problem, there is an answer that is clear, simple and wrong."
--H.L. Mencken
"Politics is the art of looking for trouble, finding it everywhere,
diagnosing it incorrectly, and applying the wrong remedies."
--Groucho Marx


On Sat, Sep 14, 2013 at 12:58 AM, Martin Grigorov-4 [via Apache
Wicket] <ml...@n4.nabble.com> wrote:
> how you would do it with naked Ajax?
> On Sep 13, 2013 10:50 PM, "Entropy" <[hidden email]> wrote:
>
>> We have alot of ajax events in our app.  Wicket makes it very easy to do
>> so.
>> However, all of our applications have Novell Access Manager (NAM) in front
>> of them for single-sign-on.  When the NAM session times out, it sends a
>> redirect to the browser to bring them to a login page.  But for ajax
>> events
>> this just means the page breaks.
>>
>> So I would like to slip some code in to our ajax events as a standard bit
>> of
>> code to detect ajax responses that contain redirect headers, and issue
>> them
>> to the page.  However, I am not sure where to hook into such an event in
>> wicket.  I know how I would do it in naked ajax, but not within wicket.
>>  Can
>> someone fill me in?
>>
>>
>>
>> --
>> View this message in context:
>>
>> http://apache-wicket.1842946.n4.nabble.com/AJAX-event-response-headers-redirect-tp4661308.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-wicket.1842946.n4.nabble.com/AJAX-event-response-headers-redirect-tp4661308p4661314.html
> To unsubscribe from AJAX event response headers - redirect, click here.
> NAML




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AJAX-event-response-headers-redirect-tp4661308p4661319.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AJAX event response headers - redirect

Posted by Martin Grigorov <mg...@apache.org>.
how you would do it with naked Ajax?
On Sep 13, 2013 10:50 PM, "Entropy" <bl...@gmail.com> wrote:

> We have alot of ajax events in our app.  Wicket makes it very easy to do
> so.
> However, all of our applications have Novell Access Manager (NAM) in front
> of them for single-sign-on.  When the NAM session times out, it sends a
> redirect to the browser to bring them to a login page.  But for ajax events
> this just means the page breaks.
>
> So I would like to slip some code in to our ajax events as a standard bit
> of
> code to detect ajax responses that contain redirect headers, and issue them
> to the page.  However, I am not sure where to hook into such an event in
> wicket.  I know how I would do it in naked ajax, but not within wicket.
>  Can
> someone fill me in?
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AJAX-event-response-headers-redirect-tp4661308.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>