us.monoid.web
Class Resty.Option

java.lang.Object
  extended by us.monoid.web.Resty.Option
Direct Known Subclasses:
Resty.Proxy, Resty.Timeout
Enclosing class:
Resty

public abstract static class Resty.Option
extends Object

Base class for Resty options. You can also create your own options. Override one of the apply methods to change an object like URLConnection before it is being used.

Author:
beders

Constructor Summary
Resty.Option()
           
 
Method Summary
 void apply(URLConnection aConnection)
          Override this to get access to the URLConnection before the actual connection is made.
 void init(Resty resty)
          Callback from Resty when the option is set on the Resty instance.
static Resty.Proxy proxy(String aHostName, int aPortNumber)
          Set a proxy (overrides standard proxy settings)
static Resty.Timeout timeout(int t)
          Specify the connection timeout in milliseconds.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resty.Option

public Resty.Option()
Method Detail

apply

public void apply(URLConnection aConnection)
Override this to get access to the URLConnection before the actual connection is made.

Parameters:
aConnection -

init

public void init(Resty resty)
Callback from Resty when the option is set on the Resty instance. Called before any connection is made. Override to set initial properties


timeout

public static Resty.Timeout timeout(int t)
Specify the connection timeout in milliseconds. Example:
 new Resty(Option.timeout(3000)); 

Parameters:
t - the timeout
Returns:
See Also:
URLConnection.setConnectTimeout(int)

proxy

public static Resty.Proxy proxy(String aHostName,
                                int aPortNumber)
Set a proxy (overrides standard proxy settings)

Parameters:
aHostName - the hostname to use
aPortNumber - the port number


Copyright © 2013. All Rights Reserved.