com.googlecode.jinahya.twitter.xauth
Class SocketRequester

java.lang.Object
  extended by com.googlecode.jinahya.twitter.xauth.SocketRequester
All Implemented Interfaces:
Requester

public class SocketRequester
extends Object

Author:
Jin Kwon

Field Summary
protected static SocketFactory DEFAULT_SSL_SOCKET_FACTORY
          default ssl socket factory.
 
Constructor Summary
SocketRequester()
           
 
Method Summary
protected  void bind(Socket socket)
           
protected  void checkStatus(String statusCode, String reasonPhrase)
          Checks HTTP response status.
protected  void checkStatusLine(String statusLine)
          Checks given statusLine of HTTP response.
protected  void connect(Socket socket, String host, int port)
           
protected  Socket create(String host, int port)
           
protected  Socket create(String protocol, String host, int port)
           
protected  Socket createSSL(String host, int port)
           
 InputStream request(String method, String url, String parameters, String authorization)
          Requests with given arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SSL_SOCKET_FACTORY

protected static final SocketFactory DEFAULT_SSL_SOCKET_FACTORY
default ssl socket factory.

See Also:
SSLSocketFactory.getDefault()
Constructor Detail

SocketRequester

public SocketRequester()
Method Detail

request

public InputStream request(String method,
                           String url,
                           String parameters,
                           String authorization)
                    throws Exception
Description copied from interface: Requester
Requests with given arguments.

Parameters:
method - request method
url - request url
parameters - parameters (already url encoded)
authorization - authorization header value or null.
Returns:
resource stream
Throws:
Exception - if any error occurs

create

protected Socket create(String protocol,
                        String host,
                        int port)
                 throws IOException
Parameters:
protocol -
host -
port -
Returns:
Throws:
IOException

createSSL

protected Socket createSSL(String host,
                           int port)
                    throws IOException
Parameters:
host -
port -
Returns:
Throws:
IOException

create

protected Socket create(String host,
                        int port)
                 throws IOException
Parameters:
host -
port -
Returns:
Throws:
IOException

bind

protected void bind(Socket socket)
             throws IOException
Parameters:
socket -
Throws:
IOException

connect

protected void connect(Socket socket,
                       String host,
                       int port)
                throws IOException
Parameters:
socket -
host -
port -
Throws:
IOException

checkStatusLine

protected void checkStatusLine(String statusLine)
                        throws IOException
Checks given statusLine of HTTP response.

Parameters:
statusLine - status line of HTTP response message.
Throws:
IOException - if statusLine is not OK

checkStatus

protected void checkStatus(String statusCode,
                           String reasonPhrase)
                    throws IOException
Checks HTTP response status.

Parameters:
statusCode - status code
reasonPhrase - reason phrase
Throws:
IOException - if the status is not OK


Copyright © 2011. All Rights Reserved.