Java Code Examples for javax.servlet.http.HttpServletResponse#SC_SEE_OTHER
The following examples show how to use
javax.servlet.http.HttpServletResponse#SC_SEE_OTHER .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityHttpServletResponse.java From sakai with Educational Community License v2.0 | 6 votes |
/** * @return the URL this response was forwarded or redirected to OR null if not redirected */ public String getRedirectedUrl() { String url = this.redirectedUrl; if (url == null) { if ( isRedirected() ) { url = this.getForwardedUrl(); if (url == null) { url = this.getIncludedUrl(); } if (this.getStatus() == HttpServletResponse.SC_MOVED_PERMANENTLY || this.getStatus() == HttpServletResponse.SC_SEE_OTHER || this.getStatus() == HttpServletResponse.SC_TEMPORARY_REDIRECT) { // get the location String newLocation = this.getHeader("Location"); if (newLocation == null) { newLocation = this.getHeader("location"); } if (newLocation != null) { url = newLocation; } } } } return url; }
Example 2
Source File: EntityHttpServletResponse.java From sakai with Educational Community License v2.0 | 6 votes |
/** * @return the URL this response was forwarded or redirected to OR null if not redirected */ public String getRedirectedUrl() { String url = this.redirectedUrl; if (url == null) { if ( isRedirected() ) { url = this.getForwardedUrl(); if (url == null) { url = this.getIncludedUrl(); } if (this.getStatus() == HttpServletResponse.SC_MOVED_PERMANENTLY || this.getStatus() == HttpServletResponse.SC_SEE_OTHER || this.getStatus() == HttpServletResponse.SC_TEMPORARY_REDIRECT) { // get the location String newLocation = this.getHeader("Location"); if (newLocation == null) { newLocation = this.getHeader("location"); } if (newLocation != null) { url = newLocation; } } } } return url; }
Example 3
Source File: RedirectRequestHandler.java From onedev with MIT License | 5 votes |
/** * @param redirectUrl * URL to redirect to. * @param status * 301 (Moved permanently) or 302 (Moved temporarily) */ public RedirectRequestHandler(final String redirectUrl, final int status) { if ((status != HttpServletResponse.SC_MOVED_PERMANENTLY) && (status != HttpServletResponse.SC_MOVED_TEMPORARILY) && (status != HttpServletResponse.SC_SEE_OTHER)) { throw new IllegalStateException("Status must be either 301, 302 or 303, but was: " + status); } this.redirectUrl = Args.notEmpty(redirectUrl, "redirectUrl"); this.status = status; }
Example 4
Source File: AppEngineHttpFetcher.java From openid4java with Apache License 2.0 | 5 votes |
private static boolean isRedirect(int responseCode) { switch (responseCode) { case HttpServletResponse.SC_MOVED_PERMANENTLY: case HttpServletResponse.SC_MOVED_TEMPORARILY: case HttpServletResponse.SC_SEE_OTHER: case HttpServletResponse.SC_TEMPORARY_REDIRECT: return true; default: return false; } }
Example 5
Source File: EntityHttpServletResponse.java From sakai with Educational Community License v2.0 | 5 votes |
/** * @return true if this response was redirected */ public boolean isRedirected() { boolean redirected = false; if (this.getForwardedUrl() != null || this.getStatus() == HttpServletResponse.SC_FOUND || this.getStatus() == HttpServletResponse.SC_MOVED_PERMANENTLY || this.getStatus() == HttpServletResponse.SC_SEE_OTHER || this.getStatus() == HttpServletResponse.SC_TEMPORARY_REDIRECT) { redirected = true; } return redirected; }
Example 6
Source File: EntityHttpServletResponse.java From sakai with Educational Community License v2.0 | 5 votes |
/** * @return true if this response was redirected */ public boolean isRedirected() { boolean redirected = false; if (this.getForwardedUrl() != null || this.getStatus() == HttpServletResponse.SC_FOUND || this.getStatus() == HttpServletResponse.SC_MOVED_PERMANENTLY || this.getStatus() == HttpServletResponse.SC_SEE_OTHER || this.getStatus() == HttpServletResponse.SC_TEMPORARY_REDIRECT) { redirected = true; } return redirected; }