public final class

Scheme

extends Object
java.lang.Object
   ↳ org.apache.http.conn.scheme.Scheme

Class Overview

Encapsulates specifics of a protocol scheme such as "http" or "https". Schemes are identified by lowercase names. Supported schemes are typically collected in a SchemeRegistry.

For example, to configure support for "https://" URLs, you could write code like the following:

 Scheme https = new Scheme("https", 443, new MySecureSocketFactory());
 SchemeRegistry.DEFAULT.register(https);
 

Summary

Public Constructors
Scheme(String name, int port, SchemeSocketFactory factory)
Creates a new scheme.
Scheme(String name, SocketFactory factory, int port)
This constructor is deprecated. Use Scheme(String, int, SchemeSocketFactory)
Public Methods
final boolean equals(Object obj)
final int getDefaultPort()
Obtains the default port.
final String getName()
Obtains the scheme name.
final SchemeSocketFactory getSchemeSocketFactory()
Obtains the socket factory.
final SocketFactory getSocketFactory()
This method is deprecated. Use getSchemeSocketFactory()
int hashCode()
final boolean isLayered()
Indicates whether this scheme allows for layered connections.
final int resolvePort(int port)
Resolves the correct port for this scheme.
final String toString()
Return a string representation of this object.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Scheme (String name, int port, SchemeSocketFactory factory)

Also: HttpClient

Creates a new scheme. Whether the created scheme allows for layered connections depends on the class of factory.

Parameters
name the scheme name, for example "http". The name will be converted to lowercase.
port the default port for this scheme
factory the factory for creating sockets for communication with this scheme

public Scheme (String name, SocketFactory factory, int port)

Also: HttpClient

This constructor is deprecated.
Use Scheme(String, int, SchemeSocketFactory)

Creates a new scheme. Whether the created scheme allows for layered connections depends on the class of factory.

Parameters
name the scheme name, for example "http". The name will be converted to lowercase.
factory the factory for creating sockets for communication with this scheme
port the default port for this scheme

Public Methods

public final boolean equals (Object obj)

Also: HttpClient

public final int getDefaultPort ()

Also: HttpClient

Obtains the default port.

Returns
  • the default port for this scheme

public final String getName ()

Also: HttpClient

Obtains the scheme name.

Returns
  • the name of this scheme, in lowercase

public final SchemeSocketFactory getSchemeSocketFactory ()

Also: HttpClient

Obtains the socket factory. If this scheme is layered, the factory implements LayeredSchemeSocketFactory.

Returns
  • the socket factory for this scheme

public final SocketFactory getSocketFactory ()

Also: HttpClient

This method is deprecated.
Use getSchemeSocketFactory()

Obtains the socket factory. If this scheme is layered, the factory implements LayeredSocketFactory.

Returns
  • the socket factory for this scheme

public int hashCode ()

public final boolean isLayered ()

Also: HttpClient

Indicates whether this scheme allows for layered connections.

Returns
  • true if layered connections are possible, false otherwise

public final int resolvePort (int port)

Also: HttpClient

Resolves the correct port for this scheme. Returns the given port if it is valid, the default port otherwise.

Parameters
port the port to be resolved, a negative number to obtain the default port
Returns
  • the given port or the defaultPort

public final String toString ()

Also: HttpClient

Return a string representation of this object.

Returns
  • a human-readable string description of this scheme