Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods setRootUrl and setServicePath to JsonHttpClient.Builder #97

Closed
wonderfly opened this issue Jan 9, 2015 · 2 comments
Closed
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@wonderfly
Copy link
Contributor

From yan...@google.com on May 03, 2012 05:45:41

External references, such as a standards document, or specification? http://javadoc.google-http-java-client.googlecode.com/hg/1.8.3-beta/com/google/api/client/http/json/JsonHttpClient.Builder.html#setBaseUrl(com.google.api.client.http.GenericUrl) Java environments (e.g. Java 6, Android 2.3, App Engine, or All)? All Please describe the feature requested. JsonHttpClient.Builder has a setBaseUrl which is a nice general-purpose way to set the base URL of the API. This is often used for testing an API locally before publishing it. It would be convenient to be able to do for example:

setBaseServer("localhost:8888") or
setBaseServer("test.example.com")

The idea is that this will change only the server host and port of the base URL but keep the rest the same.

Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=97

@wonderfly wonderfly added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. imported priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jan 9, 2015
@wonderfly wonderfly self-assigned this Jan 9, 2015
@wonderfly
Copy link
Contributor Author

From yan...@google.com on May 03, 2012 14:36:29

I think I have a better idea. See for example: https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest Note how it has a rootUrl, servicePath, and baseUrl, where baseUrl = rootUrl + servicePath. There are a few features that require us to know the rootUrl and not just the baseUrl. The most obvious one is Google media uploads, whose URL is rootUrl + "upload/" + servicePath + resourcePath.

Therefore, I propose we add new methods setRootUrl and setServicePath to JsonHttpClient.Builder and deprecate setBaseUrl (similarly for getters). For backwards compatibility, when calling setBaseUrl we should assume that servicePath is always the last two URL path parts of the baseUrl, and rootUrl is baseUrl minus servicePath. However, we should not rely on that assumption in general.

So now to use a local test server, it would be for example:

setRootUrl(new GenericUrl("http://localhost:888") or
setRootUrl(new GenericUrl(" http://test.example.com/something") )

Summary: Add methods setRootUrl and setServicePath to JsonHttpClient.Builder
Cc: ai...@google.com
Labels: Milestone-Version1.10.0

@wonderfly
Copy link
Contributor Author

From rmis...@google.com on May 29, 2012 06:38:14

http://codereview.appspot.com/6258043/

Status: Fixed

clundin25 pushed a commit to clundin25/google-http-java-client that referenced this issue Aug 11, 2022
* Prepare for Release

1. Update versions to 0.7.0
2. Odd no one updated it to 0.7.0-SNAPSHOT earlier

* Update to 0.6.1

Add Rules to README.MD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

1 participant