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.netflix.genie.web.controllers.ClusterRestController.java

/**
 * Delete all clusters from database.//from   w w  w .java2  s  . c om
 *
 * @throws GenieException For any error
 */
@DeleteMapping
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteAllClusters() throws GenieException {
    log.debug("called");
    this.clusterService.deleteAllClusters();
}

From source file:com.wisemapping.rest.MindmapController.java

@RequestMapping(value = "/maps/{id}/history/{hid}", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid)
        throws WiseMappingException, IOException {
    final Mindmap mindmap = findMindmapById(id);
    final User user = Utils.getUser();

    if (LATEST_HISTORY_REVISION.equals(hid)) {
        // Revert to the latest stored version ...
        List<MindMapHistory> mindmapHistory = mindmapService.findMindmapHistory(id);
        if (mindmapHistory.size() > 0) {
            final MindMapHistory mindMapHistory = mindmapHistory.get(0);
            mindmap.setZippedXml(mindMapHistory.getZippedXml());
            saveMindmapDocument(true, mindmap, user);
        }/*from ww w . j  a  v a 2s  . c  o m*/
    } else {
        mindmapService.revertChange(mindmap, Integer.parseInt(hid));
    }
}

From source file:com.netflix.genie.web.controllers.ApplicationRestController.java

/**
 * Add new configuration files to a given application.
 *
 * @param id      The id of the application to add the configuration file to. Not
 *                null/empty/blank.//from  w  w  w .j  a v a2 s  . c o m
 * @param configs The configuration files to add. Not null/empty/blank.
 * @throws GenieException For any error
 */
@PostMapping(value = "/{id}/configs", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void addConfigsToApplication(@PathVariable("id") final String id, @RequestBody final Set<String> configs)
        throws GenieException {
    log.debug("Called with id {} and config {}", id, configs);
    this.applicationService.addConfigsToApplication(id, configs);
}

From source file:alfio.controller.api.admin.CheckInApiController.java

private ResponseEntity<LabelLayout> parseLabelLayout(Event event) {
    return loadLabelLayout(event).map(ResponseEntity::ok)
            .orElseGet(() -> new ResponseEntity<>(HttpStatus.NO_CONTENT));
}

From source file:com.orange.ngsi2.server.Ngsi2BaseController.java

/**
 * Endpoint post /v2/entities/{entityId}
 * @param entityId the entity ID/* w  ww  . java2  s . c  o m*/
 * @param attributes the attributes to update or to append
 * @param type an optional type of entity
 * @param options an optional list of options separated by comma. Possible value for option: append.
 *        keyValues options is not supported.
 *        If append is present then the operation is an append operation
 * @return http status 201 (created)
 * @throws Exception
 */
@RequestMapping(method = RequestMethod.POST, value = {
        "/entities/{entityId}" }, consumes = MediaType.APPLICATION_JSON_VALUE)
final public ResponseEntity updateOrAppendEntityEndpoint(@PathVariable String entityId,
        @RequestBody HashMap<String, Attribute> attributes, @RequestParam Optional<String> type,
        @RequestParam Optional<Set<String>> options) throws Exception {
    validateSyntax(entityId, type.orElse(null), attributes);

    boolean append = false;
    if (options.isPresent()) {
        //TODO: to support keyValues as options
        if (options.get().contains("keyValues")) {
            throw new UnsupportedOptionException("keyValues");
        }
        append = options.get().contains("append");
    }
    updateOrAppendEntity(entityId, type.orElse(null), attributes, append);
    return new ResponseEntity(HttpStatus.NO_CONTENT);
}

From source file:org.fineract.module.stellar.controller.BridgeController.java

@RequestMapping(value = "/payments/", method = RequestMethod.POST, consumes = {
        "application/json" }, produces = { "application/json" })
public ResponseEntity<Void> sendStellarPayment(@RequestHeader(API_KEY_HEADER_LABEL) final String apiKey,
        @RequestHeader(TENANT_ID_HEADER_LABEL) final String mifosTenantId,
        @RequestHeader("X-Mifos-Entity") final String entity,
        @RequestHeader("X-Mifos-Action") final String action, @RequestBody final String payload)
        throws SecurityException {
    this.securityService.verifyApiKey(apiKey, mifosTenantId);

    if (entity.equalsIgnoreCase("JOURNALENTRY") && action.equalsIgnoreCase("CREATE")) {
        final JournalEntryData journalEntry = gson.fromJson(payload, JournalEntryData.class);

        final PaymentPersistency payment = journalEntryPaymentMapper.mapToPayment(mifosTenantId, journalEntry);

        if (!payment.isStellarPayment) {
            return new ResponseEntity<>(HttpStatus.NO_CONTENT);
        }//from ww w  . j a  v  a2s .  c o m

        this.bridgeService.sendPaymentToStellar(payment);
    }

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

From source file:org.mitre.uma.web.ResourceSetRegistrationEndpoint.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public String deleteResourceSet(@PathVariable("id") Long id, Model m, Authentication auth) {
    ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);

    ResourceSet rs = resourceSetService.getById(id);

    if (rs == null) {
        m.addAttribute(HttpCodeView.CODE, HttpStatus.NOT_FOUND);
        m.addAttribute(JsonErrorView.ERROR, "not_found");
        return JsonErrorView.VIEWNAME;
    } else {/*from   w w w.  j  a  va2 s  .com*/
        if (!auth.getName().equals(rs.getOwner())) {

            logger.warn("Unauthorized resource set request from bad user; expected " + rs.getOwner() + " got "
                    + auth.getName());

            // it wasn't issued to this user
            m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN);
            return JsonErrorView.VIEWNAME;
        } else if (auth instanceof OAuth2Authentication
                && !((OAuth2Authentication) auth).getOAuth2Request().getClientId().equals(rs.getClientId())) {

            logger.warn("Unauthorized resource set request from bad client; expected " + rs.getClientId()
                    + " got " + ((OAuth2Authentication) auth).getOAuth2Request().getClientId());

            // it wasn't issued to this client
            m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN);
            return JsonErrorView.VIEWNAME;
        } else {

            // user and client matched
            resourceSetService.remove(rs);

            m.addAttribute(HttpCodeView.CODE, HttpStatus.NO_CONTENT);
            return HttpCodeView.VIEWNAME;
        }

    }
}

From source file:com.netflix.genie.web.controllers.ClusterRestController.java

/**
 * Add new configuration files to a given cluster.
 *
 * @param id      The id of the cluster to add the configuration file to. Not
 *                null/empty/blank./*w ww .j av a  2s  . c o  m*/
 * @param configs The configuration files to add. Not null/empty/blank.
 * @throws GenieException For any error
 */
@PostMapping(value = "/{id}/configs", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void addConfigsForCluster(@PathVariable("id") final String id, @RequestBody final Set<String> configs)
        throws GenieException {
    log.debug("Called with id {} and config {}", id, configs);
    this.clusterService.addConfigsForCluster(id, configs);
}

From source file:com.netflix.genie.web.controllers.CommandRestController.java

/**
 * Add new configuration files to a given command.
 *
 * @param id      The id of the command to add the configuration file to. Not
 *                null/empty/blank./*from  w w w.  j a  v a2s.c  o m*/
 * @param configs The configuration files to add. Not null/empty/blank.
 * @throws GenieException For any error
 */
@PostMapping(value = "/{id}/configs", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void addConfigsForCommand(@PathVariable("id") final String id, @RequestBody final Set<String> configs)
        throws GenieException {
    log.debug("Called with id {} and config {}", id, configs);
    this.commandService.addConfigsForCommand(id, configs);
}