12.07.2015 Views

Anyframe CXF Plugin

Anyframe CXF Plugin

Anyframe CXF Plugin

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

RESTful Services+ movieId);InputStream in = url.openStream();String response = getStringFromInputStream(in);JAXBContext jaxbContext = JAXBContext.newInstance("anyframe.sample.domain");Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();Movie movie = (Movie) unmarshaller.unmarshal(new InputSource(new StringReader(response)));}request.setAttribute("movie", movie);}return new ModelAndView("/WEB-INF/jsp/cxf/movie/viewMovie.jsp");@RequestMapping("/cxfListMovie.do")public ModelAndView list(HttpServletRequest request) throws Exception {GetMethod get = new GetMethod("http://localhost:8080/anyframe.sample.cxf.restful/ws/movieservice/movies/");HttpClient httpclient = new HttpClient();String response = "";try {httpclient.executeMethod(get);response = get.getResponseBodyAsString();} finally {get.releaseConnection();}JAXBContext jaxbContext = JAXBContext.newInstance("anyframe.sample.domain");Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();anyframe.sample.domain.Movies movies = (Movies) unmarshaller.unmarshal(new InputSource(new StringReader(response)));}request.setAttribute("movieList", movies.getMovies());return new ModelAndView("/WEB-INF/jsp/cxf/movie/listMovie.jsp");@RequestMapping("/cxfDeleteMovie.do")public String deleteUser(@RequestParam("movieId") String movieId)throws Exception {DeleteMethod delete = new DeleteMethod("http://localhost:8080/anyframe.sample.cxf.restful/ws/movieservice/movie/"+ movieId);try {new HttpClient().executeMethod(delete);} finally {delete.releaseConnection();}return "/cxfListMovie.do";}중략...54

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!