Example usage for org.apache.commons.httpclient NameValuePair NameValuePair

List of usage examples for org.apache.commons.httpclient NameValuePair NameValuePair

Introduction

In this page you can find the example usage for org.apache.commons.httpclient NameValuePair NameValuePair.

Prototype

public NameValuePair(String name, String value) 

Source Link

Document

Constructor.

Usage

From source file:com.cloudmade.api.CMClient.java

/**
 * Find closest object of the given type to a given point.
 * <p>// w  ww  .j av  a2s  .c om
 * For a list of available object types, see: <a href="http://www.cloudmade.com/developers/docs/geocoding-http-api/object_types">
 * http://www.cloudmade.com/developers/docs/geocoding-http-api/object_types </a>
 * </p>
 * 
 * @param object_type Type of object, that should be searched
 * @param point Closes object to this point will be searched.
 * @return found object
 * @throws ObjectNotFoundException Thrown when no object could be found in radius of 50 km from point.
 */
public GeoResult findClosest(String object_type, Point point) throws ObjectNotFoundException {
    byte[] response = {};

    try {
        String uri = String.format("/geocoding/closest/%s/%s.js", URLEncoder.encode(object_type, "UTF-8"),
                point.toString());
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new NameValuePair("return_geometry", "true"));
        params.add(new NameValuePair("return_location", "true"));
        response = callService(uri, "geocoding", params.toArray(new NameValuePair[0]));
        String str = new String(response, "UTF-8");
        JSONObject obj = new JSONObject(str);
        if (!obj.has("features")) {
            throw new ObjectNotFoundException(
                    "No object of the secified type could be" + " found in radius of 50 km from point");
        }
        GeoResult result = Utils.geoResultFromJson(obj.getJSONArray("features").getJSONObject(0));
        return result;
    } catch (org.json.JSONException jse) {
        throw new RuntimeException("Error building a JSON object from the " + "geocoding service response:\n"
                + new String(response, 0, 500), jse);
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    }

}

From source file:edu.uci.ics.pregelix.example.util.TestExecutor.java

public InputStream executeQuery(String str, OutputFormat fmt, String url,
        List<CompilationUnit.Parameter> params) throws Exception {
    HttpMethodBase method = null;/* w w w.j  a  v a 2s. c  o m*/
    if (str.length() + url.length() < MAX_URL_LENGTH) {
        //Use GET for small-ish queries
        method = new GetMethod(url);
        NameValuePair[] parameters = new NameValuePair[params.size() + 1];
        parameters[0] = new NameValuePair("query", str);
        int i = 1;
        for (CompilationUnit.Parameter param : params) {
            parameters[i++] = new NameValuePair(param.getName(), param.getValue());
        }
        method.setQueryString(parameters);
    } else {
        //Use POST for bigger ones to avoid 413 FULL_HEAD
        // QQQ POST API doesn't allow encoding additional parameters
        method = new PostMethod(url);
        ((PostMethod) method).setRequestEntity(new StringRequestEntity(str));
    }

    //Set accepted output response type
    method.setRequestHeader("Accept", fmt.mimeType());
    // Provide custom retry handler is necessary
    method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
            new DefaultHttpMethodRetryHandler(3, false));
    executeHttpMethod(method);
    return method.getResponseBodyAsStream();
}

From source file:com.comcast.cats.service.util.HttpClientUtil.java

/**
 * A generic method to create NameValuePair from Map.
 * /*from w  w w  . j  a  v  a2s . com*/
 * @param paramMap
 * @return
 */
private static synchronized NameValuePair[] getNameValuePair(Map<String, String> paramMap) {
    List<NameValuePair> parametersList = new ArrayList<NameValuePair>();

    for (Map.Entry<String, String> entry : paramMap.entrySet()) {
        String key = entry.getKey();
        String value = entry.getValue();

        if ((null != key) && (null != value) && (!key.isEmpty()) && (!value.isEmpty())) {
            NameValuePair nameValuePair = new NameValuePair(key, value);
            parametersList.add(nameValuePair);
        }
    }

    NameValuePair[] parameters = parametersList.toArray(new NameValuePair[parametersList.size()]);

    return parameters;
}

From source file:com.github.maven.plugin.client.impl.GithubClientImpl.java

/**
 * Retrieves the download informations associated to the given repository
 * url.//from  w w  w  . j av a2s  .  c  o  m
 *
 * @param repositoryUrl The repository url.
 *
 * @return A map containing the downloads informations.
 */
