List of usage examples for javax.servlet.http HttpServletResponse setStatus
public void setStatus(int sc);
From source file:org.tdar.struts.result.FreemarkerHttpHeaderResult.java
@Override protected void postTemplateProcess(Template template, TemplateModel data) throws IOException { super.postTemplateProcess(template, data); HttpServletResponse response = ServletActionContext.getResponse(); response.setStatus(status); if (!headers.isEmpty()) { // allow for ValueStack stack = ActionContext.getContext().getValueStack(); for (Map.Entry<String, String> header : headers.entrySet()) { @SuppressWarnings("unused") String value = TextParseUtil.translateVariables(header.getValue(), stack); response.setHeader(header.getKey(), header.getValue()); }/*from w w w .j a v a2s . c o m*/ } }
From source file:com.pafgames.controller.GameAPIController.java
@RequestMapping(value = "/new", method = RequestMethod.POST) public void addGame(HttpServletResponse response, @RequestBody PafGame game) { service.saveGame(game);//w w w. j a va2 s. c om response.setStatus(200); }
From source file:org.chtijbug.drools.platform.web.security.Http200LogoutSuccessHandler.java
@Override public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { response.setStatus(SC_OK); response.getWriter().write("Logged out"); }
From source file:io.github.chibat.selva.response.JsonResponse.java
public void execute(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { response.setStatus(this.status()); response.setContentType(this.type()); new ObjectMapper().writeValue(response.getWriter(), model); response.flushBuffer();// w ww . ja v a 2 s .co m }
From source file:core.NiprSyncController.java
@RequestMapping("/") public void index(HttpServletRequest request, HttpServletResponse response) { response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", "/login.html"); }
From source file:tarefas.controller.WebServicesController.java
@RequestMapping("/getFastestWay_admin.htm") public String getFastestWay(HttpServletResponse response) throws ClassNotFoundException, SQLException { DAOController db = new DAOController(); response.setStatus(200); return db.getFastestWay(); }
From source file:io.github.jhipster.security.AjaxAuthenticationSuccessHandler.java
@Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { response.setStatus(HttpServletResponse.SC_OK); }
From source file:cz.muni.fi.dndtroopsweb.security.ProtectFilter.java
private void response401(HttpServletResponse response) throws IOException { response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); response.setHeader("WWW-Authenticate", "Basic realm=\"type name and password\""); response.getWriter()//from w w w.j a v a 2s. co m .println("<html><body><h1>401 Unauthorized Access</h1> Destruction in 5..4..3..</body></html>"); }
From source file:net.nan21.dnet.core.web.security.DefaultNotAuthenticatedEntryPoint.java
@Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { response.setStatus(HttpServletResponse.SC_FORBIDDEN); response.getWriter().write("Not authenticated"); response.flushBuffer();// ww w . j a v a 2 s.c om }
From source file:org.chtijbug.drools.platform.web.security.Http401UnauthorizedEntryPoint.java
@Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); response.getWriter().write("Need authentication"); }