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:hr.foi.sis.controllers.PersonController.java

/**
 * gets all users from database/*from  ww w.  j ava  2 s . c om*/
 * @return all users in json format with HTTP 200
 */

@RequestMapping(value = "/", method = RequestMethod.GET)
@PreAuthorize("hasRole('ROLE_ADMIN')")
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);
}

From source file:org.fon.documentmanagementsystem.controllers.rest.RestApiDocumentsController.java

@RequestMapping(path = "{id}", method = RequestMethod.GET)
public ResponseEntity<List<TreeDto>> getDocuments(@PathVariable("id") long id) {
    System.out.println("U restu sam za dokumente");
    Aktivnost a = activityService.findOne(id);
    List<TreeDto> data = new ArrayList<>();
    if (a.getDokumentList().isEmpty()) {
        TreeDto nemadokumenata = new TreeDto("0", id + "", "No documents", TreeDto.ACTIVITY_ICON, "", "");
        data.add(nemadokumenata);//from w  w w  .ja  va2s  .co  m
    } else {

    }
    System.out.println("data" + data.size());
    return new ResponseEntity<>(data, HttpStatus.OK);
}

From source file:de.knightsoftnet.validators.server.controller.UserController.java

@RequestMapping(value = ResourcePaths.User.LOGIN, method = RequestMethod.GET)
@PermitAll/*from ww  w . j a  va 2s  .  co m*/
ResponseEntity<Boolean> isCurrentUserLoggedIn() {
    return new ResponseEntity<>(this.userService.isCurrentUserLoggedIn(), HttpStatus.OK);
}

From source file:me.j360.boot.microservice.profile.web.ProfileController.java

@RequestMapping(method = RequestMethod.GET)
HttpEntity<Resources<Profile>> showCustomers() {
    Resources<Profile> resources = new Resources<Profile>(this.repository.findAll());
    resources.add(this.entityLinks.linkToCollectionResource(Profile.class));
    return new ResponseEntity<Resources<Profile>>(resources, HttpStatus.OK);
}

From source file:io.github.howiefh.jeews.modules.sys.controller.RoleController.java

@RequiresPermissions("role:view")
@RequestMapping(value = "", method = RequestMethod.GET)
public HttpEntity<Resources<RoleResource>> getList() {
    List<Role> roles = roleService.findAll();
    Resources<RoleResource> resources = ResourcesAssembler.toResources(roles, new RoleResourceAssembler(),
            RoleController.class);
    return new ResponseEntity<>(resources, HttpStatus.OK);
}

From source file:com.tamnd2.basicwebapp.rest.mvc.BlogEntryController.java

@RequestMapping(value = "/{blogEntryId}", method = RequestMethod.DELETE)
public ResponseEntity<BlogEntryResource> deleteBlogEntry(@PathVariable Long blogEntryId) {
    BlogEntry entry = service.deleteBlogEntry(blogEntryId);
    if (entry != null) {
        BlogEntryResource res = new BlogEntryResourceAsm().toResource(entry);
        return new ResponseEntity<BlogEntryResource>(res, HttpStatus.OK);
    } else {//from  w w w . j av  a 2 s  .  co m
        return new ResponseEntity<BlogEntryResource>(HttpStatus.NOT_FOUND);
    }
}

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

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

From source file:org.moserp.common.json_schema.JsonSchemaController.java

@RequestMapping(value = BASE_PATH + REPOSITORY, method = GET)
public HttpEntity<BusinessEntity> schema(RootResourceInformation resourceInformation) {
    BusinessEntity schema = jsonSchemaBuilder.buildFor(resourceInformation.getDomainType());
    return new ResponseEntity<>(schema, HttpStatus.OK);
}

From source file:com.ar.dev.tierra.api.controller.DetalleFacturaController.java

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<DetalleFactura> list = facadeService.getDetalleFacturaDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {/*from www .  j  a  v a2  s . c om*/
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:com.arya.latihan.controller.SalesOrderController.java

@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@Transactional(readOnly = false)/*ww w .  j a v  a2  s  . c o m*/
public ResponseEntity<SalesOrder> editSalesOrder(@PathVariable("id") String id, @Valid SalesOrder salesOrder) {
    salesOrder.setId(id);
    salesOrder = salesOrderRepository.save(salesOrder);
    return new ResponseEntity<SalesOrder>(salesOrder, HttpStatus.OK);
}