Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Http implementation - #361

Merged
andreamlin merged 42 commits into
googleapis:gax-httpjsonfrom
andreamlin:http_implementation
Aug 31, 2017
Merged

Http implementation#361
andreamlin merged 42 commits into
googleapis:gax-httpjsonfrom
andreamlin:http_implementation

Conversation

@andreamlin

Copy link
Copy Markdown
Contributor

Starting implementation for HTTP/JSON.

This was tested by using the surface generated from https://github.com/googleapis/toolkit/tree/discogapic to list, get, insert, and delete Compute Address resources in a live Google Cloud project.

@andreamlin
andreamlin requested review from garrettjonesgoogle and removed request for garrettjonesgoogleAugust 25, 2017 18:09
@andreamlin
andreamlin changed the base branch from master to gax-httpjsonAugust 25, 2017 18:10
@codecov-io

codecov-io commented Aug 25, 2017

Copy link
Copy Markdown

Codecov Report

Merging #361 into gax-httpjson will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@## gax-httpjson #361 +/- ##
===============================================
Coverage 76.65% 76.65% Complexity 494 494 ===============================================
Files 114 114 Lines 2540 2540 Branches 185 185 ===============================================
Hits 1947 1947 Misses 522 522 Partials 71 71
Impacted FilesCoverage ΔComplexity Δ
...n/java/com/google/api/gax/paging/AbstractPage.java71.73% <100%> (ø)11 <1> (ø)⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74089be...6db8201. Read the comment docs.

@andreamlin

Copy link
Copy Markdown
ContributorAuthor

PTAL

GoogleCredentials defaultCredentials = null;
if (googleCredentials == null) {
try {
defaultCredentials = GoogleCredentials.getApplicationDefault();

This comment was marked as spam.

This comment was marked as spam.

responseFuture.set(response);

} catch (IOException e) {
e.printStackTrace(System.err);

This comment was marked as spam.

This comment was marked as spam.

ResponseT response =
methodDescriptor.parseResponse(
new InputStreamReader(httpResponse.getContent()));
responseFuture.set(response);

This comment was marked as spam.

This comment was marked as spam.

// Return a map where each entry is the name of a path param mapped to the value of the param.
Map<String, String> getPathParams(MessageFormatT apiMessage, Set<String> paramNames);

// Write out the inner request body of the given message.

This comment was marked as spam.

This comment was marked as spam.

PATCH,
POST,
PUT,
TRACE;

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

* [suffix] is any string; if length greater than 0, it should begin with '/'.
* This String format is applied to a serialized ResourceName to create the relative endpoint path.
*/
public abstract String endpointPathTemplate();

This comment was marked as spam.

This comment was marked as spam.

Set<String> pathParams,
Set<String> queryParams,
HttpRequestFormatter httpRequestFormatter,
HttpMethod httpMethod) {

This comment was marked as spam.

This comment was marked as spam.

Comment threadgax-httpjson/build.gradle Outdated
libraries.jsr305,
libraries.autovalue,
libraries.threetenbp,
libraries.apiClient,

This comment was marked as spam.

This comment was marked as spam.

import java.util.Set;

/** Utility class to parse ApiMessages into various HTTP request parts. */
public class ApiMessageHttpRequestFormatter implements HttpRequestFormatter<ApiMessage> {

This comment was marked as spam.

This comment was marked as spam.

import java.util.Set;

/** Interface for classes that create parts of Http requests from a parameterized message. */
public interface HttpRequestFormatter<MessageFormatT> {

This comment was marked as spam.

This comment was marked as spam.

@andreamlin

Copy link
Copy Markdown
ContributorAuthor

Addressed comments.
PTAL

return new Builder<>();
}

public static class Builder<RequestT, ResponseT> {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


public final Builder<RequestT, ResponseT> toBuilder() {
return new Builder<>();
}

This comment was marked as spam.

This comment was marked as spam.

private final ImmutableList<HttpJsonHeaderEnhancer> headerEnhancers;
private final SettableApiFuture responseFuture;

public HttpRequestRunnable(

This comment was marked as spam.

This comment was marked as spam.

} catch (IOException e) {
responseFuture.setException(e);
}
} catch (Exception e) {

This comment was marked as spam.

This comment was marked as spam.

import java.util.Map;

/** A runnable object that creates and executes an HTTP request. */
public class HttpRequestRunnable<RequestT, ResponseT> implements Runnable {

This comment was marked as spam.

This comment was marked as spam.

Set<String> pathParams,
Set<String> queryParams,
HttpRequestFormatter httpRequestFormatter,
String httpMethod) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

PATCH,
POST,
PUT,
TRACE;

This comment was marked as spam.

this.headerEnhancers = ImmutableList.copyOf(headerEnhancers);

HttpTransport httpTransport = new NetHttpTransport();
this.httpTransport = httpTransport;

This comment was marked as spam.

This comment was marked as spam.

@andreamlin

Copy link
Copy Markdown
ContributorAuthor

Addressed comments.
PTAL

@garrettjonesgooglegarrettjonesgoogle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andreamlin
andreamlin merged commit 5e4a386 into googleapis:gax-httpjsonAug 31, 2017
@andreamlin
andreamlin deleted the http_implementation branch August 31, 2017 04:42
garrettjonesgoogle pushed a commit to garrettjonesgoogle/gax-java that referenced this pull request Oct 18, 2017
Starting implementation for HTTP/JSON.
This was tested by using the surface generated from https://github.com/googleapis/toolkit/tree/discogapic to list, get, insert, and delete Compute Address resources in a live Google Cloud project.
garrettjonesgoogle pushed a commit that referenced this pull request Oct 31, 2017
Starting implementation for HTTP/JSON.
This was tested by using the surface generated from https://github.com/googleapis/toolkit/tree/discogapic to list, get, insert, and delete Compute Address resources in a live Google Cloud project.
garrettjonesgoogle pushed a commit that referenced this pull request Oct 31, 2017
Starting implementation for HTTP/JSON.
This was tested by using the surface generated from https://github.com/googleapis/toolkit/tree/discogapic to list, get, insert, and delete Compute Address resources in a live Google Cloud project.
andreamlin added a commit to andreamlin/gax-java that referenced this pull request Mar 15, 2018
correct license on MockHttpService
remove unused de/serialization methods in ApiMethodDescriptor
comments
comments for MockHttpService
Bootstrapping gax-httpjson (googleapis#355)
Http implementation (googleapis#361)
Starting implementation for HTTP/JSON.
This was tested by using the surface generated from https://github.com/googleapis/toolkit/tree/discogapic to list, get, insert, and delete Compute Address resources in a live Google Cloud project.
Retry and failure-handling logic for http-json (googleapis#363)
Exception handling and retry logic for http calls.
Merge master (googleapis#364)
Merge in updates from the master branch.
new HttpApiExceptionFactory that uses googleapis/rpc/code.proto to map http status codes to wrapper exception types
RetryTest passes
removed HttpJsonApiException.java
no longer need to check status code when catching specific apiexception
???
removed unused file
adding Struct class
comments
moving ResourceName stuff to ApiMessage
pushing ResourceNameStruct into ApiMethodDescriptor and out of ApiMessage
add license
getFieldValue() updated
remove resourcenamestruct and replace with new resourcenamefactory class; this depends on api-common PR
formatting
apimessage.getFieldSTringValue doesn't throw IOException
ResourseNameFactory uses parse() instead of parseFrom()
no need to declare throws IllegalArgumentException"
setSerializer->setMethodDescriptor
fix license header
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@andreamlin@codecov-io@garrettjonesgoogle