Hi all,

I have a jquery script to comunicate with wicket via ajax. It was working
fine with wicket 1.4.17, until I've migrated to 1.5.10 version.

Now, my AbstractAjaxBehavior it's not called anymore, and the ajax call
receives a 302 moved temporarily.

Here is my code:

javascript/jquery
...
$.ajax({
        url: $('#callBackURL').html(),
        type: 'post',
        cache: false,
        data:id,
        contentType: 'text/plain; charset=utf-8',
        dataType: 'json',
        success: function(json) {
                alert(json);
         },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert("error :"+XMLHttpRequest.responseText);
        }
});
...

html/wicket-tags
...
<label id='callBackURL' wicket:id="callBackURL"
style='display:none'></label>
...

java
...
abstractAjaxBehavior = new AbstractAjaxBehavior(){
        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        public void onRequest()
        {
                System.out.println("ajax detected...");
                //get parameters
                final RequestCycle requestCycle = RequestCycle.get();
                
                WebRequest wr=(WebRequest)requestCycle.getRequest();

                HttpServletRequest hsr = (HttpServletRequest) 
wr.getContainerRequest();
                
                long id = -1;
                try {
                   BufferedReader br = hsr.getReader();
                   String  inputString = br.readLine();  
                  
                   try {
                           id = Long.valueOf(inputString);
                   } catch(Exception ex) { System.out.println("ERROR : 
"+ex.getMessage());
ex.printStackTrace();}
                } catch (IOException ex) {
                        System.out.println(ex);
                }

                System.out.println("creating json for "+id+"...");
                String data=createJSONData(id);
                System.out.println("returning json :"+ data);

                requestCycle.scheduleRequestHandlerAfterCurrent(new
TextRequestHandler("application/json","UTF-8", data));
        }
};
add(abstractAjaxBehavior);
String callBackURL= abstractAjaxBehavior.getCallbackUrl().toString();

add(new Label("callBackURL", callBackURL));
...

Any clue about this???

Regards



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-AbstractAjaxBehavior-302-moved-temporarily-tp4661838.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

Reply via email to