private Map<String, Integer> retrieveDownloadsInfos(String repositoryUrl) {
    final Map<String, Integer> downloads = new HashMap<String, Integer>();

    GetMethod githubGet = new GetMethod(toRepositoryDownloadUrl(repositoryUrl));
    githubGet.setQueryString(
            new NameValuePair[] { new NameValuePair("login", login), new NameValuePair("token", token) });

    int response;

    try {

        response = httpClient.executeMethod(githubGet);
    } catch (IOException e) {
        throw new GithubRepositoryNotFoundException(
                "Cannot retrieve github repository " + repositoryUrl + " informations", e);
    }

    if (response == HttpStatus.SC_OK) {

        String githubResponse;

        try {

            githubResponse = githubGet.getResponseBodyAsString();
        } catch (IOException e) {
            throw new GithubRepositoryNotFoundException(
                    "Cannot retrieve github repository " + repositoryUrl + "  informations", e);
        }

        Pattern pattern = Pattern.compile(
                String.format("<a href=\"(/downloads)?%s/?([^\"]+)\"", removeGithubUrlPart(repositoryUrl)));

        Matcher matcher = pattern.matcher(githubResponse);
        while (matcher.find()) {
            String tmp = matcher.group(2);

            if (tmp.contains("downloads")) {
                String id = matcher.group(2).substring(tmp.lastIndexOf('/') + 1, tmp.length());
                Integer downloadId = Integer.parseInt(id);
                if (matcher.find()) {
                    downloads.put(matcher.group(2), downloadId);
                }
            }
        }

    } else if (response == HttpStatus.SC_NOT_FOUND) {
        throw new GithubRepositoryNotFoundException("Cannot found repository " + repositoryUrl);
    } else {
        throw new GithubRepositoryNotFoundException(
                "Cannot retrieve github repository " + repositoryUrl + " informations");
    }

    githubGet.releaseConnection();

    return downloads;
}

From source file:com.taobao.diamond.sdkapi.impl.DiamondSDKManagerImpl.java

private ContextResult processPulishByDefinedServerId(String dataId, String groupName, String context,
        String serverId) {//from  w  w  w.ja  v a 2 s .c o m
    ContextResult response = new ContextResult();
    // 
    if (!login(serverId)) {
        response.setSuccess(false);
        response.setStatusMsg(",serverId");
        return response;
    }
    if (log.isDebugEnabled())
        log.debug("processPulishByDefinedServerId(" + dataId + "," + groupName + "," + context + ","
                + serverId + ")");

    String postUrl = "/diamond-server/admin.do?method=postConfig";
    PostMethod post = new PostMethod(postUrl);
    // 
    post.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, require_timeout);
    try {
        NameValuePair dataId_value = new NameValuePair("dataId", dataId);
        NameValuePair group_value = new NameValuePair("group", groupName);
        NameValuePair content_value = new NameValuePair("content", context);

        // 
        post.setRequestBody(new NameValuePair[] { dataId_value, group_value, content_value });
        // 
        ConfigInfo configInfo = new ConfigInfo();
        configInfo.setDataId(dataId);
        configInfo.setGroup(groupName);
        configInfo.setContent(context);
        if (log.isDebugEnabled())
            log.debug("ConfigInfo: " + configInfo);
        // 
        response.setConfigInfo(configInfo);
        // http
        int status = client.executeMethod(post);
        response.setReceiveResult(post.getResponseBodyAsString());
        response.setStatusCode(status);
        log.info("" + status + "," + post.getResponseBodyAsString());
        if (status == HttpStatus.SC_OK) {
            response.setSuccess(true);
            response.setStatusMsg("");
            log.info(", dataId=" + dataId + ",group=" + groupName + ",content=" + context
                    + ",serverId=" + serverId);
        } else if (status == HttpStatus.SC_REQUEST_TIMEOUT) {
            response.setSuccess(false);
            response.setStatusMsg(", :" + require_timeout + "");
            log.error(":" + require_timeout + ", dataId=" + dataId + ",group="
                    + groupName + ",content=" + context + ",serverId=" + serverId);
        } else {
            response.setSuccess(false);
            response.setStatusMsg(", :" + status);
            log.error(":" + response.getReceiveResult() + ",dataId=" + dataId + ",group="
                    + groupName + ",content=" + context + ",serverId=" + serverId);
        }
    } catch (HttpException e) {
        response.setStatusMsg("HttpException" + e.getMessage());
        log.error("HttpException: dataId=" + dataId + ",group=" + groupName + ",content=" + context
                + ",serverId=" + serverId, e);
    } catch (IOException e) {
        response.setStatusMsg("IOException" + e.getMessage());
        log.error("IOException: dataId=" + dataId + ",group=" + groupName + ",content=" + context
                + ",serverId=" + serverId, e);
    } finally {
        // 
        post.releaseConnection();
    }

    return response;
}

