List of usage examples for org.springframework.http MediaType TEXT_XML_VALUE
String TEXT_XML_VALUE
To view the source code for org.springframework.http MediaType TEXT_XML_VALUE.
Click Source Link
From source file:com.eureka.v1_0.account.information.api.AccountInformationController.java
@ResponseBody @RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE) public CreateAccountResponse createAccount(@RequestBody CreateAccountRequest createAccountRequest, HttpServletRequest request, HttpServletResponse response) { if (createAccountRequest != null) { try {/*from ww w. j a v a 2 s .c o m*/ CreateAccountResponse createAccountResponse = this.accountInformationApiService .createAccount(createAccountRequest); witLoggerService.debug(JaxbHandler.toXml(createAccountRequest)); if (createAccountResponse != null) { witLoggerService.debug(JaxbHandler.toXml(createAccountResponse)); response.setStatus(HttpServletResponse.SC_OK); return createAccountResponse; } else { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); } } catch (Exception ex) { witLoggerService.warn(ex); ex.printStackTrace(); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return null; }
From source file:com.castlemock.web.mock.soap.web.soap.controller.SoapServiceController.java
/** * The service is responsible for handling all the incoming SOAP requests. The SOAP requests will be processed * and a response will be generated and returned to the service consumer. * @param projectId The id of the project that the request belongs to * @param request The incoming request that will be processed * @param response The outgoing response * @return Returns a mocked response/*from w ww .ja v a2 s . c o m*/ * @see SoapProject * @see SoapOperation * @see SoapMockResponse */ @ResponseBody @RequestMapping(method = RequestMethod.POST, value = "/{projectId}/**", produces = { MediaType.TEXT_XML_VALUE }) public String postMethod(@PathVariable final String projectId, final HttpServletRequest request, final HttpServletResponse response) { return process(projectId, request, response); }
From source file:com.nebhale.letsmakeadeal.web.GamesController.java
@RequestMapping(method = RequestMethod.GET, value = "/{gameId}", produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE }) ResponseEntity<GameResource> showGame(@PathVariable Long gameId) throws GameDoesNotExistException { Game game = this.gameRepository.retrieve(gameId); GameResource resource = this.gameResourceAssembler.toResource(game); return new ResponseEntity<GameResource>(resource, HttpStatus.OK); }
From source file:com.mentat.rest.web.GamesController.java
@RequestMapping(method = RequestMethod.GET, value = "/{gameId}", produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE }) ResponseEntity<Resource<Game>> showGame(@PathVariable Integer gameId) throws GameDoesNotExistException { Game game = this.gameRepository.retrieve(gameId); Resource<Game> resource = this.gameResourceAssembler.toResource(game); return new ResponseEntity<>(resource, HttpStatus.OK); }
From source file:com.nebhale.springone2013.web.GamesController.java
@RequestMapping(method = RequestMethod.GET, value = "/{gameId}", produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE }) ResponseEntity<Resource<Game>> showGame(@PathVariable Integer gameId) throws GameDoesNotExistException { Game game = this.gameRepository.retrieve(gameId); Resource<Game> resource = this.gameResourceAssembler.toResource(game); return new ResponseEntity<Resource<Game>>(resource, HttpStatus.OK); }
From source file:com.eureka.v1_0.account.information.api.AccountInformationController.java
@ResponseBody @RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/resettoken") public CreateResetPasswordTokenResponse createResetPasswordToken( @RequestBody CreateResetPasswordTokenRequest createResetPasswordTokenRequest, HttpServletRequest request, HttpServletResponse response) { if (createResetPasswordTokenRequest != null) { try {/*from w w w . ja v a 2s.co m*/ witLoggerService.debug(JaxbHandler.toXml(createResetPasswordTokenRequest)); CreateResetPasswordTokenResponse createResetPasswordTokenResponse = this.accountInformationApiService .createResetPasswordToken(createResetPasswordTokenRequest); if (createResetPasswordTokenResponse != null) { witLoggerService.debug(JaxbHandler.toXml(createResetPasswordTokenResponse)); response.setStatus(HttpServletResponse.SC_OK); return createResetPasswordTokenResponse; } else { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); } } catch (Exception ex) { witLoggerService.warn(ex); ex.printStackTrace(); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return null; }
From source file:com.nebhale.letsmakeadeal.web.GamesController.java
@RequestMapping(method = RequestMethod.GET, value = "/{gameId}/doors", produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE }) ResponseEntity<DoorsResource> showDoors(@PathVariable Long gameId) throws GameDoesNotExistException { Game game = this.gameRepository.retrieve(gameId); DoorsResource resource = this.doorsResourceAssembler.toResource(game); return new ResponseEntity<DoorsResource>(resource, HttpStatus.OK); }
From source file:com.mentat.rest.web.GamesController.java
@RequestMapping(method = RequestMethod.GET, value = "/{gameId}/doors", produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE }) ResponseEntity<Resources<Resource<Door>>> showDoors(@PathVariable Integer gameId) throws GameDoesNotExistException { Game game = this.gameRepository.retrieve(gameId); Resources<Resource<Door>> resource = this.doorsResourceAssembler.toResource(game); return new ResponseEntity<>(resource, HttpStatus.OK); }
From source file:com.nebhale.springone2013.web.GamesController.java
@RequestMapping(method = RequestMethod.GET, value = "/{gameId}/doors", produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE }) ResponseEntity<Resources<Resource<Door>>> showDoors(@PathVariable Integer gameId) throws GameDoesNotExistException { Game game = this.gameRepository.retrieve(gameId); Resources<Resource<Door>> resource = this.doorsResourceAssembler.toResource(game); return new ResponseEntity<Resources<Resource<Door>>>(resource, HttpStatus.OK); }
From source file:edu.mayo.cts2.framework.webapp.service.ServiceBuilder.java
@SuppressWarnings("unchecked") protected <T extends edu.mayo.cts2.framework.model.service.core.BaseService> T buildBaseServiceMetadata( edu.mayo.cts2.framework.service.profile.BaseService cts2Service, Class<T> serviceMetadataBeanClass) { T service = this.newInstance(serviceMetadataBeanClass); service.setImplementationType(ImplementationProfile.IP_REST); service.setDefaultFormat(new FormatReference(MediaType.TEXT_XML_VALUE)); service.addSupportedFormat(new FormatReference(MediaType.TEXT_XML_VALUE)); service.addSupportedFormat(new FormatReference(MediaType.APPLICATION_JSON_VALUE)); String serviceName = cts2Service.getServiceName(); if (serviceName == null) { serviceName = cts2Service.getClass().getSimpleName(); }/*from w ww . j a va 2 s . c o m*/ service.setServiceName(serviceName); SourceReference provider = cts2Service.getServiceProvider(); if (provider == null) { provider = new SourceReference(UNSPECIFIED); } service.setServiceProvider(provider); String version = cts2Service.getServiceVersion(); if (version == null) { version = UNSPECIFIED; } service.setServiceVersion(version); OpaqueData description = cts2Service.getServiceDescription(); if (description == null) { description = ModelUtils.createOpaqueData( //TODO: Maybe add a little more pizazz to the default description... "A CTS2 Development Framework Service Implementation."); } service.setServiceDescription(description); List<DocumentedNamespaceReference> namespaces = cts2Service.getKnownNamespaceList(); if (CollectionUtils.isEmpty(namespaces)) { namespaces = Arrays.asList(new DocumentedNamespaceReference()); } service.setKnownNamespace(namespaces); for (ProfileElement profile : ServiceUtils .buildProfileElements((Class<? extends Cts2Profile>) cts2Service.getClass(), this.urlConstructor)) { service.addSupportedProfile(profile); } return service; }