List of usage examples for javax.servlet.http HttpServletResponse setStatus
public void setStatus(int sc);
From source file:net.dstc.mkts.rest.MktSurveyService.java
@POST @Protected/*from w w w. ja v a 2s .c o m*/ @Consumes(MediaType.APPLICATION_JSON) @ApiOperation(value = "Register new survey", code = 201, authorizations = { @Authorization(value = "oauth2") }) public void insert(SurveyDTO survey, @Context HttpServletResponse response) throws NotAuthException, OAuthSystemException { service.insert(survey); response.setStatus(HttpServletResponse.SC_CREATED); try { response.getOutputStream().close(); } catch (Exception ex) { } }
From source file:org.mitre.openid.connect.view.HttpCodeView.java
@Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) { HttpStatus code = (HttpStatus) model.get(CODE); if (code == null) { code = HttpStatus.OK; // default to 200 }// ww w. j a v a 2 s. co m response.setStatus(code.value()); }
From source file:org.smigo.species.SpeciesController.java
@PreAuthorize("isAuthenticated()") @RequestMapping(value = "/rest/species", method = RequestMethod.POST) @ResponseBody/* w ww.jav a 2s .c o m*/ public Object addSpecies(@Valid @RequestBody Species species, BindingResult result, @AuthenticationPrincipal AuthenticatedUser user, Locale locale, HttpServletResponse response) { log.info("Adding species. Name:" + species); if (result.hasErrors()) { response.setStatus(HttpStatus.UNPROCESSABLE_ENTITY.value()); return result.getAllErrors(); } return speciesHandler.addSpecies(species, user, locale); }
From source file:org.wiredwidgets.cow.server.web.ProcessDefinitionsController.java
/** * DELETE method for URL /processDefinitions?key={key} * Deletes all deployments for the specified key. No executions of this process can be running. * @param key the process definition key */// w w w. ja v a 2s .co m @RequestMapping(method = RequestMethod.DELETE, params = { "key", "!versions" }) public void deleteProcessDef(@RequestParam("key") String key, HttpServletResponse response) { if (processDefsService.deleteProcessDefinitionsByKey(key)) { response.setStatus(HttpServletResponse.SC_NO_CONTENT); // 204 } else { response.setStatus(HttpServletResponse.SC_NOT_FOUND); // 404 } }
From source file:com.androgogic.AikauLoginController.java
/** * Overrides the default behaviour to return a simple JSON response. * /*from ww w . j a va 2 s. c om*/ * @param request The {@link HttpServletRequest} * @param response The {@link HttpServletResponse} * @throws Exception */ @Override protected void onSuccess(HttpServletRequest request, HttpServletResponse response) throws Exception { this.beforeSuccess(request, response); response.setStatus(HttpServletResponse.SC_OK); }
From source file:com.erudika.para.security.SimpleAuthenticationEntryPoint.java
@Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { if (isPreflight(request)) { response.setStatus(HttpServletResponse.SC_NO_CONTENT); } else if (isRestRequest(request)) { RestUtils.returnStatusResponse(response, HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage()); } else {//from ww w .j a v a 2s . co m super.commence(request, response, authException); } }
From source file:com.twitter.common.net.http.handlers.AssetHandler.java
private void setPayloadHeaders(HttpServletResponse resp) throws IOException { resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType(staticAsset.getContentType()); resp.setHeader("Cache-Control", "public,max-age=" + CACHE_CONTROL_MAX_AGE_SECS); String checksum = staticAsset.getChecksum(); if (checksum != null) { resp.setHeader("ETag", checksum); }/* w w w. ja v a 2 s . c o m*/ }
From source file:edu.cornell.library.scholars.webapp.controller.api.DistributeDataApiController.java
private void do403Forbidden(HttpServletResponse resp) throws IOException { log.debug("403Forbidden"); resp.setStatus(403); resp.getWriter().println("Not authorized for this action."); }
From source file:org.cloudfoundry.identity.uaa.login.AccountsController.java
private String handleUnprocessableEntity(Model model, HttpServletResponse response, String errorMessage) { model.addAttribute("error_message_code", errorMessage); response.setStatus(HttpStatus.UNPROCESSABLE_ENTITY.value()); return "accounts/new_activation_email"; }
From source file:cn.vlabs.umt.ui.servlet.LoginTokenServlet.java
/** * ? * */ private void error(HttpServletResponse response, String msg) { response.setStatus(403); LOGGER.error(msg); }