Package play.libs.ws

Class WSAsync

  • All Implemented Interfaces:
    WSClient
    Direct Known Subclasses:
    DummyWSClient

    @Singleton
    public class WSAsync
    extends java.lang.Object
    implements WSClient
    Simple HTTP client to make webservices requests.

    Get latest BBC World news as a RSS content

     HttpResponse response = WS.url("http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml").get();
     Document xmldoc = response.getXml();
     // the real pain begins here...
     

    Search what Yahoo! thinks of google (starting from the 30th result).

     HttpResponse response = WS.url("http://search.yahoo.com/search?p=%s&pstart=1&b=%s", "Google killed me", "30").get();
     if (response.getStatus() == 200) {
         html = response.getString();
     }
     
    • Constructor Summary

      Constructors 
      Constructor Description
      WSAsync()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      WSRequest newRequest​(java.lang.String url)  
      void stop()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WSAsync

        public WSAsync()