List of usage examples for javax.servlet.http HttpServletResponse setStatus
public void setStatus(int sc);
From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8.ChangePasswordController1_8.java
@ExceptionHandler(NullPointerException.class) @ResponseBody/*from www.j a v a2 s.co m*/ public SimpleObject handleNotFound(NullPointerException exception, HttpServletRequest request, HttpServletResponse response) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return RestUtil.wrapErrorResponse(exception, "User not found"); }
From source file:com.zoe.weiya.security.WwwAuthFilter.java
private void needAuthenticate(final HttpServletRequest request, final HttpServletResponse response) { response.setStatus(401); response.setHeader("Cache-Control", "no-store"); response.setDateHeader("Expires", 0); response.setHeader("WWW-authenticate", AUTH_PREFIX + "Realm=\"WeiYa Auth\""); }
From source file:com.company.project.web.controller.service.HttpLogoutSuccessHandler.java
@Override public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException { response.setStatus(HttpServletResponse.SC_OK); response.getWriter().flush();/* www . ja v a2 s .c o m*/ }
From source file:com.web.vehiclerouting.graphhopper.http.InvalidRequestServlet.java
@Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try {// w w w .j a va 2 s. c o m res.setStatus(HttpServletResponse.SC_NOT_FOUND); res.setContentType("text/plain"); res.setContentType("UTF-8"); JSONObject json = new JSONObject(); json.put("error_code", "404"); writeJson(req, res, json); } catch (JSONException ex) { Logger.getLogger(InvalidRequestServlet.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:net.duckling.ddl.web.agent.csp.CspBaseController.java
public void writeError(ErrorMsg msg, int status, HttpServletRequest request, HttpServletResponse response) { response.setStatus(status); JsonUtil.writeJSONP(request, response, msg, null, null); }
From source file:net.duckling.ddl.web.agent.csp.CspBaseController.java
public void writeError(ErrorMsg msg, HttpServletRequest request, HttpServletResponse response) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); JsonUtil.writeJSONP(request, response, msg, null); }
From source file:net.duckling.ddl.web.agent.csp.CspBaseController.java
@OnDeny("*") public void onDeny(String method, HttpServletRequest request, HttpServletResponse response) { response.setStatus(HttpServletResponse.SC_FORBIDDEN); JsonUtil.writeJSONP(request, response, ErrorMsg.NEED_PERMISSION, null, null); }
From source file:org.craftercms.security.utils.handlers.AbstractRestHandlerBase.java
protected <T> void sendObject(int status, T responseBody, RequestContext context) throws IOException { HttpServletRequest request = context.getRequest(); HttpServletResponse response = context.getResponse(); response.setStatus(status); try {//from ww w .j a v a2s.c om responseWriter.writeWithMessageConverters(responseBody, request, response); } catch (HttpMediaTypeNotAcceptableException e) { logger.error(e.getMessage(), e); response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); } }
From source file:org.osiam.addons.self_administration.exception.OsiamExceptionHandler.java
private ModelAndView createResponse(HttpServletResponse response, int httpStatus, String messageKey) { response.setStatus(httpStatus); modelAndView.addObject(KEY, messageKey); return modelAndView; }
From source file:com.dangdang.ddframe.job.console.security.WwwAuthFilter.java
private void authenticateSuccess(final HttpServletResponse response) { response.setStatus(200); response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-store"); response.setDateHeader("Expires", 0); }