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 default transmit functionality #1

Closed
danehammer opened this issue Jan 22, 2013 · 4 comments
Closed

Add default transmit functionality #1

danehammer opened this issue Jan 22, 2013 · 4 comments

Comments

@danehammer
Copy link

The README shows an example that assumes you use Gson to serialize the SquashEntry and transmit it to the squash web service. When getting started using this, it'd be nice to have a class that would do that Gson and transmission work for you.

@JakeWharton
Copy link
Contributor

Serialization and transmission should be a fairly straightforward process. Since this library can be used on the JVM as well as on Android we don't want to make any assumptions as to what serialization library nor HTTP library the client would be using.

If you're using GSON and an implementation of Apache's HttpClient it should be as simple as:

HttpPost p = new HttpPost("http://path/to/squash/endpoint");
p.setEntity(new StringEntity(gson.toJson(entry), "UTF-8"));
client.execute(p);

@danehammer
Copy link
Author

Okay thanks. Took me a little longer to recreate that snippet, but that's where I'm at now. 😄

edenman pushed a commit that referenced this issue Jan 25, 2013
@rouvoy
Copy link

rouvoy commented Mar 22, 2013

Well, this is definitively disappointing as one could use the JSR-330 to inject the HTTP client handler depending on the execution environment (JVM Vs. Android)...

@monperrus
Copy link

I was convinced that squash-java encapsulates the communication with the server. It took us long minutes to understand that it's not the case.

IMHO, the standard transmit code (JVM+GSON) should be included by default (maybe in a documented separate branch).

Best regards, --Martin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants