Topic
  • 3 replies
  • Latest Post - ‏2013-07-22T14:18:16Z by mburati
saii
saii
2 Posts

Pinned topic Redirection from the Web Service not working

‏2013-07-22T12:31:03Z |

Hi,

I need to call a web service(REST) on click of a button, in that service after processing the request it needs to redirect to other portal page by passing some values.

on click of button im calling an ActionList which has a call to service

the code I'm using for redirection :

       URI location = null;
        String url = "http://sample.ibm.com:10039/wps/myportal/Home/rootpage/child/child2/forms ";(all pages has friendly names and url is proper )
        UriBuilder bulder = UriBuilder.fromPath(url);
        bulder.queryParam("Id", "1111111111");
        bulder.queryParam("Name","Name");
        location = bulder.build();
        return Response.seeOther(location).build();

redirection works fine when i directly hit the url from browser but redirection is not happening on click of button,

am i missing anything, please advice.

 

Thanks,

Saikiran V

  • mburati
    mburati
    2575 Posts

    Re: Redirection from the Web Service not working

    ‏2013-07-22T13:42:47Z  

    As of Web Experience Factory 7.0.1 and later, button/link controls by default will attempt to execute an AJAX action behind the scenes and then just update part of the page (partial page refresh, or Smart Refresh).   If you must do an http redirect (not my favorite technique as it increases the # of requests from the browser to the portal), then you likely want to do a full page browser request from that button and not a JS/AJAX request.   To do that,  go to the Button buidler's "Post-Action Behavior" section, select "Show Advanced Options" checkbox and then select the "Always reload the top most page after running acftion" option in the Post-Action Behavior dropdown.

     

    I hope that info helps,
    ..Mike Burati 
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
  • saii
    saii
    2 Posts

    Re: Redirection from the Web Service not working

    ‏2013-07-22T14:02:34Z  
    • mburati
    • ‏2013-07-22T13:42:47Z

    As of Web Experience Factory 7.0.1 and later, button/link controls by default will attempt to execute an AJAX action behind the scenes and then just update part of the page (partial page refresh, or Smart Refresh).   If you must do an http redirect (not my favorite technique as it increases the # of requests from the browser to the portal), then you likely want to do a full page browser request from that button and not a JS/AJAX request.   To do that,  go to the Button buidler's "Post-Action Behavior" section, select "Show Advanced Options" checkbox and then select the "Always reload the top most page after running acftion" option in the Post-Action Behavior dropdown.

     

    I hope that info helps,
    ..Mike Burati 
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.

    Thanks Mike for the quick reply,

    I did select "Post-Action Behavior" as "Always reload the top most page after running action".

    but still redirection not happening.

    to be more clear.

    on click of button calling a method which in turn calls web service.

    web service has redirection code.

     

    Thanks,

    Saikiran V

  • mburati
    mburati
    2575 Posts

    Re: Redirection from the Web Service not working

    ‏2013-07-22T14:18:16Z  
    • saii
    • ‏2013-07-22T14:02:34Z

    Thanks Mike for the quick reply,

    I did select "Post-Action Behavior" as "Always reload the top most page after running action".

    but still redirection not happening.

    to be more clear.

    on click of button calling a method which in turn calls web service.

    web service has redirection code.

     

    Thanks,

    Saikiran V

    Sorry, I think I was (am?) confused as to your use case and flow.   I thought your action list was trying to send back a redirect to the browser after calling the REST service.

    From this latest description it sounds like the browser calls the portlet, which in turn uses the REST service call builder to call a remote REST service and that remote REST service is sending the redirect?   If so, then there's no automatic way for that to go all the way back to the browser and ask the browser to do the redirect.   By default, the REST service call builder is sending an http request and expecting XML or html as a response and then will do something with that response and send it's own page/response back to the browser.   There is a "Follow Redirect" checkbox in the Advanced section of the REST service call builder, but that option is to tell the code under the REST service call builder whether to automatically follow the redirect itself to another site to get the XML/html it's looking for, not an option to forward the redirect back to the originating browser itself.  If you have to send a redirect back to the originating browser that made the initial request, then your method/action needs to do that after calling the REST service.

    I hope that info helps,
    ..Mike Burati 
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.