From source file:net.neurowork.cenatic.centraldir.workers.XMLRestWorker.java

private void buscarOrganizacion(String token) {
    Organizacion organizacion = null;//from  w  ww .java  2s .co m
    if (logger.isDebugEnabled())
        logger.debug("Buscando Organizaciones para Satelite: " + satelite);

    HttpClient httpclient = getHttpClient();

    GetMethod get = new GetMethod(restUrl.getOrganizacionUrl());
    get.addRequestHeader("Accept", "application/xml");
    NameValuePair tokenParam = new NameValuePair("token", token);
    int id = 0;
    //      if(satelite.getLastOrgId() != null) 
    //         id = satelite.getLastOrgId();

    int leap = idLeap;

    while (true) {
        id = id + 1;

        if (logger.isTraceEnabled()) {
            logger.trace("Buscando Organizacion con id: " + id + " en el Satelite: " + satelite);
        }

        NameValuePair passwordParam = new NameValuePair("id", String.valueOf(id));
        NameValuePair[] params = new NameValuePair[] { tokenParam, passwordParam };

        get.setQueryString(params);
        String queryString = get.getQueryString();

        int statusCode;
        try {
            if (logger.isTraceEnabled()) {
                logger.trace("Query String: " + queryString);
            }

            statusCode = httpclient.executeMethod(get);
            if (statusCode != HttpStatus.SC_OK) {
                logger.error("Method failed: " + get.getStatusLine());
            } else {
                String xmlString = get.getResponseBodyAsString();
                if (logger.isInfoEnabled()) {
                    logger.info("Xml Received.");
                }

                String xmlHash = constructXmlHash(xmlString);

                organizacion = organizacionService.findByHash(xmlHash);
                if (organizacion == null) {
                    organizacion = parseOrganizacion(xmlString);
                    if (organizacion == null) {
                        leap--;
                        if (leap <= 0) {
                            logger.info("Se lleg al fin de las Organizaciones. Saliendo del Satelite: "
                                    + satelite);
                            break;
                        } else {
                            logger.info("Leap: " + leap);
                        }
                    } else {
                        if (organizacion.getSatelites() == null) {
                            organizacion.setSatelites(new HashSet<OrganizacionSatelite>());
                        }
                        boolean sateliteFound = false;
                        for (OrganizacionSatelite sat : organizacion.getSatelites()) {
                            if (sat.getSatelite().getName().equals(satelite.getName())) {
                                sateliteFound = true;
                                break;
                            }
                        }
                        if (!sateliteFound) {
                            OrganizacionSatelite newSat = new OrganizacionSatelite();
                            newSat.setSatelite(satelite);
                            newSat.setOrganizacion(organizacion);
                            organizacion.getSatelites().add(newSat);
                        }

                        organizacion.setXmlHash(xmlHash);
                        organizacionService.saveOrganization(organizacion);

                        int numEmpresas = 0;
                        if (satelite.getNumEmpresas() != null) {
                            numEmpresas = satelite.getNumEmpresas();
                        }
                        numEmpresas++;

                        Date now = new Date();
                        satelite.setNumEmpresas(numEmpresas);
                        satelite.setLastRetrieval(new Timestamp(now.getTime()));
                        satelite.setLastOrgId(id);
                        sateliteService.saveSatelite(satelite);
                    }
                } else {
                    if (logger.isInfoEnabled()) {
                        logger.info("Organizacion with id: " + id + " already in centraldir");
                    }
                }
            }
        } catch (HttpException e) {
            logger.error(e.getMessage());
        } catch (IOException e) {
            logger.error(e.getMessage());
        } catch (ParserConfigurationException e) {
            logger.error(e.getMessage());
        } catch (SAXException e) {
            logger.error(e.getMessage());
        } catch (ServiceException e) {
            logger.error(e.getMessage());
        } catch (NoSuchAlgorithmException e) {
            logger.error(e.getMessage());
        } finally {
            get.releaseConnection();
        }
    }

}

