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:com.ar.dev.tierra.api.controller.DetalleNotaCreditoController.java

@RequestMapping(value = "/nota", method = RequestMethod.GET)
public ResponseEntity<?> getByNotaCredito(@RequestParam("idNota") int idNota) {
    List<DetalleNotaCredito> list = facadeService.getDetalleNotaCreditoDAO().getByNotaCredito(idNota);
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {/*from w  ww  .j a v  a2 s  .  c o m*/
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:eu.modaclouds.sla.service.rest.PenaltyReceiverRest.java

@GET
public Response getRoot() {

    return buildResponse(HttpStatus.NOT_FOUND, "Valid method is POST /");
}

From source file:org.cloudfoundry.maven.RecentLogs.java

@Override
protected void doExecute() throws MojoExecutionException {

    try {//from   w  w w  .jav  a2s. c  om
        getLog().info(String.format("Getting logs for '%s'", getAppname()));

        List<ApplicationLog> logEntries = getClient().getRecentLogs(getAppname());
        for (ApplicationLog logEntry : logEntries) {
            getLog().info(renderApplicationLogEntry(logEntry));
        }
    } catch (CloudFoundryException e) {
        if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) {
            throw new MojoExecutionException(String.format("Application '%s' does not exist", getAppname()), e);
        } else {
            throw new MojoExecutionException(String.format(
                    "Error getting logs for application '%s'. Error message: '%s'. Description: '%s'",
                    getAppname(), e.getMessage(), e.getDescription()), e);
        }
    }
}

From source file:org.intermine.app.listener.GetListsListener.java

@Override
public void onRequestFailure(SpiceException spiceException) {
    Throwable ex = spiceException.getCause();

    if (ex instanceof HttpNetworkException) {
        HttpNetworkException httpStatusCodeException = (HttpNetworkException) ex;

        if (HttpStatus.NOT_FOUND.equals(httpStatusCodeException.getStatusCode())) {
            CreateGenesList request = new CreateGenesList(mBaseActivity, mMine,
                    mBaseActivity.getString(R.string.gene_favorites_list_name), mGenes);
            mBaseActivity.execute(request, new RequestListener<Void>() {
                @Override// ww  w.  java 2 s  .c o  m
                public void onRequestFailure(SpiceException ex) {
                    ResponseHelper.handleSpiceException(ex, mBaseActivity, mMine);
                }

                @Override
                public void onRequestSuccess(Void aVoid) {

                }
            });
        }
    }
}

From source file:io.pivotal.Migrate.java

@Override
public void run(String... strings) throws Exception {
    try {/*from   ww  w  . j av a 2  s .  c om*/
        github.deleteRepository();
    } catch (HttpClientErrorException e) {
        if (e.getStatusCode().value() != HttpStatus.NOT_FOUND.value()) {
            throw e;
        }
    }
    System.out.println("Creating a test repository to place the issues in");
    github.createRepository();

    System.out.println("Finding the project info");
    JiraProject project = jira.findProject(getJiraProjectId());

    System.out.println("Creating Milestones");
    github.createMilestones(project.getVersions());
    System.out.println("Creating Labels");
    github.createComponentLabels(project.getComponents());
    github.createIssueTypeLabels(project.getIssueTypes());

    System.out.println("Getting JIRA issues");
    List<JiraIssue> issues = jira.findIssues(jiraConfig.getMigrateJql());
    System.out.println("Found " + issues.size() + " JIRA issues to migrate");

    System.out.println("Creating issues");
    github.createIssues(issues);

}

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

@RequestMapping(value = "/all", method = RequestMethod.GET)
public ResponseEntity<?> getAll() {
    List<NotaCredito> list = facadeService.getNotaCreditoDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {//from w ww . j a  va 2  s.co m
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

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

@RequestMapping(value = "/{id}/cover/{scale}", method = RequestMethod.GET, produces = "image/jpeg")
@ResponseBody/*ww w. ja  v a 2s.co m*/
public ResponseEntity getCoverArt(@PathVariable("id") Long id, @PathVariable("scale") Integer scale) {
    MediaElement mediaElement;
    BufferedImage image;

    // Get corresponding media element
    mediaElement = mediaDao.getMediaElementByID(id);

    if (mediaElement == null) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }

    // Get scaled cover art
    image = imageService.getCoverArt(mediaElement, scale);

    // Check if we were able to retrieve a cover
    if (image == null) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }

    // Convert image to bytes to send
    try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ImageIO.write(image, "jpg", baos);
        byte[] imageBytes = baos.toByteArray();

        // Return cover art if found
        return new ResponseEntity(imageBytes, HttpStatus.OK);

    } catch (IOException ex) {
        return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
}

From source file:pitayaa.nail.msg.core.account.controller.AccountLicenseController.java

@RequestMapping(value = "/accountsLicense/{ID}", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<?> saveAccountLicenseModel(@RequestBody AccountLicense accLicenseBody,
        @PathVariable("ID") UUID uid) throws Exception {

    Optional<AccountLicense> accountLicense = accLicenseService.findOne(uid);

    if (!accountLicense.isPresent()) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }//from w  ww.java 2 s. c  o  m

    accLicenseBody = accLicenseService.save(accLicenseBody);

    return ResponseEntity.ok(accLicenseBody);
}

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

@RequestMapping(value = "/vendedor/ventas", method = RequestMethod.GET)
public ResponseEntity<?> getVentaVendedor(@RequestParam("idVendedor") int idVendedor) {
    List<Chart> chart = impl.getDineroVendedores(idVendedor);
    if (!chart.isEmpty()) {
        return new ResponseEntity<>(chart, HttpStatus.OK);
    } else {//from   ww w  .ja v a  2s . c om
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
}

From source file:edu.sjsu.cmpe275.project.controller.ReservationController.java

/** Get all reservations
 * @return         void/* w ww  . ja va2  s  .c o  m*/
 */

@RequestMapping(value = "", method = RequestMethod.GET)
public ResponseEntity<?> createReservation() {

    List<Reservation> reservations = reservationService.getAll();
    if (reservations == null) {
        return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
    } else {
        return new ResponseEntity<Object>(reservations, HttpStatus.OK);
    }
}