List of usage examples for javax.servlet.http HttpServletResponse setStatus
public void setStatus(int sc);
From source file:fr.treeptik.cloudunit.config.UserAjaxLogoutSuccessHandler.java
@Override public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { logger.info("SC_OK"); response.setStatus(HttpServletResponse.SC_OK); }
From source file:com.adobe.acs.commons.oak.impl.EnsureOakIndexServlet.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) { try {// w w w. j a v a 2 s . com response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED); response.getWriter().println("<pre>"); response.getWriter().println(); response.getWriter().println(); response.getWriter().println("HTTP method GET is not supported by this URL"); response.getWriter().println("Use HTTP POST to access this end-point"); response.getWriter().println("--------------------------------------------"); response.getWriter().println("HTTP POST /system/console/ensure-oak-index"); response.getWriter().println(" Parameters"); response.getWriter().println(" * force = true | false (optional; when blank defaults to false)"); response.getWriter() .println(" * path = /abs/path/to/ensure/definition (optional; when blank indicates all)"); response.getWriter().println(); response.getWriter().println(); response.getWriter().println( "Example: curl --user admin:admin --data \"force=true\" https://localhost:4502/system/console/ensure-oak-index"); response.getWriter().println("</pre>"); } catch (IOException e) { log.warn("Caught IOException while handling doGet() in the Ensure Oak Index Servlet.", e); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
From source file:cn.org.once.cstack.config.UserAjaxLogoutSuccessHandler.java
@Override public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { logger.debug("SC_OK"); response.setStatus(HttpServletResponse.SC_OK); }
From source file:com.dangdang.ddframe.job.security.WwwAuthFilter.java
private void authenticateSuccess(final HttpServletResponse response, final boolean isGuest) { response.setStatus(200); response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-store"); response.setDateHeader("Expires", 0); response.setHeader("identify", isGuest ? GUEST_IDENTIFY : ROOT_IDENTIFY); }
From source file:com.androgogic.AikauLoginController.java
/** * Overrides the default behaviour to return a simple JSON response. * /* ww w . j a v a2 s. c om*/ * @param request The {@link HttpServletRequest} * @param response The {@link HttpServletResponse} * @throws Exception */ @Override protected void onFailure(HttpServletRequest request, HttpServletResponse response) throws Exception { response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); }
From source file:com.skcraft.launcher.creator.server.LatestHandler.java
@Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/plain; charset=utf-8"); response.setStatus(HttpServletResponse.SC_OK); LatestVersionInfo info = new LatestVersionInfo(); info.setVersion("0.0.0"); info.setUrl(new URL("http://localhost")); mapper.writeValue(response.getWriter(), info); baseRequest.setHandled(true);// w w w . ja va 2s.c om }
From source file:org.kordamp.javatrove.todo02.servlet.AbstractRoute.java
@Override public void handle(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ModelAndView modelAndView = doHandle(req, resp); resp.setStatus(200); if (shouldReturnHtml(req)) { resp.setContentType("text/html"); MustacheFactory mf = new DefaultMustacheFactory("templates"); Mustache mustache = mf.compile(modelAndView.getViewName()); mustache.execute(resp.getWriter(), modelAndView.getModel()).flush(); } else {//w w w. ja v a2 s. co m resp.setContentType("application/json"); resp.getWriter().write(objectMapper.writeValueAsString(modelAndView.getModel())); } }
From source file:net.sf.j2ep.responsehandlers.OptionsResponseHandler.java
/** * Will check if we are to handle this request, if so * the http methods allowed by this proxy is returned in the * Allow header.//from w ww . j av a 2s .c o m * If it is a request meant for the backing server its * allowed method will be returned. * * @see net.sf.j2ep.model.ResponseHandler#process(javax.servlet.http.HttpServletResponse) */ public void process(HttpServletResponse response) { if (useOwnAllow) { response.setStatus(HttpServletResponse.SC_OK); response.setHeader("allow", AllowedMethodHandler.getAllowHeader()); response.setHeader("Connection", "close"); response.setHeader("content-length", "0"); } else { setHeaders(response); response.setStatus(getStatusCode()); String allow = method.getResponseHeader("allow").getValue(); response.setHeader("allow", AllowedMethodHandler.processAllowHeader(allow)); Header contentLength = method.getResponseHeader("Content-Length"); if (contentLength == null || contentLength.getValue().equals("0")) { response.setHeader("Content-Length", "0"); } else { try { sendStreamToClient(response); } catch (IOException e) { log.error("Problem with writing response stream, solving by setting Content-Length=0", e); response.setHeader("Content-Length", "0"); } } } }
From source file:io.kamax.mxisd.controller.DefaultExceptionHandler.java
@ExceptionHandler(HttpMatrixException.class) public String handleGeneric(HttpServletRequest request, HttpServletResponse response, HttpMatrixException e) { response.setStatus(e.getStatus()); return handle(request, e.getErrorCode(), e.getError()); }
From source file:net.gplatform.sudoor.server.security.model.ResponseCodeHandler.java
@Override public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { response.setStatus(responseCode); }