From source file:it.geosolutions.geoserver.rest.publisher.GeoserverRESTShapeTest.java

@Test
public void testPublishDeleteShapeZipWithParams() throws FileNotFoundException, IOException {
    if (!enabled()) {
        return;/*from   w  w w .  j a va2 s  .c o m*/
    }
    deleteAllWorkspacesRecursively();
    //        Assume.assumeTrue(enabled);
    assertTrue(publisher.createWorkspace(DEFAULT_WS));

    String storeName = "resttestshp";
    String layerName = "cities";

    File zipFile = new ClassPathResource("testdata/resttestshp.zip").getFile();

    // known state?
    publisher.removeDatastore(DEFAULT_WS, storeName, true);

    // test insert
    boolean published = publisher.publishShp(DEFAULT_WS, storeName, layerName, zipFile, "EPSG:4326",
            new NameValuePair("charset", "UTF-8"));
    assertTrue("publish() failed", published);
    assertTrue(existsLayer(layerName));

    RESTLayer layer = reader.getLayer(layerName);

    LOGGER.info("Layer style is " + layer.getDefaultStyle());

    //test delete
    boolean ok = publisher.unpublishFeatureType(DEFAULT_WS, storeName, layerName);
    assertTrue("Unpublish() failed", ok);
    assertFalse(existsLayer(layerName));

    // remove also datastore
    boolean dsRemoved = publisher.removeDatastore(DEFAULT_WS, storeName);
    assertTrue("removeDatastore() failed", dsRemoved);

}

From source file:com.dtolabs.client.utils.BaseFormAuthenticator.java

/**
 * Authenticate the client http state so that the colony requests can be made.
 *
 * @param baseURL URL requested for colony
 * @param client  HttpClient instance/*  w ww . ja v a2  s. c  o  m*/
 *
 * @return true if authentication succeeded.
 *
 * @throws com.dtolabs.client.utils.HttpClientException
 *
 */
