Created
January 5, 2016 02:42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WatchlistCallback extends HttpServlet { | |
private static final long serialVersionUID = 1L; | |
private static final String WATCH_LIST_URL = "https://api.tmsandbox.co.nz/v1/MyTradeMe/Watchlist/All.xml"; | |
private final TrademeTemplate trademeTemplate = TrademeTemplate.getInstance(); | |
/** | |
* Step 6: trade me server redirects the user to the callback on the client | |
* | |
* @param request | |
* @param response | |
* @throws IOException | |
*/ | |
@Override | |
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { | |
String oauthVerifier = request.getParameter("oauth_verifier"); | |
trademeTemplate.setUpAccessToken(oauthVerifier); | |
String result = trademeTemplate.call(WATCH_LIST_URL); | |
response.setContentType("application/xml"); | |
PrintWriter out = response.getWriter(); | |
out.println(result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment