List of usage examples for org.springframework.http MediaType TEXT_HTML_VALUE
String TEXT_HTML_VALUE
To view the source code for org.springframework.http MediaType TEXT_HTML_VALUE.
Click Source Link
From source file:controller.SeatController.java
@RequestMapping(value = "/list/cancel/id/{id}/availability/{availability}/name/{name}", method = RequestMethod.PUT, produces = MediaType.TEXT_HTML_VALUE, consumes = MediaType.TEXT_HTML_VALUE) public @ResponseBody String cancel(@PathVariable Integer id, @PathVariable String availability, @PathVariable String name) { String response = ""; String storedName = userService.getPlaceName(id); try {//from w w w . j a va 2s . c o m if (storedName.equals(name)) { userService.cancelAvailability(id, availability); response = "{\"notify\":\"succes\",\"id\":\"" + id_play + "\"}"; template.convertAndSend("/channel/seats", response); response = "succes"; } else if (storedName.equals("")) { response = "Seat not reserved!"; } else if (!storedName.equals(name)) { response = "Not your seat!"; } } catch (AppException | MessagingException e) { response = "Exception:" + e.getMessage(); } return response; }
From source file:org.jutge.joc.porra.controller.desktop.DesktopSignupController.java
@ReCaptchaConsumer @EntityStashManaged/*from ww w .jav a2 s . co m*/ @RequestMapping(value = "/apuntar-se", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.TEXT_HTML_VALUE) public String signupPost(@RequestBody final MultiValueMap<String, String> dataMap, final Locale locale, final HttpServletRequest request) { this.logger.info("DesktopSignupController.signupPost"); // handle params final String name = dataMap.getFirst("usr"); final String email = dataMap.getFirst("mil"); request.setAttribute("usr", name); request.setAttribute("mil", email); final Boolean validRecaptcha = (Boolean) request.getAttribute(ReCaptchaUtils.RECAPTCHA_IS_VALID); this.validateSignupParams(name, email, validRecaptcha, locale); // try saving new account final Account account = new Account(); account.setName(name.trim()); account.setEmail(email.trim()); this.accountService.createAccount(account); this.emailService.sendActivationMail(account); return "/desktop/signup/signup-done"; }
From source file:org.hobsoft.contacts.server.controller.ContactsController.java
@RequestMapping(value = "/contact/{id}", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE) public ModelAndView get(@PathVariable long id) { Contact contact = contactRepository.get(id); Map<String, Object> model = new HashMap<>(); model.put("contact", contactResourceAssembler.toResource(contact)); return new ModelAndView("contact/contactView", model); }
From source file:org.awesomeagile.integrations.hackpad.HackpadClientTest.java
@Test(expected = RuntimeException.class) public void testUpdateHackpadFailure() { String newContent = "<html><body>This is a new content</body></html>"; String padId = RandomStringUtils.randomAlphanumeric(16); mockServer.expect(requestTo("http://test/api/1.0/pad/" + padId + "/content")) .andExpect(method(HttpMethod.POST)).andExpect(header(HTTP.CONTENT_TYPE, MediaType.TEXT_HTML_VALUE)) .andExpect(content().string(newContent)) .andRespond(withSuccess("{\"success\": false}", MediaType.APPLICATION_JSON)); client.updateHackpad(new PadIdentity(padId), newContent); }
From source file:de.otto.mongodb.profiler.web.OpProfileController.java
@Page(mainNavigation = MainNavigation.DATABASES) @RequestMapping(value = "/{id:.+}", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE) public ModelAndView showOpProfile(@PathVariable("connectionId") final String connectionId, @PathVariable("databaseName") final String databaseName, @PathVariable("id") final String id, Locale locale) throws ResourceNotFoundException { final ProfiledDatabase database = requireDatabase(connectionId, databaseName); final OpProfile profile = requireProfile(database, id); final OpProfilePageViewModel viewModel = new OpProfilePageViewModel(profile, database, locale); return new ModelAndView("page.op-profile").addObject("model", viewModel); }
From source file:org.hobsoft.contacts.server.controller.ContactsController.java
@RequestMapping(value = "/contact/{id}/delete", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE) public ModelAndView deleteForm(@PathVariable long id) { Contact contact = contactRepository.get(id); Map<String, Object> model = new HashMap<>(); model.put("contact", contactResourceAssembler.toResource(contact)); return new ModelAndView("contact/contactDelete", model); }
From source file:org.bozzo.ipplan.web.SubnetController.java
@RequestMapping(value = "/{subnetId}", method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE }) @ApiIgnore/*from w ww . j ava2 s.c o m*/ public ModelAndView getSubnetView(@PathVariable @NotNull Integer infraId, @PathVariable Long subnetId, @RequestParam(required = false) RequestMode mode) { HttpEntity<SubnetResource> subnet = this.getSubnet(infraId, subnetId, mode); ModelAndView view = new ModelAndView("subnet"); view.addObject("id", subnetId); view.addObject("object", subnet.getBody()); return view; }
From source file:de.otto.mongodb.profiler.web.CollectionProfileController.java
@Page(mainNavigation = MainNavigation.DATABASES) @RequestMapping(value = "/{collectionName:.+}", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE) public ModelAndView showCollectionProfile(@PathVariable("connectionId") final String connectionId, @PathVariable("databaseName") final String databaseName, @PathVariable("collectionName") final String collectionName, Locale locale) throws ResourceNotFoundException { final ProfiledDatabase database = requireDatabase(connectionId, databaseName); final CollectionProfile profile = getProfilerService().getCollectionProfiler(database) .getProfile(collectionName); if (profile == null) { throw new ResourceNotFoundException( String.format("No profile found for collection [%s]!", collectionName)); }/*from w w w . j av a 2s . co m*/ final CollectionProfilePageViewModel viewModel = new CollectionProfilePageViewModel(profile, database, locale); return new ModelAndView("page.collection-profile").addObject("model", viewModel); }
From source file:edu.sjsu.cmpe275.lab2.controller.ManageOrgController.java
@RequestMapping(value = "/{id}", method = RequestMethod.GET, params = "format=html", produces = MediaType.TEXT_HTML_VALUE) public String getOrganizationHtml(@PathVariable("id") long id, Model model) { Organization organization = orgDao.get(id); if (organization == null) { return "error404"; } else {//from w w w . j av a 2s.co m model.addAttribute("org", organization); return "org"; } }