Posts

Showing posts from January, 2016

Trade Me API OAuth Java example

Image
Overview Trade Me is the most popular online auction e-commerce website in New Zealand, which features things very much like eBay. As an e-commerce platform, Trade Me provides APIs for third-parties vendors to spark their own ideas on top of Trade Me platform powerhouse. The API reference manual is as follows:  http://developer.trademe.co.nz/ , in the reference, among others, the authentication way on basis of OAuth is very complicated, check the following link for details:  http://developer.trademe.co.nz/api-overview/authentication/example-oauth-flow/ , unfortunately, Trade Me API manual doesn't contain vivid code examples to simplify the understanding. In this article, I will list all of steps with code snippets for Trade Me OAuth flow to make it vigorous in force, therefore, projects which lies on Trade Me API are easy to get started, especially for Java. Please be aware, trade me adopts OAuth 1.0 as authentication mechanism which is not compatible with OAuth...

How to develop Tomcat-based WebSocket application on Heroku

Image
Overview When we want to develop WebSocket application based on Java, Tomcat is a good fit because Tomcat 7 and onwards support WebSocket in default. Nevertheless, Tomcat deployed on Heroku Cloud PaaS needs slight tweaks. There are two existing solutions: Embedded Tomcat :  https://devcenter.heroku.com/articles/create-a-java-web-application-using-embedded-tomcat Webapp Runner :  https://devcenter.heroku.com/articles/java-webapp-runner Unfortunately, those two solutions don't work for WebSocket applications that work under standard tomcat. The Reason why exisiting solutions don't work The critical part makes WebSocket up and running in Tomcat is two jars under lib directory --  websocket-api.jar and  tomcat7-websocket.jar , they are the implementation of JSR 356 , Java API for WebSocket, the link tells the details,  http://www.oracle.com/technetwork/articles/java/jsr356-1937161.html . If we can find those two or stuff like that with regard t...