Example usage for org.springframework.http HttpStatus OK

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

Introduction

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

Prototype

HttpStatus OK

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

Click Source Link

Document

200 OK .

Usage

From source file:org.opentides.web.controller.SystemUtilController.java

@RequestMapping(method = RequestMethod.GET, value = "/schema-update/{schemaName}", produces = "application/json")
@ResponseStatus(HttpStatus.OK)
@ResponseBody//from  w w  w .  ja v  a2  s .co  m
public Map<String, Object> schemaUpdate(@PathVariable("schemaName") String schemaName,
        HttpServletRequest request) {
    if (StringUtil.isEmpty(schemaName)) {
        multiTenantSchemaUpdate.schemaEvolve(schemaName);
    }
    return null;
}

From source file:com.healthcit.cacure.web.controller.FormElementBatchDeleteController.java

@RequestMapping(value = "/questionList.delete", method = RequestMethod.POST)
public ResponseEntity<String> batchDelete(@RequestParam(value = "feIds[]", required = false) Long[] feIds) {
    HashSet<Long> uniqueIds = new HashSet<Long>(Arrays.asList(feIds));
    Set<Long> deleted = new HashSet<Long>();
    for (Long id : uniqueIds) {
        try {//from  w  w w  .  j av  a2s.co  m
            qaManager.deleteFormElementByID(id);
            deleted.add(id);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    JSONArray jsonArray = new JSONArray();
    for (Long id : deleted) {
        jsonArray.add(id);
    }

    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", "application/json");
    return new ResponseEntity<String>(jsonArray.toString(), headers, HttpStatus.OK);
}

From source file:gt.dakaik.rest.impl.ProfileImpl.java

@Override
public ResponseEntity<Profile> findById(int idUsuario, String token, Long id)
        throws EntidadNoEncontradaException {
    Profile p = repoProfile.findOne(id);

    if (p != null) {
        return new ResponseEntity(p, HttpStatus.OK);
    } else {/*from w  w  w .j av a2 s  .c  o m*/
        throw new EntidadNoEncontradaException("Entity User");
    }
}

From source file:com.htmlhifive.resourcefw.sample.ctrl.OtherController.java

@RequestMapping("other1")
public ResponseEntity<Map<String, String>> other1(
        @RequestParam(value = "q", required = false, defaultValue = "defaultQ") final String q)
        throws Exception {

    @SuppressWarnings("serial")
    HashMap<String, String> body = new HashMap<String, String>() {
        {/*w  w w  . ja  v  a  2s  .co m*/
            put("q", q);
        }
    };

    return new ResponseEntity<Map<String, String>>(body, HttpStatus.OK);
}

From source file:br.upe.community.ui.ControllerDoacao.java

@RequestMapping(value = "/cadastrar", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<?> cadastrarDoacao(Doacao doacao, Produto produto, String emailUsuario,
        String nomeCategoria) {/*w ww  . ja  v  a  2  s  .c  om*/
    try {
        fachada.cadastrarDoacao(doacao, produto, emailUsuario, nomeCategoria);
        return new ResponseEntity<String>(HttpStatus.OK);
    } catch (UsuarioInexistenteException e) {
        return new ResponseEntity<UsuarioInexistenteException>(e, HttpStatus.BAD_REQUEST);
    } catch (CategoriaInexistenteException ex) {
        return new ResponseEntity<CategoriaInexistenteException>(ex, HttpStatus.BAD_REQUEST);

    }
}

From source file:com.springer.semantic.classifier.jetty.ClassifierApplicationTests.java

@Test
public void testHome() throws Exception {
    ResponseEntity<String> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port,
            String.class);
    assertEquals(HttpStatus.OK, entity.getStatusCode());
    assertEquals(1, 1);/*from  w  w  w  .ja  va  2 s.c om*/
}

From source file:com.springsource.html5expense.controllers.ExpenseReportingApiController.java

@ResponseStatus(HttpStatus.OK)
@RequestMapping(method = RequestMethod.DELETE, value = "/expenses/{expenseId}")
public void restoreExpenseToEligibleCharge(@PathVariable("expenseId") Integer expenseId) {
    Expense ex = service.getExpense(expenseId);
    service.restoreEligibleCharges(Arrays.asList(ex.getId()));
}

From source file:com.baidu.stqa.signet.web.action.StatisticsAction.java

/**
 * ?//  w w  w  .j a v  a2 s .co m
 * 
 * @param projectId
 * @param storyIds
 * @return
 */
@RequestMapping(value = "/project/{projectId}/statistics", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<Map<String, Object>> queryStatistics(@PathVariable long projectId, String storyIds) {
    String[] idStrs = storyIds.split(",");
    List<Long> ids = new ArrayList<Long>();
    for (String id : idStrs) {
        ids.add(new Long(id));
    }
    Map<String, Object> resultMap = statisticsService.queryStatistics(ids, projectId);
    return new ResponseEntity<Map<String, Object>>(resultMap, HttpStatus.OK);
}

From source file:com.clearprecision.microservices.reference.jetty.BirthdayApplicationTests.java

@Test
public void testHome() throws Exception {
    ResponseEntity<String> entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port,
            String.class);
    assertEquals(HttpStatus.OK, entity.getStatusCode());
    assertEquals("Hello World", entity.getBody());
}

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

/** Get all reservations
 * @return         void/*w w  w  .j a v  a 2s  .  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);
    }
}