3 * Copyright (C) 2012 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.remote
.json
;
14 import javax
.servlet
.http
.HttpServletRequest
;
17 * The JsonpRedirect is used to mimic redirects when using json ajax requests.
23 public class JsonpRedirect
{
25 private String redirectURL
= null;
27 public JsonpRedirect(String redirectURL
) {
28 this.redirectURL
= redirectURL
;
31 public JsonpRedirect(HttpServletRequest request
, String path
){
32 this.redirectURL
= request
.getScheme() + "://" + request
.getServerName() + ":" + request
.getServerPort() + "/" + request
.getContextPath() + path
;
35 public JsonpRedirect(String frontendBaseUrl
, String path
){
36 if(frontendBaseUrl
.endsWith("/")){
37 frontendBaseUrl
= frontendBaseUrl
.substring(0, frontendBaseUrl
.length() -1);
39 this.redirectURL
= frontendBaseUrl
+ path
;
42 public String
getRedirectURL() {
46 public void setRedirectURL(String redirectURL
) {
47 this.redirectURL
= redirectURL
;