public boolean authenticate(final URL baseURL, final HttpClient client) throws HttpClientException {
    final HttpState state = client.getState();
    if (hasSessionCookie(baseURL, state, basePath)) {
        return true;
    }
    final byte[] buffer = new byte[1024];

    boolean doPostLogin = false;
    boolean isLoginFormContent = false;
    logger.debug("No session found, must login...");
    try {
        final URL newUrl = new URL(baseURL.getProtocol(), baseURL.getHost(), baseURL.getPort(),
                basePath + getInitialPath());

        //load welcome page, which should forward to form based logon page.
        final GetMethod get = new GetMethod(newUrl.toExternalForm());
        get.setDoAuthentication(false);
        get.setFollowRedirects(false);
        logger.debug("Requesting: " + newUrl);
        int res = client.executeMethod(get);
        logger.debug("Result is: " + res);

        /*
          Tomcat container auth behaves differently than Jetty.  Tomcat will respond 200 OK and include the login form
          when auth is required, as well as on auth failure, it will also require complete GET of original URL after
          successful auth.
          Jetty will redirect to login page when auth is required, and will redirect to error page on failure.
         */

        String body = get.getResponseBodyAsString();
        if (null != body && body.contains(J_SECURITY_CHECK) && body.contains(JAVA_USER_PARAM)
                && body.contains(JAVA_PASS_PARAM)) {
            isLoginFormContent = true;
        }
        get.releaseConnection();

        if ((res == HttpStatus.SC_UNAUTHORIZED)) {
            if (get.getResponseHeader("WWW-Authenticate") != null
                    && get.getResponseHeader("WWW-Authenticate").getValue().matches("^Basic.*")) {
                logger.warn("Form-based login received UNAUTHORIZED, trying to use Basic authentication");
                final BasicAuthenticator auth = new BasicAuthenticator(username, password);
                return auth.authenticate(baseURL, client);
            } else {
                throw new HttpClientException(
                        "Form-based login received UNAUTHORIZED, but didn't recognize it as Basic authentication: unable to get a session");
            }

        }
        //should now have the proper session cookie
        if (!hasSessionCookie(baseURL, state, basePath)) {
            throw new HttpClientException("Unable to get a session from URL : " + newUrl);
        }
        if (res == HttpStatus.SC_OK && isLoginFormContent) {
            doPostLogin = true;
        } else if ((res == HttpStatus.SC_MOVED_TEMPORARILY) || (res == HttpStatus.SC_MOVED_PERMANENTLY)
                || (res == HttpStatus.SC_SEE_OTHER) || (res == HttpStatus.SC_TEMPORARY_REDIRECT)) {
            Header locHeader = get.getResponseHeader("Location");
            if (locHeader == null) {
                throw new HttpClientException("Redirect with no Location header, request URL: " + newUrl);
            }
            String location = locHeader.getValue();
            if (!isValidLoginRedirect(get)) {
                //unexpected response
                throw new HttpClientException("Unexpected redirection when getting session: " + location);
            }
            logger.debug("Follow redirect: " + res + ": " + location);

            final GetMethod redir = new GetMethod(location);
            redir.setFollowRedirects(true);
            res = client.executeMethod(redir);
            InputStream ins = redir.getResponseBodyAsStream();
            while (ins.available() > 0) {
                //read and discard response body
                ins.read(buffer);
            }
            redir.releaseConnection();

            if (res != HttpStatus.SC_OK) {
                throw new HttpClientException("Login page status was not OK: " + res);
            }
            logger.debug("Result: " + res);

            doPostLogin = true;
        } else if (res != HttpStatus.SC_OK) {
            //if request to welcome page was OK, we figure that the session is already set
            throw new HttpClientException("Request to welcome page returned error: " + res + ": " + get);
        }
        if (doPostLogin) {
            //now post login
            final URL loginUrl = new URL(baseURL.getProtocol(), baseURL.getHost(), baseURL.getPort(),
                    basePath + JAVA_AUTH_PATH);

            final PostMethod login = new PostMethod(loginUrl.toExternalForm());
            login.setRequestBody(new NameValuePair[] { new NameValuePair(JAVA_USER_PARAM, getUsername()),
                    new NameValuePair(JAVA_PASS_PARAM, getPassword()) });

            login.setFollowRedirects(false);
            logger.debug("Post login info to URL: " + loginUrl);

            res = client.executeMethod(login);

            final InputStream ins = login.getResponseBodyAsStream();
            while (ins.available() > 0) {
                //read and discard response body
                ins.read(buffer);
            }
            login.releaseConnection();

            Header locHeader = login.getResponseHeader("Location");
            String location = null != locHeader ? locHeader.getValue() : null;
            if (isLoginError(login)) {
                logger.error("Form-based auth failed");
                return false;
            } else if (null != location && !location.equals(newUrl.toExternalForm())) {

                logger.warn("Form-based auth succeeded, but last URL was unexpected");
            }
            if (isFollowLoginRedirect()
                    && ((res == HttpStatus.SC_MOVED_TEMPORARILY) || (res == HttpStatus.SC_MOVED_PERMANENTLY)
                            || (res == HttpStatus.SC_SEE_OTHER) || (res == HttpStatus.SC_TEMPORARY_REDIRECT))) {

                if (location == null) {
                    throw new HttpClientException("Redirect with no Location header, request URL: " + newUrl);
                }
                final GetMethod get2 = new GetMethod(location);
                //                    logger.debug("Result: " + res + ": " + location + ", following redirect");
                res = client.executeMethod(get2);
            } else if (res != HttpStatus.SC_OK) {
                throw new HttpClientException(
                        "Login didn't seem to work: " + res + ": " + login.getResponseBodyAsString());
            }
            logger.debug("Result: " + res);
        }
    } catch (MalformedURLException e) {
        throw new HttpClientException("Bad URL", e);
    } catch (HttpException e) {
        throw new HttpClientException("HTTP Error: " + e.getMessage(), e);
    } catch (IOException e) {
        throw new HttpClientException(
                "Error occurred while trying to authenticate to server: " + e.getMessage(), e);
    }

    return true;
}

From source file:com.sonyericsson.hudson.plugins.multislaveconfigplugin.UIHudsonTest.java

/**
 * This test tries to configure the job restrictions plugin with help from multislave.
 * @throws Exception on failure./*from   w  w  w. j a v  a2 s .  c om*/
 */
