Example usage for org.springframework.http HttpStatus ACCEPTED

List of usage examples for org.springframework.http HttpStatus ACCEPTED

Introduction

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

Prototype

HttpStatus ACCEPTED

To view the source code for org.springframework.http HttpStatus ACCEPTED.

Click Source Link

Document

202 Accepted .

Usage

From source file:com.swcguild.blacksmithblogcapstone.controller.BlackSmithController.java

@RequestMapping(value = "comment/delete/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.ACCEPTED)
public void removeComment(@PathVariable("id") int id) {
    dao.removeComment(id);//w  w  w .j  a  v a2 s .  c  o m
}

From source file:technology.tikal.ventas.service.catalogo.LineaProductoService.java

@RequestMapping(value = "/{lineaProductoId}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.ACCEPTED)
public void delete(@PathVariable final Long idCatalogo, @PathVariable final Long lineaProductoId) {
    lineaProductoController.borrar(idCatalogo, lineaProductoId);
}

From source file:org.openbaton.nfvo.api.RestVirtualNetworkFunctionDescriptor.java

/**
 * Updates the VNF software virtualNetworkFunctionDescriptor
 *
 * @param virtualNetworkFunctionDescriptor : the VNF software virtualNetworkFunctionDescriptor to
 * be updated//from w  w  w  .  j a va  2 s. c  o m
 * @param id : the id of VNF software virtualNetworkFunctionDescriptor
 * @return networkServiceDescriptor: the VNF software virtualNetworkFunctionDescriptor updated
 */
@RequestMapping(value = "{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.ACCEPTED)
public VirtualNetworkFunctionDescriptor update(
        @RequestBody @Valid VirtualNetworkFunctionDescriptor virtualNetworkFunctionDescriptor,
        @PathVariable("id") String id, @RequestHeader(value = "project-id") String projectId) {
    return vnfdManagement.update(virtualNetworkFunctionDescriptor, id, projectId);
}

From source file:io.pivotal.strepsirrhini.chaoslemur.Destroyer.java

@RequestMapping(method = RequestMethod.POST, value = "/chaos", consumes = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<?> eventRequest(@RequestBody Map<String, String> payload) {
    String value = payload.get("event");

    if (value == null) {
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }/*from  www.  j  av  a 2 s.c  o  m*/

    HttpHeaders responseHeaders = new HttpHeaders();

    if ("destroy".equals(value.toLowerCase())) {
        Task task = this.taskRepository.create(Trigger.MANUAL);
        this.executorService.execute(() -> doDestroy(task));
        responseHeaders.setLocation(this.taskUriBuilder.getUri(task));
    } else {
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }

    return new ResponseEntity<>(responseHeaders, HttpStatus.ACCEPTED);
}

From source file:edu.eci.cosw.restcontrollers.RestControladorRegistrarReserva.java

@RequestMapping(value = "/{idReserva}", method = RequestMethod.GET)
public ResponseEntity<?> consultarReservacion(@PathVariable int idReserva) {
    return new ResponseEntity<>(logica.consultarReservacion(idReserva), HttpStatus.ACCEPTED);
}

From source file:org.openbaton.nfvo.api.RestUsers.java

/**
 * Updates the User/*from   ww  w .j a  v a2  s .  c om*/
 *
 * @param new_user : The User to be updated
 * @return User The User updated
 */
@RequestMapping(value = "{username}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.ACCEPTED)
public User update(@RequestBody @Valid User new_user)
        throws NotAllowedException, BadRequestException, NotFoundException {
    return userManagement.update(new_user);
}

From source file:com.marklogic.mgmt.admin.AdminManager.java

public void installAdmin(String username, String password) {
    final URI uri = adminConfig.buildUri("/admin/v1/instance-admin");

    String json = null;/*  w  w  w .j a v a 2  s . c  om*/
    if (username != null && password != null) {
        json = format("{\"admin-username\":\"%s\", \"admin-password\":\"%s\", \"realm\":\"public\"}", username,
                password);
    } else {
        json = "{}";
    }
    final String payload = json;

    logger.info("Installing admin user at: " + uri);
    invokeActionRequiringRestart(new ActionRequiringRestart() {
        @Override
        public boolean execute() {
            HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.APPLICATION_JSON);
            HttpEntity<String> entity = new HttpEntity<String>(payload, headers);
            try {
                ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.POST, entity,
                        String.class);
                logger.info("Admin installation response: " + response);
                // According to http://docs.marklogic.com/REST/POST/admin/v1/init, a 202 is sent back in the event a
                // restart is needed. A 400 or 401 will be thrown as an error by RestTemplate.
                return HttpStatus.ACCEPTED.equals(response.getStatusCode());
            } catch (HttpClientErrorException hcee) {
                if (HttpStatus.BAD_REQUEST.equals(hcee.getStatusCode())) {
                    logger.warn("Caught 400 error, assuming admin user already installed; response body: "
                            + hcee.getResponseBodyAsString());
                    return false;
                }
                throw hcee;
            }
        }
    });
}

From source file:technology.tikal.gae.system.service.imp.SystemAccountServiceImp.java

@Override
@RequestMapping(value = "/{user}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.ACCEPTED)
public void deleteSystemAccount(@PathVariable final String user) {
    SystemUser account = systemUserDao.consultar(user);
    String username = SecurityContextHolder.getContext().getAuthentication().getName();
    if (username.compareTo(user) == 0) { //No se puede borrar a si mismo
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "SelfDelete.SystemAccountServiceImp.deleteSystemAccount" },
                new String[] { user }, "Can't delete yourself"));
    } else {//  ww w .j  ava2 s  . c om
        systemUserDao.borrar(account);
    }
}

From source file:technology.tikal.ventas.service.pedimento.PedimentoService.java

@RequestMapping(value = "/{pedimentoId}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.ACCEPTED)
public void borrar(@PathVariable final Long pedidoId, @PathVariable final Long pedimentoId) {
    pedimentoController.borrar(pedidoId, pedimentoId);
}

From source file:technology.tikal.ventas.service.almacen.EntradaService.java

@RequestMapping(value = "/{entradaId}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.ACCEPTED)
public void borrar(@PathVariable final Long pedidoId, @PathVariable final Long entradaId) {
    entradaController.borrar(pedidoId, entradaId);
}