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:plbtw.klmpk.barang.hilang.controller.DeveloperController.java

@CrossOrigin(origins = "*")
@RequestMapping(value = "/auth", method = RequestMethod.POST, produces = "application/json")
public CustomResponseMessage login(@RequestBody LoginAuthRequest req) {
    Developer loggedDeveloper = developerService.getDeveloperByEmailAndPassword(req.getEmail(),
            req.getPassword());//from  w w w.j ava2 s  .  c om
    CustomResponseMessage resultMessage = new CustomResponseMessage();
    if (loggedDeveloper == null) {
        resultMessage.setResult(null);
        resultMessage.setMessage("Failed");
        resultMessage.setHttpStatus(HttpStatus.NOT_FOUND);
    } else {
        List<Developer> result = new ArrayList<Developer>();
        result.add(loggedDeveloper);
        resultMessage.setResult(result);
        resultMessage.setHttpStatus(HttpStatus.FOUND);
        resultMessage.setMessage("Success");
    }
    return resultMessage;
}

From source file:com.consol.citrus.admin.connector.WebSocketPushMessageListener.java

/**
 * Push message to citrus-admin connector via REST API.
 * @param processId//from www  .  jav a 2 s. c om
 * @param message
 * @param direction
 */
protected void push(String processId, Message message, String direction) {
    try {
        if (!disabled) {
            ResponseEntity<String> response = getRestTemplate()
                    .exchange(
                            String.format("http://%s:%s/connector/message/%s?processId=%s", host, port,
                                    direction, processId),
                            HttpMethod.POST, new HttpEntity(message.toString()), String.class);

            if (response.getStatusCode().equals(HttpStatus.NOT_FOUND)) {
                disabled = true;
            }
        }
    } catch (RestClientException e) {
        log.error("Failed to push message to citrus-admin connector", e);
    }
}

From source file:su90.mybatisdemo.web.endpoints.EmployeesEndpoints.java

@RequestMapping(value = "/get/{id}", method = RequestMethod.GET, produces = {
        MediaType.APPLICATION_JSON_UTF8_VALUE })
@ApiOperation(value = "find one employee")
public ResponseEntity<EmployeeOut> getOne(@PathVariable Long id) {
    EmployeeOut result = employeesService.getWebBeanById(id);
    if (result == null) {
        return new ResponseEntity<>(result, HttpStatus.NOT_FOUND);
    }//from www  .j  a va2s  .com
    return new ResponseEntity<>(result, HttpStatus.OK);
}

From source file:com.github.woki.payments.adyen.simulator.web.controller.PaymentController.java

@RequestMapping(value = { "/pal/servlet/Payment/v30/authorise",
        "/pal/servlet/Payment/v30/authorise3d" }, method = RequestMethod.POST)
public ResponseEntity<PaymentResponse> authorize(@RequestBody PaymentRequest request) {
    PaymentResponse res = new PaymentResponse();
    if ("gimme_500".equals(request.getReference())) {
        res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
        return new ResponseEntity<>(res, HttpStatus.INTERNAL_SERVER_ERROR);
    }/* w  w  w . java 2s .  c o  m*/
    if ("gimme_400".equals(request.getReference())) {
        res.setStatus(HttpStatus.BAD_REQUEST.value());
        return new ResponseEntity<>(res, HttpStatus.BAD_REQUEST);
    }
    if ("gimme_422".equals(request.getReference())) {
        res.setStatus(HttpStatus.UNPROCESSABLE_ENTITY.value());
        return new ResponseEntity<>(res, HttpStatus.UNPROCESSABLE_ENTITY);
    }
    if ("gimme_401".equals(request.getReference())) {
        res.setStatus(HttpStatus.UNAUTHORIZED.value());
        return new ResponseEntity<>(res, HttpStatus.UNAUTHORIZED);
    }
    if ("gimme_403".equals(request.getReference())) {
        res.setStatus(HttpStatus.FORBIDDEN.value());
        return new ResponseEntity<>(res, HttpStatus.FORBIDDEN);
    }
    if ("gimme_404".equals(request.getReference())) {
        res.setStatus(HttpStatus.NOT_FOUND.value());
        return new ResponseEntity<>(res, HttpStatus.NOT_FOUND);
    }
    if ("gimme_200".equals(request.getReference())) {
        res.setStatus(HttpStatus.OK.value());
        return new ResponseEntity<>(res, HttpStatus.OK);
    }
    res.setStatus(HttpStatus.NON_AUTHORITATIVE_INFORMATION.value());
    return new ResponseEntity<>(res, HttpStatus.NON_AUTHORITATIVE_INFORMATION);
}

From source file:com.logAnything.LogAnythingApiController.java

@RequestMapping(value = "/**")
@ResponseBody//from w w  w . ja v  a2  s  .  com
public ResponseEntity unknownResourceError() {
    return new ResponseEntity<>("Resource not found", HttpStatus.NOT_FOUND);
}

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

@RequestMapping(value = "/food/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<FoodInventory> getFood(@PathVariable("id") long id) {
    logger.info("Fetching food with id " + id);
    FoodInventory foodInventory = foodInventoryService.findById(id);
    if (foodInventory == null) {
        logger.info("Food with id " + id + " not found");
        return new ResponseEntity<FoodInventory>(HttpStatus.NOT_FOUND);
    }/*from w  ww  .j a  va2s.  c om*/
    return new ResponseEntity<FoodInventory>(foodInventory, HttpStatus.OK);
}

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

@ExceptionHandler
@ResponseStatus(HttpStatus.NOT_FOUND)
public String handleFederationFailedException(@SuppressWarnings("unused") final FederationFailedException ex) {
    return ex.getMessage();
}

From source file:fi.helsinki.opintoni.server.UnisportServer.java

public void expectAuthorizationFailWith404() {
    server.expect(//from  ww  w.  j  a v  a2s .  c o m
            requestTo(unisportBaseUrl + "/api/v1/en/ext/opintoni/authorization?eppn=opettaja@helsinki.fi"))
            .andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.NOT_FOUND));
}

From source file:spring.travel.site.controllers.LoginController.java

@ExceptionHandler
@SuppressWarnings("unused")
public ResponseEntity<Void> handleNotFound(UserNotFoundException nfe) {
    return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}

From source file:github.priyatam.springrest.resource.PolicyResource.java

@RequestMapping(method = RequestMethod.GET, value = "/policy")
@ResponseBody// ww  w  .  j  a v a  2s  . c  o m
public ResponseEntity<List<Policy>> getAll() {
    List<Policy> policies = new ArrayList<Policy>(); // TODO: Implement mapper.getAll
    if (policies.size() == 0) {
        logger.debug("No Policies found");
        return new ResponseEntity<List<Policy>>(policies, HttpStatus.NOT_FOUND);
    }
    return new ResponseEntity<List<Policy>>(policies, HttpStatus.OK);
}