public void testConfigureJobRestrictionsNodeProperty() throws Exception {
    //Takes the web client to "search for slaves"-page.
    clickLinkOnCurrentPage(CONFIGURE);

    searchForAndSelectAllSlaves();

    // Instead of requesting the page directly we create a WebRequestSettings object
    WebRequestSettings requestSettings = new WebRequestSettings(
            webClient.createCrumbedUrl(NodeManageLink.URL + "/apply"), HttpMethod.POST);

    // Then we set the request parameters
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new NameValuePair("json", "{\"addOrChangeProperties\": { \"\": \"5\", \"jobRestriction\": "
            + "{ \"stapler-class\": \"com.synopsys.arc.jenkinsci.plugins.jobrestrictions."
            + "restrictions.job.RegexNameRestriction\", \"regexExpression\": \"testtest\", "
            + "\"checkShortName\": false }, \"stapler-class\": \"com.synopsys.arc.jenkinsci."
            + "plugins.jobrestrictions.nodes.JobRestrictionProperty\", \"kind\": \"com.synopsys.arc.jenkinsci."
            + "plugins.jobrestrictions.nodes.JobRestrictionProperty\" }}"));
    params.add(new NameValuePair("Submit", "Save"));

    requestSettings.setRequestParameters(params);

    webClient.getPage(requestSettings);

    List<Node> registeredNodes = hudson.getNodes();
    List<NodeProperty<?>> list = ((Slave) registeredNodes.get(0)).getNodeProperties().toList();

    JobRestrictionProperty jobRestrictionProperty = (JobRestrictionProperty) list.get(0);
    RegexNameRestriction restriction = (RegexNameRestriction) jobRestrictionProperty.getJobRestriction();
    assertEquals(restriction.getRegexExpression(), "testtest");

}

From source file:cn.leancloud.diamond.sdkapi.impl.DiamondSDKManagerImpl.java

private ContextResult processPulishByDefinedServerId(String dataId, String groupName, String context,
        String serverId) {//from w  ww. j  a  v a2s .co m
    ContextResult response = new ContextResult();
    // 
    if (!login(serverId)) {
        response.setSuccess(false);
        response.setStatusMsg(",??serverId?");
        return response;
    }
    if (log.isDebugEnabled())
        log.debug("processPulishByDefinedServerId(" + dataId + "," + groupName + "," + context + ","
                + serverId + ")?");

    String postUrl = "/diamond-server/admin.do?method=postConfig";
    PostMethod post = new PostMethod(postUrl);
    // 
    post.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, require_timeout);
    try {
        NameValuePair dataId_value = new NameValuePair("dataId", dataId);
        NameValuePair group_value = new NameValuePair("group", groupName);
        NameValuePair content_value = new NameValuePair("content", context);

        // ?
        post.setRequestBody(new NameValuePair[] { dataId_value, group_value, content_value });
        // ?
        ConfigInfo configInfo = new ConfigInfo();
        configInfo.setDataId(dataId);
        configInfo.setGroup(groupName);
        configInfo.setContent(context);
        if (log.isDebugEnabled())
            log.debug("?ConfigInfo: " + configInfo);
        // ??
        response.setConfigInfo(configInfo);
        // http??
        int status = client.executeMethod(post);
        response.setReceiveResult(post.getResponseBodyAsString());
        response.setStatusCode(status);
        log.info("??" + status + ",?" + post.getResponseBodyAsString());
        if (status == HttpStatus.SC_OK) {
            response.setSuccess(true);
            response.setStatusMsg("???");
            log.info("???, dataId=" + dataId + ",group=" + groupName + ",content=" + context
                    + ",serverId=" + serverId);
        } else if (status == HttpStatus.SC_REQUEST_TIMEOUT) {
            response.setSuccess(false);
            response.setStatusMsg("??, :" + require_timeout + "");
            log.error("??:" + require_timeout + ", dataId="
                    + dataId + ",group=" + groupName + ",content=" + context + ",serverId=" + serverId);
        } else {
            response.setSuccess(false);
            response.setStatusMsg("??, ??:" + status);
            log.error("??:" + response.getReceiveResult() + ",dataId=" + dataId + ",group="
                    + groupName + ",content=" + context + ",serverId=" + serverId);
        }
    } catch (HttpException e) {
        response.setStatusMsg("???HttpException" + e.getMessage());
        log.error("???HttpException: dataId=" + dataId + ",group=" + groupName + ",content="
                + context + ",serverId=" + serverId, e);
    } catch (IOException e) {
        response.setStatusMsg("???IOException" + e.getMessage());
        log.error("???IOException: dataId=" + dataId + ",group=" + groupName + ",content="
                + context + ",serverId=" + serverId, e);
    } finally {
        // ?
        post.releaseConnection();
    }

    return response;
}