Monday, April 9, 2012

Spring Social Google First Milestone Is Out



I'm happy to announce that the first milestone of Spring Social Google is out! Since the project started I received a lot of feedback from the community that helped shape this milestone and I would like to thank everyone who helped with suggestions, bug reports, patches and kind words.

This milestone includes integration with Google+, Portable Contacts and Google Tasks. It also lets you integrate with the GData Java Client Library, letting you use Spring Social Google for authentication and authorization, and applying the OAuth2 access token to an instance of a GData client. Please see the reference manual for usage instructions.

The example application demonstrates most of the available functionality. You can see it in action here.

To use Spring Social Google in a maven project, add the following repository and dependency to your pom.xml :

<repository>
    <id>spring.social.google</id>
    <name>Spring Social Google</name>
    <url>https://github.com/GabiAxel/maven/raw/master/</url>
</repository>

...

<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-google</artifactId>
    <version>1.0.0.M1</version>
</dependency>


or download the JAR here.

The project roadmap mostly depends on community feedback. Integration with more Google APIs will be added and you can help decide which will be first, so let me know what you think.

Enjoy using Spring Social Google!

30 comments:

  1. Hi,I find that the emails of googleplus's friends are always null.May be the reason is that the portable contacts do not return email address.And Google now suggest Contacts V3 to replace the portable Contacts. Can you add it?

    ReplyDelete
  2. Hi Gerald,

    Actually I started with GData Contacts V3, but it had its own problems, to name a few: the contact and group IDs are specific to the logged in user, the picture URL requires authentication, and working with Atom is very cumbersome.

    Indeed Google+ API is not complete yet, and Google Portable Contacts has been deprecated. Google considers using PoCo format for the Contacts and G+ APIs, and when it does I will update the library.

    If you want to work with GData API, you may integrate Google's Java client libraries with Spring Social Google by instantiating a subclass of Service (eg. ContactsService) and sending it to Google.applyAuthentication() method.

    ReplyDelete
  3. Thanks for your suggestion, I will try integrating GData and Spring Social Google.

    ReplyDelete
  4. Hi,
    Thanks for the great work. I am running into a slight problem.
    If I want to make un-authenticated calls to Google+ I can instantiate an GoogleTemplate with the default constructor. However, when I try to access any public info, I get a 403 forbidden error.

    I was wondering that in the case of un-authenticated access, one still needs to provide the API key. But I cant figure out how that is accomplished.

    Thanks

    ReplyDelete
  5. Thanks for this release.
    I'm using this version of spring-social-google but when I make an activities search I'm getting null Content, when I do "List activityList = page.getItems();" all Activity objects in List doesn't have content property. I post a more detailed description of this in http://forum.springsource.org/showthread.php?130602-Spring-Social-Web-Activity-object-without-content-when-Accessing-with-OAuth2

    Could you help me with this?

    ReplyDelete
  6. Hi, I can't seem to access email addresses from Persons anymore. Also getting 404s on open social endpoints, so I'm assuming that they are end of life. Just wondering how to get the email addresses from Persons that you retrieve through your network (or gmail inbox)

    ReplyDelete
    Replies
    1. Hi mschipperheyn,
      To work with Google Contacts, use GData Java Library, and you can use Google.applyAuthentication() to use Spring Social's authentication mechanism with it.

      Delete
    2. Ok, I had a look at that. Not the most user friendly library. I'm also not entirely sure why this isn't part of Spring Social Google anymore. Is there a specific reason for using GData to do parts of the interaction with Google or is it more of an "I haven't gotten around to it yet"

      Delete
    3. I decided to include integration only to new JSON-based APIs. At the time PoCo was in experimental stage and I hoped it would become stable but it got deprecated, so it's out of the library too.
      The GData APIs are so much more complex than the new JSON ones (understand that it's not the Java library that is complex, it's the API itself) that I didn't see a benefit in integrating with them (after working with them for a while), and providing a generic integration with the GData Java library seems like the best solution.

      Delete
    4. Right, it's a shame really that the ease of use of the library on some key features (for me) has disappeared. Some small code examples to get started would be appreciated. Thanks

      Delete
    5. There is an example in the manual for use of applyAuthentication() https://github.com/GabiAxel/spring-social-google/wiki/Spring-Social-Google-Reference-Manual use it with GData Contacts Java library.

      Delete
  7. Hi Garbiel,

    Love your work. Currently trying to use the DriveOperations component of library.

    public DriveFile upload(Resource resource, DriveFile metadata, UploadParameters parameters)

    I'm not a Spring GURU, but how can we easily convert a file uploaded via [input type="file"] to a Spring Resource?

    Some code examples would be greatly appreciated. Happy to contribute it back to doco/quickstart

    ReplyDelete
    Replies
    1. Hi SurtaX,

      The most convenient way in my opinion to do upload with SpringMVC is to add MultipartFile parameter to your controller method. MultipartFile has getBytes() and getInputStream() methods which you can use with the constructors of ByteArrayResource and InputStreamResource.

      <input type="file" name="myfile"/>

      @RequestMapping(method=POST)
      public void uploadMethod(MultipartFile myfile) {
      Resource resource = new InputStreamResource(myfile.getInputStream());
      }

      Delete
    2. Brilliant. I'll give that a go, thanks for the response!

      Again thanks for the awesome work. Having lots of fun with Spring Social Google :D

      Delete
    3. Arghh sorry to trouble you again. But I'm hitting into a Mimetype issue when trying to upload. Here's my code and server log:
      Resource resource = new InputStreamResource(uploadItem.getFileData().getInputStream());
      DriveOperations drive = google.driveOperations();
      UploadParameters params = new UploadParameters();
      DriveFile.Builder builder = new DriveFile.Builder();
      builder.setTitle("Test FileName").setDescription("description").setMimeType("application/octet-stream");
      drive.upload(resource, builder.build(), params);

      Delete
    4. java.lang.NullPointerException

      at javax.activation.MimetypesFileTypeMap.getContentType(MimetypesFileTypeMap.java:307)
      at org.springframework.http.converter.ResourceHttpMessageConverter$ActivationMediaTypeFactory.getMediaType(ResourceHttpMessageConverter.java:130)
      at org.springframework.http.converter.ResourceHttpMessageConverter.getDefaultContentType(ResourceHttpMessageConverter.java:71)
      at org.springframework.http.converter.ResourceHttpMessageConverter.getDefaultContentType(ResourceHttpMessageConverter.java:1)
      at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:167)
      at org.springframework.http.converter.FormHttpMessageConverter.writePart(FormHttpMessageConverter.java:306)
      at org.springframework.http.converter.FormHttpMessageConverter.writeParts(FormHttpMessageConverter.java:270)
      at org.springframework.http.converter.FormHttpMessageConverter.writeMultipart(FormHttpMessageConverter.java:260)
      at org.springframework.http.converter.FormHttpMessageConverter.write(FormHttpMessageConverter.java:200)
      at org.springframework.http.converter.FormHttpMessageConverter.write(FormHttpMessageConverter.java:1)
      at org.springframework.web.client.RestTemplate$HttpEntityRequestCallback.doWithRequest(RestTemplate.java:588)
      at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:436)
      at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401)
      at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:377)
      at org.springframework.social.google.api.drive.impl.DriveTemplate.upload(DriveTemplate.java:136)
      at org.springframework.social.quickstart.HomeController.create(HomeController.java:614)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)

      Delete
  8. I recently saw an oauth popup that in stead of the standard Google version contained a Google+ specific version, allowing you to notify friends in certain circles etc. I wonder if something like this is possible with spring social google?

    ReplyDelete
    Replies
    1. I assume you are referring to App Activities, or Moments ( https://developers.google.com/+/api/latest/moments ), and yes I am working on this for the coming milestone.

      Delete
  9. Hi there,

    The link to the example application on github and the link to the live example gives a 404 error? Are they available from somewhere else?

    ReplyDelete
  10. Hi,

    is this project still currently mantained?

    ReplyDelete
  11. I am using spring social,in this facebook and twitter apis are creating/updating record in userconnection table but this google api doesn't,and providinng error not connected to goole.
    can u please tell me the reason?

    ReplyDelete
  12. I admit, I have not been on this web page in a long time... however it was another joy to see It is such an important topic and ignored by so many, even professionals. I thank you to help making people more aware of possible issues. Buy Nagative Google Reviews

    ReplyDelete
  13. Great post full of useful tips! My site is fairly new and I am also having a hard time getting my readers to leave comments. Analytics shows they are coming to the site but I have a feeling “nobody wants to be first”. social work recruitment agency

    ReplyDelete
  14. I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. tips to grow followers

    ReplyDelete
  15. I might want to thank you for the endeavors you have made in composing this article. I am trusting the same best work from you later on too.. centrifugal pump

    ReplyDelete
  16. A debt of gratitude is in order for imparting decent data to us. I like your post and all you share with us is exceptional and very enlightening, I might want to bookmark the page so I can come here again to peruse you, as you have made a magnificent showing. en uygun uçak bileti

    ReplyDelete
  17. I havent any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. Ngwa Visa Canada

    ReplyDelete
  18. https://padmawatiextrusion.com/aluminium-pipe
    It's fantastic for me to have a website that is beneficial to my understanding. Thank you, admin.
    padmawatiextrusion4@gmail.com

    ReplyDelete
  19. I was eager to find this page. I needed to thank you for ones time for this especially awesome read!! I certainly truly preferred all aspects of it and I likewise have you book-set apart to look at new data in your blog.

    home insurance quotes

    ReplyDelete
  20. If you bet on "red," you win if the ball comes to relaxation in one of many red pockets. The 666 strategy certainly one of the|is among the|is doubtless considered one of the} roulette methods you must to} avoid at all costs. It's an expensive way to play roulette (you want at least of|no less than} $66 per spin) and it 다 파벳 우회 주소 would not provide great possibilities to win. Although these roulette bets don't result in mind-blowing wins, preserving your bets on the odds/even, red/black, and high/low gives you the best possibilities to attain a win. It might sound unimportant but, when you play roulette games at a brick-and-mortar on line casino, it's good follow to certain you|ensure you|be positive to} get together with the other players already within the sport. All of them provide free and actual money roulette games and, most significantly, all of them have been vetted by the PokerNews editorial team.

    ReplyDelete