Example usage for org.springframework.http ResponseEntity ResponseEntity

List of usage examples for org.springframework.http ResponseEntity ResponseEntity

Introduction

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

Prototype

public ResponseEntity(MultiValueMap<String, String> headers, HttpStatus status) 

Source Link

Document

Create a new HttpEntity with the given headers and status code, and no body.

Usage

From source file:edu.eci.arsw.blindway.controller.UsuarioController.java

@RequestMapping(value = "/login/{user}/{pswd}", method = RequestMethod.GET)
public ResponseEntity<?> manejadorPostRecursoUsuario(@PathVariable String user, @PathVariable String pswd) {
    try {/*from   w ww.j a va2  s.co  m*/
        return new ResponseEntity<>(stub.cargarUsuarioLogeado(user, pswd), HttpStatus.ACCEPTED);
    } catch (RegistroUsuarioException ex) {
        return new ResponseEntity<>(ex.getMessage(), HttpStatus.NOT_ACCEPTABLE);
    }
}

From source file:com.melayer.camzia.controller.MeControllerAdmin.java

@RequestMapping(path = "/securityLess", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
public Callable<ResponseEntity<Map<String, Object>>> checkWithoutSecurity() {

    return () -> {

        entityMap.clear();//from   www .  j av a2 s . c  om
        entityMap.put("status", "It is securityless");

        ResponseEntity<Map<String, Object>> entity = new ResponseEntity<>(entityMap, HttpStatus.OK);

        return entity;
    };
}

From source file:gt.dakaik.rest.impl.DocumentTypeImpl.java

@Override
public ResponseEntity<DocumentType> findAll(int idUsuario, String token) throws EntidadNoEncontradaException {
    return new ResponseEntity(repoDocumentType.findAll(), HttpStatus.OK);
}

From source file:com.hp.autonomy.frontend.find.hod.web.HodGlobalExceptionHandler.java

@ExceptionHandler(HodErrorException.class)
@ResponseBody//from   w  w  w  .  j a  v  a 2s.  c o m
public ResponseEntity<HodErrorResponse> hodErrorHandler(final HodErrorException exception) {
    final HodErrorResponse hodErrorResponse = new HodErrorResponse("HOD Error", exception.getErrorCode());

    log.error("Unhandled HodErrorException with uuid {}", hodErrorResponse.getUuid());
    log.error("Stack trace", exception);

    return new ResponseEntity<>(hodErrorResponse,
            exception.isServerError() ? HttpStatus.INTERNAL_SERVER_ERROR : HttpStatus.BAD_REQUEST);
}

From source file:com.digitgroup.fullstackroad.web.controller.EShopController.java

@RequestMapping(value = "/contacts", produces = {
        MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET)
public @ResponseBody ResponseEntity<List<Customer>> getCustomers() {
    List<Customer> customers = customerService.findAll();
    return new ResponseEntity<List<Customer>>(customers, HttpStatus.OK);
}

From source file:com.tribuo.backend.controllers.EspecificosController.java

/**
 *
 * @return/*ww w.  java  2s  .  c o  m*/
 */
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<List<Especificos>> getSubcategorias() {
    List<Especificos> u = se.getEspecificos();
    return new ResponseEntity<>(u, HttpStatus.OK);
}

From source file:com.srinathavan.mwbng.rest.mvc.BlogEntryController.java

/**
 * Method to blog entry data by its id/*from   w w  w  . j a  v  a 2  s .c  o  m*/
 * 
 * @param blogEntryId
 * @return
 */
@RequestMapping(value = "/{blogEntryId}")
public @ResponseBody ResponseEntity<Object> getBlogEntry(@PathVariable Long blogEntryId) {
    BlogEntry blogEntry = blogEntryService.findBlogEntry(blogEntryId);
    if (null != blogEntry) {
        return new ResponseEntity<Object>(blogEntry, HttpStatus.OK);
    } else {
        return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
    }
}

From source file:com.baidu.terminator.manager.action.StubAction.java

@RequestMapping(value = "/{linkId}", method = RequestMethod.GET)
@ResponseBody/*www .ja v a  2s .  c  om*/
public ResponseEntity<List<StubData>> listStubData(@PathVariable int linkId) {
    List<StubData> stubData = stubService.getStubData(linkId);
    return new ResponseEntity<List<StubData>>(stubData, HttpStatus.OK);

}

From source file:com.baidu.stqa.signet.web.action.AuthorityAction.java

/**
 * ??/*from  w  w  w.  j a v a2s.  com*/
 * 
 * @param projectId
 * @param storyId
 * @return
 */
@RequestMapping(value = "/project/{projectId}/story/{storyId}/authority", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity<EditStatus> applyAuthorityAction(@PathVariable long projectId,
        @PathVariable long storyId) {
    doLog(projectId);
    String user = getUser();
    EditStatus es = caseSuiteService.ApplyForEdit(projectId, storyId, user, "");
    return new ResponseEntity<EditStatus>(es, HttpStatus.OK);
}

From source file:hr.foi.rsc.controllers.PersonController.java

/**
 * gets all users from database/*from  ww  w. ja  v a2  s.  com*/
 * @return all users in json format with HTTP 200
 */
@RequestMapping(value = "/", method = RequestMethod.GET)
public ResponseEntity<List<Person>> retrieveAll() {
    Logger.getLogger("PersonController.java").log(Level.INFO,
            "GET on /person -- retrieving full list of users");
    return new ResponseEntity(this.personRepository.findAll(), HttpStatus.OK);
}