Example usage for org.springframework.http HttpStatus NOT_FOUND

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

Introduction

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

Prototype

HttpStatus NOT_FOUND

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

Click Source Link

Document

404 Not Found .

Usage

From source file:edu.sjsu.cmpe275.lab2.controller.ManageOrgController.java

/** (6) Get a organization<br>
 Path:org/{id}?format={json | xml | html} <br>
 Method: GET <br>//from   w  w w .j  a  v a 2  s  .c  om
 This returns a full organization object with the given ID in the given format.
 All existing fields, including the optional organization and list of friends should be returned.
 If the organization of the given user ID does not exist, the HTTP return code should be 404; otherwise, 200.
 The format parameter is optional, and the value is case insensitive. If missing, JSON is assumed.
        
 * @param id         Description of a
 * @return         Description of c
 */

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity getOrganizationJson(@PathVariable("id") long id) {

    Organization organization = orgDao.get(id);
    if (organization == null) {
        return new ResponseEntity(null, HttpStatus.NOT_FOUND);
    } else {
        return new ResponseEntity(organization, HttpStatus.OK);
    }
}

From source file:org.fineract.module.stellar.TestCreateTrustLine.java

@Test
public void createTrustLineTrusteeDoesntExist() {
    final TrustLineConfiguration trustLine = new TrustLineConfiguration(BigDecimal.TEN);

    String issuer = "";
    try {/*from ww  w . ja  va  2 s  .  c  om*/
        issuer = URLEncoder.encode("blah*test.org", "UTF-8");
    } catch (UnsupportedEncodingException e) {
        Assert.fail();
    }

    given().header(StellarBridgeTestHelpers.CONTENT_TYPE_HEADER)
            .header(StellarBridgeTestHelpers.API_KEY_HEADER_LABEL, firstTenantApiKey)
            .header(StellarBridgeTestHelpers.TENANT_ID_HEADER_LABEL, firstTenantId)
            .pathParameter("assetCode", ASSET_CODE).pathParameter("issuer", issuer).body(trustLine)
            .put("/modules/stellarbridge/trustlines/{assetCode}/{issuer}/").then().assertThat()
            .statusCode(HttpStatus.NOT_FOUND.value());
}

From source file:io.jmnarloch.spring.boot.rxjava.async.SingleDeferredResultTest.java

@Test
public void shouldRetrieveSingleValueWithStatusCode() {

    // when/*  w w  w  .  j a  va2  s.  c  o m*/
    ResponseEntity<String> response = restTemplate.getForEntity(path("/singleWithResponse"), String.class);

    // then
    assertNotNull(response);
    assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode());
    assertEquals("single value", response.getBody());
}

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

@RequestMapping(value = "/entidadMedio", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> searchEntidad(@RequestParam("idEntidad") int idEntidad,
        @RequestParam("idMedio") int idMedio) {
    List<Tarjeta> list = facadeService.getTarjetaDAO().searchEntidadMedio(idEntidad, idMedio);
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {/*from w  w w  . j  a v a  2s  . c  om*/
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:com.nebhale.buildmonitor.web.ProjectController.java

@Transactional
@RequestMapping(method = RequestMethod.DELETE, value = "/{project}")
ResponseEntity<?> delete(@PathVariable Project project) {
    if (project == null) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }//from w w w.j a va 2s .c om

    this.repository.delete(project);
    this.projectsChangedNotifier.projectsChanged();
    return new ResponseEntity<>(HttpStatus.OK);
}

From source file:com.ge.predix.acs.zone.management.ZoneController.java

@RequestMapping(method = GET, value = V1
        + AcsApiUriTemplates.ZONE_URL, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "An ACS zone defines a data partition which encapsulates policy, resource and privelege data"
        + "for separation between ACS tenants.  Retrieves the zone by a zone name.", hidden = true)
public ResponseEntity<Zone> getZone(@PathVariable("zoneName") final String zoneName) {

    try {// ww  w. j  av  a2 s.c o m

        Zone zone = this.service.retrieveZone(zoneName);
        return ok(zone);

    } catch (ZoneManagementException e) {
        throw new RestApiException(HttpStatus.NOT_FOUND, e);
    } catch (Exception e) {
        String message = String.format("Unexpected Exception while retriving Zone with name %s", zoneName);
        throw new RestApiException(HttpStatus.INTERNAL_SERVER_ERROR, message, e);
    }
}

From source file:de.zib.gndms.dspace.service.SubspaceServiceImpl.java

@Override
@RequestMapping(value = "/_{subspace}", method = RequestMethod.GET)
@Secured("ROLE_USER")
public ResponseEntity<Facets> listAvailableFacets(@PathVariable final String subspace,
        @RequestHeader("DN") final String dn) {

    GNDMSResponseHeader headers = getSubspaceHeaders(subspace, dn);

    if (!subspaceProvider.exists(subspace)) {
        logger.warn("Subspace " + subspace + " does not exist.");
        return new ResponseEntity<Facets>(null, headers, HttpStatus.NOT_FOUND);
    }/*from   w w w .ja va 2 s.  com*/

    List<Facet> facets = listFacetsOfSubspace(subspace);
    return new ResponseEntity<Facets>(new Facets(facets), headers, HttpStatus.OK);
}

From source file:org.magnum.mobilecloud.video.AssignmentController.java

@RequestMapping(value = VideoSvcApi.VIDEO_SVC_PATH + "/{id}/like", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<Void> likeVideo(@PathVariable("id") long id, Principal p) {
    if (videos.exists(id)) {
        Video video = videos.findOne(id);
        if (video.userAlreadyLikes(p.getName())) {
            return new ResponseEntity<Void>(HttpStatus.BAD_REQUEST);
        } else {// w w w.j  av  a  2  s  .  c  o  m
            video.addUserLike(p.getName());
            videos.save(video);
            return new ResponseEntity<Void>(HttpStatus.OK);
        }
    } else {
        return new ResponseEntity<Void>(HttpStatus.NOT_FOUND);
    }
}

From source file:ca.qhrtech.controllers.UserController.java

@ApiMethod(description = "Retrieves a list of table invites for the User at the specified location")
@RequestMapping("/user/{id}/invites")
public ResponseEntity<List<BGLTable>> getTablesInvitedTo(@PathVariable("id") long id) {
    if (userService.findUserById(id) == null) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }//from w w w .j av  a 2  s.  co  m
    return new ResponseEntity<>(tableService.getTablesInvitedTo(id), HttpStatus.OK);
}