Example usage for org.springframework.http MediaType TEXT_XML_VALUE

List of usage examples for org.springframework.http MediaType TEXT_XML_VALUE

Introduction

In this page you can find the example usage for org.springframework.http MediaType TEXT_XML_VALUE.

Prototype

String TEXT_XML_VALUE

To view the source code for org.springframework.http MediaType TEXT_XML_VALUE.

Click Source Link

Document

A String equivalent of MediaType#TEXT_XML .

Usage

From source file:com.nebhale.letsmakeadeal.web.GamesController.java

@RequestMapping(method = RequestMethod.POST, value = "/{gameId}/doors/{doorId}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE })
ResponseEntity<Void> modifyDoor(@PathVariable Long gameId, @PathVariable Long doorId,
        @RequestBody Map<String, String> body) throws MissingKeyException, GameDoesNotExistException,
        IllegalTransitionException, DoorDoesNotExistException {
    DoorStatus status = getStatus(body);
    Game game = this.gameRepository.retrieve(gameId);

    if (DoorStatus.SELECTED == status) {
        game.select(doorId);/*  www .  ja v  a 2  s. co m*/
    } else if (DoorStatus.OPEN == status) {
        game.open(doorId);
    } else {
        throw new IllegalTransitionException(gameId, doorId, status);
    }

    return new ResponseEntity<Void>(HttpStatus.OK);
}

From source file:com.mentat.rest.web.GamesController.java

@RequestMapping(method = RequestMethod.PUT, value = "/{gameId}/doors/{doorId}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE })
ResponseEntity<Void> modifyDoor(@PathVariable Integer gameId, @PathVariable Integer doorId,
        @RequestBody Map<String, String> body) throws MissingKeyException, GameDoesNotExistException,
        IllegalTransitionException, DoorDoesNotExistException {
    DoorStatus status = getStatus(body);
    Game game = this.gameRepository.retrieve(gameId);

    if (DoorStatus.SELECTED == status) {
        game.select(doorId);/*from w  ww.j a  v  a 2  s .  c o  m*/
    } else if (DoorStatus.OPEN == status) {
        game.open(doorId);
    } else {
        throw new IllegalTransitionException(gameId, doorId, status);
    }

    return new ResponseEntity<>(HttpStatus.OK);
}

From source file:com.nebhale.springone2013.web.GamesController.java

@RequestMapping(method = RequestMethod.PUT, value = "/{gameId}/doors/{doorId}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = {
        MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE })
ResponseEntity<Void> modifyDoor(@PathVariable Integer gameId, @PathVariable Integer doorId,
        @RequestBody Map<String, String> body) throws MissingKeyException, GameDoesNotExistException,
        IllegalTransitionException, DoorDoesNotExistException {
    DoorStatus status = getStatus(body);
    Game game = this.gameRepository.retrieve(gameId);

    if (DoorStatus.SELECTED == status) {
        game.select(doorId);//  w  w w.j  av  a 2s . com
    } else if (DoorStatus.OPEN == status) {
        game.open(doorId);
    } else {
        throw new IllegalTransitionException(gameId, doorId, status);
    }

    return new ResponseEntity<Void>(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 = "/resetpassword")
public ResetPasswordResponse resetPassword(@RequestBody ResetPasswordRequest resetPasswordRequest,
        HttpServletRequest request, HttpServletResponse response) {
    if (resetPasswordRequest != null) {
        try {/*from  w w  w. j  av  a2s .  c o m*/
            witLoggerService.debug(JaxbHandler.toXml(resetPasswordRequest));
            ResetPasswordResponse resetPasswordResponse = this.accountInformationApiService
                    .resetPassword(resetPasswordRequest);
            if (resetPasswordResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(resetPasswordResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return resetPasswordResponse;
            } 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.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/createpersonalinformation")
public CreatePersonalInformationResponse createPersonalInformation(
        @RequestBody CreatePersonalInformationRequest createPersonalInformationRequest,
        HttpServletRequest request, HttpServletResponse response) {
    if (createPersonalInformationRequest != null) {
        try {//from w w w  .j av  a2  s. c  o  m
            witLoggerService.debug(JaxbHandler.toXml(createPersonalInformationRequest));
            CreatePersonalInformationResponse createPersonalInformationResponse = this.kycInformationApiService
                    .createPersonalInformation(createPersonalInformationRequest);
            if (createPersonalInformationResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(createPersonalInformationResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return createPersonalInformationResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}

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 = "/login")
public LoginResponse login(@RequestBody LoginRequest loginRequest, HttpServletRequest request,
        HttpServletResponse response) {//  w ww  .ja  va 2s . c o m
    if (loginRequest != null) {
        try {
            witLoggerService.debug(JaxbHandler.toXml(loginRequest));
            LoginResponse loginResponse = this.accountInformationApiService.login(loginRequest);
            if (loginResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(loginResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return loginResponse;
            } 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.eureka.v1_0.account.information.api.AccountInformationController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/details")
public GetAccountResponse getAccounts(@RequestBody GetAccountRequest getAccountRequest,
        HttpServletRequest request, HttpServletResponse response) {
    if (getAccountRequest != null) {
        try {/*w  w w. jav a  2  s. c  o  m*/
            witLoggerService.debug(JaxbHandler.toXml(getAccountRequest));
            GetAccountResponse getAccountResponse = this.accountInformationApiService
                    .getAccountDetails(getAccountRequest);
            if (getAccountResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(getAccountResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return getAccountResponse;
            } 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.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/findpersonalinformationbyaccountname")
public FindPersonalInformationByAccountNameResponse findPersonalInformationByAccountName(
        @RequestBody FindPersonalInformationByAccountNameRequest findPersonalInformationByAccountNameRequest,
        HttpServletResponse response, HttpServletRequest request) {
    if (findPersonalInformationByAccountNameRequest != null) {
        try {//from   w w  w. j a  va  2 s. co m
            witLoggerService.debug(JaxbHandler.toXml(findPersonalInformationByAccountNameRequest));
            FindPersonalInformationByAccountNameResponse findPersonalInformationByAccountNameResponse = this.kycInformationApiService
                    .findPersonalInformationByAccountName(findPersonalInformationByAccountNameRequest);
            if (findPersonalInformationByAccountNameResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(findPersonalInformationByAccountNameResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return findPersonalInformationByAccountNameResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}

From source file:org.syncope.core.rest.controller.ConfigurationController.java

@PreAuthorize("hasRole('CONFIGURATION_READ')")
@RequestMapping(method = RequestMethod.GET, value = "/dbexport")
@Transactional(readOnly = true)//from  w ww.  j ava2 s .  c o  m
public void dbExport(final HttpServletResponse response) {
    response.setContentType(MediaType.TEXT_XML_VALUE);
    response.setHeader("Content-Disposition", "attachment; filename=content.xml");

    try {
        importExport.export(response.getOutputStream());

        LOG.debug("Default content successfully exported");
    } catch (Throwable t) {
        LOG.error("While exporting content", t);
    }
}

From source file:com.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/findpersonalinformationbyemail")
public FindPersonalInformationByEmailResponse findPersonalInformationByEmail(
        @RequestBody FindPersonalInformationByEmailRequest findPersonalInformationByEmailRequest,
        HttpServletRequest request, HttpServletResponse response) {
    if (findPersonalInformationByEmailRequest != null) {
        try {/* www .  j a  v a  2 s .  com*/
            witLoggerService.debug(JaxbHandler.toXml(findPersonalInformationByEmailRequest));
            FindPersonalInformationByEmailResponse findPersonalInformationByEmailResponse = this.kycInformationApiService
                    .findPersonalInformationByEmail(findPersonalInformationByEmailRequest);
            if (findPersonalInformationByEmailResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(findPersonalInformationByEmailResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return findPersonalInformationByEmailResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}