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:com.sg.dvdlibrary.controller.HomeController.java

@RequestMapping(value = "/dvd/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteEntry(@PathVariable("id") int id) {
    dao.deleteEntry(id);//from w ww. j a v  a 2 s  . c om
}

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

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@Transactional(readOnly = false)/*w ww . j a v  a  2 s  .c  o  m*/
public void deleteItem(@PathVariable("id") String id) {
    itemRepository.delete(id);
}

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

@Test
public void updateOauthApp() {
    // Validate initial state assumptions.
    getOauthApps();/*  w  w  w  .  j a  v a 2s .  c  o  m*/

    OAuthAppHandler.OAuthApp twitter = new OAuthAppHandler.OAuthApp();
    twitter.clientId = "test-id";
    twitter.clientSecret = "test-secret";

    http(HttpMethod.PUT, "/api/v1/setup/oauth-apps/twitter", twitter, null, tokenRule.validToken(),
            HttpStatus.NO_CONTENT);

    ResponseEntity<OAuthAppHandler.OAuthApp[]> result = get("/api/v1/setup/oauth-apps",
            OAuthAppHandler.OAuthApp[].class);
    List<OAuthAppHandler.OAuthApp> apps = Arrays.asList(result.getBody());
    assertThat(apps.size()).isEqualTo(2);

    twitter = apps.stream().filter(x -> "twitter".equals(x.id)).findFirst().get();
    assertThat(twitter.id).isEqualTo("twitter");
    assertThat(twitter.name).isEqualTo("Twitter");
    assertThat(twitter.icon).isEqualTo("fa-twitter");
    assertThat(twitter.clientId).isEqualTo("test-id");
    assertThat(twitter.clientSecret).isEqualTo("test-secret");

    // Now that we have configured the app, we should be able to create the connection factory.
    // The connection factory is setup async so we might need to wait a little bit for it to register.
    given().ignoreExceptions().await().atMost(10, SECONDS).pollInterval(1, SECONDS).until(() -> {
        final CredentialProvider twitterCredentialProvider = locator.providerWithId("twitter");

        // preparing is something we could not do with a `null` ConnectionFactory
        assertThat(twitterCredentialProvider).isNotNull().isInstanceOfSatisfying(OAuth1CredentialProvider.class,
                p -> {
                    final Connection connection = new Connection.Builder().build();
                    final CredentialFlowState flowState = new OAuth1CredentialFlowState.Builder()
                            .accessToken(new OAuthToken("value", "secret")).build();
                    final Connection appliedTo = p.applyTo(connection, flowState);

                    // test that the updated values are used
                    assertThat(appliedTo.getConfiguredProperties()).contains(entry("consumerKey", "test-id"),
                            entry("consumerSecret", "test-secret"));
                });

        return true;
    });

}

From source file:io.curly.gathering.mention.MentionController.java

@RequestMapping(value = "/{participant}", method = RequestMethod.DELETE)
public Callable<HttpEntity<?>> unMention(@PathVariable String participant, @PathVariable String listId,
        @GitHubAuthentication User user) {
    return () -> {
        interaction.unMention(new UnMention(participant, listId), user);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    };/*from ww  w  .  j  a v a  2 s .c om*/
}

From source file:org.openbaton.common.vnfm_sdk.rest.AbstractVnfmSpringReST.java

@RequestMapping(value = "/core-rest-actions", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void receive(@RequestBody /*@Valid*/ String jsonNfvMessage) {
    log.debug("Received: " + jsonNfvMessage);

    NFVMessage nfvMessage = gson.fromJson(jsonNfvMessage, NFVMessage.class);

    try {//from  w  w  w.  ja  v a2s  .co  m
        this.onAction(nfvMessage);
    } catch (NotFoundException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    } catch (BadFormatException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}

From source file:nu.yona.server.analysis.rest.AnalysisEngineController.java

/**
 * The app service receives the app activity monitored by the Yona app and sends that to the analysis engine through this
 * method.//from  ww  w. j  a va 2s . c  om
 */
@RequestMapping(value = "/userAnonymized/{userAnonymizedId}/{deviceAnonymizedId}/appActivity/", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void analyzeAppActivity(@PathVariable UUID userAnonymizedId, @PathVariable UUID deviceAnonymizedId,
        @RequestBody AppActivitiesDto appActivities) {
    analysisEngineService.analyze(userAnonymizedId, deviceAnonymizedId, appActivities);
}

From source file:com.torchmind.stockpile.server.controller.v1.NameController.java

/**
 * <code>DELETE /v1/name</code>
 *
 * Purges a name from the cache.//from  ww w .ja  v a 2s .c om
 *
 * @param name a display name.
 */
@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(method = RequestMethod.DELETE)
public void purgeBody(@Nonnull @RequestBody String name) {
    this.purge(name);
}

From source file:com.alexshabanov.springrestapi.rest.controller.RestController.java

@RequestMapping(value = UPDATE_BANK_ACCOUNT_URI, method = RequestMethod.PUT)
@ResponseBody//from ww  w  . j  ava 2 s . co m
public ResponseEntity<Void> updateBankAccount(@PathVariable("id") int userId,
        @RequestBody BankAccount account) {
    bankAccountService.updateAccount(userId, account);
    return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
}

From source file:com.ge.predix.acs.commons.web.ResponseEntityBuilder.java

/**
 * Creates a typed ResponseEntity with HTTP status code 204 with no response payload.
 *
 * @return The corresponding ResponseEntity
 *//*from  ww  w . j a  v  a 2 s. c o m*/
public static ResponseEntity<Void> noContent() {
    return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
}

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

/**
 * Removes multiple VirtualNetworkFunctionDescriptor from the VirtualNetworkFunctionDescriptors
 * repository//  ww  w  . ja v  a2 s. c o m
 *
 * @param ids
 */
@RequestMapping(value = "/multipledelete", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void multipleDelete(@RequestBody @Valid List<String> ids,
        @RequestHeader(value = "project-id") String projectId) {
    for (String id : ids)
        vnfdManagement.delete(id, projectId);
}