List of usage examples for javax.servlet.http HttpServletResponse addHeader
public void addHeader(String name, String value);
From source file:org.ngrinder.security.SvnHttpBasicEntryPoint.java
@Override public void commence(HttpServletRequest request, HttpServletResponse response, // LB AuthenticationException authException) throws IOException, ServletException { // Get the first part of url path and use it as a realm. String pathInfo = request.getPathInfo(); String[] split = StringUtils.split(pathInfo, '/'); response.addHeader("WWW-Authenticate", "Basic realm=\"" + StringUtils.defaultIfBlank(split[0], "admin") + "\""); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage()); }
From source file:cn.shengyuan.yun.admin.system.controller.CommonController.java
/** * ??/*w w w. j a v a 2 s.co m*/ */ @RequestMapping("/unauthorized") public String unauthorized(HttpServletRequest request, HttpServletResponse response) { String requestType = request.getHeader("X-Requested-With"); if (requestType != null && requestType.equalsIgnoreCase("XMLHttpRequest")) { response.addHeader("loginStatus", "unauthorized"); try { response.sendError(HttpServletResponse.SC_FORBIDDEN); } catch (IOException e) { e.printStackTrace(); } return null; } return "/common/unauthorized"; }
From source file:org.reallysqs.server.views.CreateQueueResponseView.java
@Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { Queue queue = (Queue) model.get("queue"); String location = "http://" + request.getLocalName() + ":" + request.getLocalPort() + request.getContextPath() + request.getServletPath() + "/queues/" + queue.getName(); response.addHeader("Location", location); }
From source file:com.yoho.core.trace.instrument.web.TraceInterceptor.java
private void addToResponseIfNotPresent(HttpServletResponse response, String name, String value) { if (!hasText(response.getHeader(name))) { response.addHeader(name, value); }//from w ww . j a v a 2s.c o m }
From source file:de.thm.arsnova.controller.SessionController.java
@RequestMapping(value = "/{sessionKey}/lecturerquestion") public String redirectLecturerQuestion(@PathVariable final String sessionKey, final HttpServletResponse response) { response.addHeader(X_FORWARDED, "1"); return String.format("forward:/lecturerquestion/?sessionkey=%s", sessionKey); }
From source file:de.thm.arsnova.controller.SessionController.java
@RequestMapping(value = "/{sessionKey}/lecturerquestion/{arg1}") public String redirectLecturerQuestionWithOneArgument(@PathVariable final String sessionKey, @PathVariable final String arg1, final HttpServletResponse response) { response.addHeader(X_FORWARDED, "1"); return String.format("forward:/lecturerquestion/%s/?sessionkey=%s", arg1, sessionKey); }
From source file:de.thm.arsnova.controller.SessionController.java
@RequestMapping(value = "/{sessionKey}/lecturerquestion/{arg1}/{arg2}") public String redirectLecturerQuestionWithTwoArguments(@PathVariable final String sessionKey, @PathVariable final String arg1, @PathVariable final String arg2, final HttpServletResponse response) { response.addHeader(X_FORWARDED, "1"); return String.format("forward:/lecturerquestion/%s/%s/?sessionkey=%s", arg1, arg2, sessionKey); }
From source file:de.thm.arsnova.controller.SessionController.java
@RequestMapping(value = "/{sessionKey}/audiencequestion") public String redirectAudienceQuestion(@PathVariable final String sessionKey, final HttpServletResponse response) { response.addHeader(X_FORWARDED, "1"); return String.format("forward:/audiencequestion/?sessionkey=%s", sessionKey); }
From source file:de.thm.arsnova.controller.SessionController.java
@RequestMapping(value = "/{sessionKey}/audiencequestion/{arg1}") public String redirectAudienceQuestionWithOneArgument(@PathVariable final String sessionKey, @PathVariable final String arg1, final HttpServletResponse response) { response.addHeader(X_FORWARDED, "1"); return String.format("forward:/audiencequestion/%s/?sessionkey=%s", arg1, sessionKey); }
From source file:de.thm.arsnova.controller.SessionController.java
@RequestMapping(value = "/{sessionKey}/audiencequestion/{arg1}/{arg2}") public String redirectAudienceQuestionWithTwoArguments(@PathVariable final String sessionKey, @PathVariable final String arg1, @PathVariable final String arg2, final HttpServletResponse response) { response.addHeader(X_FORWARDED, "1"); return String.format("forward:/audiencequestion/%s/%s/?sessionkey=%s", arg1, arg2, sessionKey); }