Skip to content

Instantly share code, notes, and snippets.

@tariq1890
Last active February 17, 2016 06:16
Show Gist options
  • Save tariq1890/02d5710971e1f07f427c to your computer and use it in GitHub Desktop.
Save tariq1890/02d5710971e1f07f427c to your computer and use it in GitHub Desktop.
Vamsi Gist
class MovieController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String searchMovie(ModelMap model) {
String movieName=""
model.addAttribute("movieName", "");
return "search";
}
@RequestMapping(value = "/hello", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
public @ResponseBody Object searchMovie() throws IOException {
List < MovieSearchResultObject > movieSearchResult = new ArrayList < MovieSearchResultObject > ();
try {
URL url = new URL("http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=9htuhtcb4ymusd73d4z6jxcj&q=avengers&page_limit=1");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
<html>
<body>
<h2>Sign up for new semester please!</h2>
<form:form method="POST">
<table>
<tr>
<td>Enter your Movie Name:</td>
<td><form:input path="movieName" /></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
<tr>
</table>
</form:form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment