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 classGitHubConnectorHttpConnectorAdapter.HttpURLConnectionGitHubConnectorResponseInitial 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 GitHubConnectoradapt(HttpConnector connector)Creates a GitHubConnector for an HttpConnector.HttpURLConnectionconnect(URL url)Opens a connection to the given URL.GitHubConnectorResponsesend(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:HttpConnectorOpens a connection to the given URL.- Specified by:
connectin 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:GitHubConnectorSends a request and retrieves a raw response for processing. Implementers ofGitHubConnector.send(GitHubConnectorRequest)process the information from aGitHubConnectorRequestto open an HTTP connection and retrieve a raw response. They then return a class that extendsGitHubConnectorResponsecorresponding their response data. Clients should not implement their ownGitHubConnectorRequest. TheGitHubConnectorRequestprovided by the caller ofGitHubConnector.send(GitHubConnectorRequest)should be passed to the constructor ofGitHubConnectorResponse.- Specified by:
sendin interfaceGitHubConnector- Parameters:
request- the request data to be sent.- Returns:
- a GitHubConnectorResponse for the request
- Throws:
IOException- if there is an I/O error
-
-