Example usage for org.springframework.http HttpStatus NO_CONTENT

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

Introduction

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

Prototype

HttpStatus NO_CONTENT

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

Click Source Link

Document

204 No Content .

Usage

From source file:fr.xebia.xke.metrics.web.WineController.java

@RequestMapping(value = "/wine/{name}/buy", method = RequestMethod.GET, produces = "application/json")
public ResponseEntity<OrderResponse> placeWineOrder(@PathVariable String name) {

    return new ResponseEntity<OrderResponse>(orderService.placeOrder(wineService.loadByName(name)),
            HttpStatus.NO_CONTENT);
}

From source file:org.openbaton.marketplace.api.RestVNFPackage.java

/**
 * Deletes an VNFPackage from the marketplace
 *
 * @param id/*from w  w  w . j a  v a  2  s . c  o m*/
 */
@RequestMapping(value = "{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") String id) throws NotFoundException, NotAuthorizedException {
    log.debug("Incoming request for deleting VNFPackage: " + id);
    vnfPackageManagement.delete(id);
    log.trace("Incoming request served by deleting VNFPackage: " + id);
}

From source file:com.tsguild.upsproject.controller.HomeController.java

@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(value = "/package/{packageId}", method = RequestMethod.PUT)
public void updatePackage(@PathVariable("packageId") String packageId, @RequestBody Box updatedPackage) {
    updatedPackage.setId(packageId);//www .j ava2 s . c  om
    dao.updateBox(updatedPackage);
}

From source file:io.syndesis.runtime.IntegrationsITCase.java

@Test
public void shouldDetermineValidityForValidIntegrations() {
    final Integration integration = new Integration.Builder().name("Test integration")
            .desiredStatus(Integration.Status.Draft).build();

    final ResponseEntity<List<Violation>> got = post("/api/v1/integrations/validation", integration,
            RESPONSE_TYPE, tokenRule.validToken(), HttpStatus.NO_CONTENT);

    assertThat(got.getBody()).isNull();/*from w w  w  . j  a  v  a2s.c o  m*/
}

From source file:org.echocat.marquardt.authority.spring.SpringAuthorityController.java

@RequestMapping(value = "/signOut", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void signOut(@RequestHeader(X_CERTIFICATE) final byte[] certificate, final HttpServletRequest request) {
    final byte[] signedBytesFromRequest = _requestValidator.extractSignedBytesFromRequest(request);
    final Signature signature = _requestValidator.extractSignatureFromHeader(request);
    _authority.signOut(certificate, signedBytesFromRequest, signature);
}

From source file:com.consol.citrus.demo.javaland.EmployeeResourceTest.java

@Test
@InSequence(4)//from w ww.  j  a v  a2  s  . c om
@CitrusTest
public void testDelete(@CitrusResource TestDesigner citrus) {
    citrus.http().client(serviceUri).delete("/Leonard");

    citrus.http().client(serviceUri).response(HttpStatus.NO_CONTENT);

    citrus.http().client(serviceUri).get().accept(MediaType.APPLICATION_XML);

    citrus.http().client(serviceUri).response(HttpStatus.OK)
            .payload("<employees>" + "<employee>" + "<age>20</age>" + "<name>Penny</name>" + "</employee>"
                    + "<employee>" + "<age>22</age>" + "<name>Sheldon</name>" + "</employee>" + "<employee>"
                    + "<age>21</age>" + "<name>Howard</name>" + "<email>howard@example.com</email>"
                    + "</employee>" + "</employees>");

    citrusFramework.run(citrus.getTestCase());
}

From source file:fr.gmjgav.controller.BarController.java

@RequestMapping(value = "/{barId}/{beerId}", method = POST)
public ResponseEntity<?> postBeerInBar(@PathVariable long barId, @PathVariable long beerId) {
    Bar bar = barRepository.findOne(barId);
    List<Beer> beersOfTheBar = bar.getBeers();
    Beer searchedBeer = beerRepository.findOne(beerId);
    beersOfTheBar.add(searchedBeer);/*from w  ww .j a v  a 2 s.co  m*/
    bar.setBeers(beersOfTheBar);
    barRepository.save(bar);
    return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

From source file:com.sms.server.controller.AdminController.java

@RequestMapping(value = "/user/{username}/role/{role}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteUserRole(@PathVariable("username") String username, @PathVariable("role") String role) {
    LogService.getInstance().addLogEntry(Level.INFO, CLASS_NAME,
            "Removed role '" + role + "' form user '" + username + "'.", null);
    userDao.removeUserRole(username, role);
}

From source file:io.syndesis.runtime.APITokenRule.java

@Override
protected void after() {
    MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
    map.set("refresh_token", refreshToken);
    map.set("client_id", "admin-cli");
    HttpHeaders headers = new HttpHeaders();
    headers.set("Authorization", "Bearer " + accessToken);
    ResponseEntity<JsonNode> json = restTemplate.postForEntity("http://localhost:" + keycloakPort
            + "/auth/realms/" + keycloakRealm + "/protocol/" + keycloakProtocol + "/logout", map,
            JsonNode.class);
    assertThat(json.getStatusCode()).as("logout status code").isEqualTo(HttpStatus.NO_CONTENT);
}

From source file:com.itn.webservices.AdminControllerWebservice.java

@RequestMapping(value = "/food/{id}", method = RequestMethod.DELETE)
public ResponseEntity<FoodInventory> deleteUser(@PathVariable("id") long id) {
    logger.info("Fetching & Deleting Food with id " + id);

    FoodInventory foodInventory = foodInventoryService.findById(id);
    if (foodInventory == null) {
        System.out.println("Unable to delete. User with id " + id + " not found");
        return new ResponseEntity<FoodInventory>(HttpStatus.NOT_FOUND);
    }//  ww w.  j a v  a  2 s .c  om

    foodInventoryService.deleteById(id);
    return new ResponseEntity<FoodInventory>(HttpStatus.NO_CONTENT);
}