Project

General

Profile

Download (1.19 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.remote.json;
10

    
11
import javax.servlet.http.HttpServletRequest;
12

    
13
import org.apache.log4j.Logger;
14

    
15
/**
16
 * @author a.kohlbecker
17
 * @since Jan 26, 2017
18
 *
19
 */
20
public class JsonpUtil {
21

    
22
    public static final Logger logger = Logger.getLogger(JsonpUtil.class);
23

    
24
    /**
25
     * @param request
26
     * @return
27
     */
28
    static public String readJsonpCallback(HttpServletRequest request) {
29
        String jsonpCallback= null;
30
        String queryString = request.getQueryString();
31
        if(queryString != null){
32
            String[] tokens = request.getQueryString().split("&", 0);
33
            String jsonpParamName = "callback";
34
            for (int i = 0; i < tokens.length; i++) {
35
                if(tokens[i].startsWith(jsonpParamName)){
36
                    jsonpCallback = tokens[i].substring(jsonpParamName.length() + 1);
37
                    break;
38
                }
39
            }
40
        }
41
        return jsonpCallback;
42
    }
43

    
44
}
(3-3/3)