play.libs.ws
Class WSAsync

java.lang.Object
  extended by play.libs.ws.WSAsync
All Implemented Interfaces:
WS.WSImpl

public class WSAsync
extends java.lang.Object
implements WS.WSImpl

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();
    }
 


Nested Class Summary
static class WSAsync.HttpAsyncResponse
          An HTTP response wrapper
 class WSAsync.WSAsyncRequest
           
 
Constructor Summary
WSAsync()
           
 
Method Summary
 WS.WSRequest newRequest(java.lang.String url, java.lang.String encoding)
           
 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()
Method Detail

stop

public void stop()
Specified by:
stop in interface WS.WSImpl

newRequest

public WS.WSRequest newRequest(java.lang.String url,
                               java.lang.String encoding)
Specified by:
newRequest in interface WS.WSImpl


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly