Package org.kohsuke.github.internal
Class GitHubConnectorHttpConnectorAdapter
- java.lang.Object
-
- org.kohsuke.github.internal.GitHubConnectorHttpConnectorAdapter
-
- All Implemented Interfaces:
GitHubConnector
,HttpConnector
public final class GitHubConnectorHttpConnectorAdapter extends Object implements GitHubConnector, HttpConnector
Adapts an HttpConnector to be usable as GitHubConnector. For internal use only.- Author:
- Liam Newman
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GitHubConnectorHttpConnectorAdapter.HttpURLConnectionGitHubConnectorResponse
Initial response information supplied when a response is received but before the body is processed.
-
Field Summary
-
Fields inherited from interface org.kohsuke.github.connector.GitHubConnector
DEFAULT, OFFLINE
-
Fields inherited from interface org.kohsuke.github.HttpConnector
DEFAULT, OFFLINE
-
-
Constructor Summary
Constructors Constructor Description GitHubConnectorHttpConnectorAdapter(HttpConnector httpConnector)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GitHubConnector
adapt(HttpConnector connector)
Creates a GitHubConnector for an HttpConnector.HttpURLConnection
connect(URL url)
Opens a connection to the given URL.GitHubConnectorResponse
send(GitHubConnectorRequest request)
Sends a request and retrieves a raw response for processing.
-
-
-
Constructor Detail
-
GitHubConnectorHttpConnectorAdapter
public GitHubConnectorHttpConnectorAdapter(HttpConnector httpConnector)
Constructor.- Parameters:
httpConnector
- the HttpConnector to be adapted.
-
-
Method Detail
-
adapt
@Nonnull public static GitHubConnector adapt(@Nonnull HttpConnector connector)
Creates a GitHubConnector for an HttpConnector. If a well-known static HttpConnector is passed, a corresponding static GitHubConnector is returned.- Parameters:
connector
- the HttpConnector to be adapted.- Returns:
- a GitHubConnector that calls into the provided HttpConnector.
-
connect
@Nonnull public HttpURLConnection connect(URL url) throws IOException
Description copied from interface:HttpConnector
Opens a connection to the given URL.- Specified by:
connect
in interfaceHttpConnector
- Parameters:
url
- the url- Returns:
- the http url connection
- Throws:
IOException
- the io exception
-
send
@Nonnull public GitHubConnectorResponse send(GitHubConnectorRequest request) throws IOException
Description copied from interface:GitHubConnector
Sends a request and retrieves a raw response for processing. Implementers ofGitHubConnector.send(GitHubConnectorRequest)
process the information from aGitHubConnectorRequest
to open an HTTP connection and retrieve a raw response. They then return a class that extendsGitHubConnectorResponse
corresponding their response data. Clients should not implement their ownGitHubConnectorRequest
. TheGitHubConnectorRequest
provided by the caller ofGitHubConnector.send(GitHubConnectorRequest)
should be passed to the constructor ofGitHubConnectorResponse
.- Specified by:
send
in interfaceGitHubConnector
- Parameters:
request
- the request data to be sent.- Returns:
- a GitHubConnectorResponse for the request
- Throws:
IOException
- if there is an I/O error
-
-