Search in sources :

Example 1 with CurlHelper

use of org.codelibs.fess.helper.CurlHelper in project fess by codelibs.

the class AdminEsreqAction method getCurlRequest.

private CurlRequest getCurlRequest(final String header) {
    if (StringUtil.isBlank(header)) {
        return null;
    }
    final String[] values = header.split(" ");
    if (values.length != 2) {
        return null;
    }
    final String path;
    if (values[1].startsWith("/")) {
        path = values[1];
    } else {
        path = "/" + values[1];
    }
    final CurlHelper curlHelper = ComponentUtil.getCurlHelper();
    switch(values[0].toUpperCase(Locale.ROOT)) {
        case "GET":
            return curlHelper.get(path);
        case "POST":
            return curlHelper.post(path);
        case "PUT":
            return curlHelper.put(path);
        case "DELETE":
            return curlHelper.delete(path);
        default:
            break;
    }
    return null;
}
Also used : CurlHelper(org.codelibs.fess.helper.CurlHelper)

Aggregations

CurlHelper (org.codelibs.fess.helper.CurlHelper)1