Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.NameValuePair


            Object contentType = header.getValue();
            Object charSetEnc = null;

            for (int i = 0; i < headers.length; i++) {
                NameValuePair charsetEnc = headers[i].getParameterByName(
                        HTTPConstants.CHAR_SET_ENCODING);
                if (charsetEnc != null) {
                    charSetEnc = charsetEnc.getValue();
                }
            }

            if (inMessageContext != null) {
                inMessageContext
View Full Code Here


    private String processCookieHeader(HeaderElement element) {
        String cookie = element.getName() + "=" + element.getValue();
        NameValuePair[] parameters =  element.getParameters();
        for (int j = 0; parameters != null && j < parameters.length; j++) {
            NameValuePair parameter = parameters[j];
            cookie = cookie + "; " + parameter.getName() + "=" + parameter.getValue();
        }
        return cookie;
    }
View Full Code Here

        throws UnsupportedEncodingException
     {
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < pairs.length; i++) {
            URLCodec codec = new URLCodec();
            NameValuePair pair = pairs[i];
            if (pair.getName() != null) {
                if (i > 0) {
                    buf.append("&");
                }
                buf.append(codec.encode(pair.getName(), charset));
                buf.append("=");
                if (pair.getValue() != null) {
                    buf.append(codec.encode(pair.getValue(), charset));
                }
            }
        }
        return buf.toString();
    }
View Full Code Here

      httpClient.executeMethod(authget);
      int statuscode = authget.getStatusCode();

      authpost = new PostMethod(securityHost + "/j_security_check");
      NameValuePair j_username = new NameValuePair("j_username", userName);
      NameValuePair j_password = new NameValuePair("j_password", password);
      authpost.setRequestBody(new NameValuePair[] { j_username, j_password });

      httpClient.executeMethod(authpost);
      statuscode = authpost.getStatusCode();
      if ((statuscode == HttpStatus.SC_MOVED_TEMPORARILY)
View Full Code Here

      value = XMLHelper.getNodeText(nodes.item(i));
      if (value == null)
      {
        value = "";
      }
      params.add(new NameValuePair(name, value));
    }

    /*
     * Copy WILDCARDS from XBUSSystem into parameters
     */
    Hashtable info = mDestination.getAddresses();
    String key = null;
    for (Enumeration en = info.keys(); en.hasMoreElements();)
    {
      key = (String) en.nextElement();
      if (XBUSSystem.FILENAME_WILDCARD.equals(key))
      {
        value = (String) info.get(key);
        params.add(new NameValuePair(key, value));
      }
    }

    NameValuePair[] paramArray = new NameValuePair[params.size()];
    params.copyInto(paramArray);
View Full Code Here

    }
  }

  private String getProxyTicket(String casServer, String pgt, String targetServiceURL) {
    try {
      NameValuePair pgtParam = new NameValuePair("pgt", pgt);
      NameValuePair serviceParam = new NameValuePair("targetService", targetServiceURL);

      GetMethod proxyMethod = new GetMethod(casServer + "proxy");
      proxyMethod.setQueryString(new NameValuePair[] { pgtParam, serviceParam });

      int status = pool.httpClient.executeMethod(proxyMethod);
View Full Code Here

    return null;
  }

  private String startRemoteSession(String sessionURL, String proxyTicket, Session localSession) {
    try {
      NameValuePair ticketParam = new NameValuePair("ticket", proxyTicket);
      GetMethod sessionMethod = new GetMethod(sessionURL);
      sessionMethod.setQueryString(new NameValuePair[] { ticketParam });

      int status = pool.httpClient.executeMethod(sessionMethod);
View Full Code Here

  }

  private List<NameValuePair> getQueryParams() {
    List<NameValuePair> queryParams = new ArrayList<NameValuePair>(bindings.size() + 10);

    queryParams.add(new NameValuePair(Protocol.INCLUDE_INFERRED_PARAM_NAME,
        Boolean.toString(includeInferred)));

    if (dataset != null) {
      for (URI defaultGraphURI : dataset.getDefaultGraphs()) {
        queryParams.add(new NameValuePair(Protocol.DEFAULT_GRAPH_PARAM_NAME, defaultGraphURI.toString()));
      }
      for (URI namedGraphURI : dataset.getNamedGraphs()) {
        queryParams.add(new NameValuePair(Protocol.NAMED_GRAPH_PARAM_NAME, namedGraphURI.toString()));
      }
    }

    if (offset > 0) {
      queryParams.add(new NameValuePair(Protocol.OFFSET, String.valueOf(offset)));
    }
    if (limit >= 0) {
      queryParams.add(new NameValuePair(Protocol.LIMIT, String.valueOf(limit)));
    }

    for (Binding binding : bindings) {
      String paramName = Protocol.BINDING_PREFIX + binding.getName();
      String paramValue = Protocol.encodeValue(binding.getValue());
      queryParams.add(new NameValuePair(paramName, paramValue));
    }

    return queryParams;
  }
View Full Code Here

  private List<NameValuePair> getQueryParams(QueryLanguage ql, String query, String baseURI) {
    List<NameValuePair> queryParams = new ArrayList<NameValuePair>();

    if (ql != null) {
      queryParams.add(new NameValuePair(Protocol.QUERY_LANGUAGE_PARAM_NAME, ql.getName()));
    }
    if (baseURI != null) {
      queryParams.add(new NameValuePair(Protocol.BASEURI_PARAM_NAME, baseURI));
    }

    queryParams.add(new NameValuePair(Protocol.QUERY_PARAM_NAME, query));
    return queryParams;
  }
View Full Code Here

    }

    // Set relevant query parameters
    List<NameValuePair> params = new ArrayList<NameValuePair>(5);
    for (String encodedContext : Protocol.encodeContexts(contexts)) {
      params.add(new NameValuePair(Protocol.CONTEXT_PARAM_NAME, encodedContext));
    }
    if (baseURI != null && baseURI.trim().length() != 0) {
      String encodedBaseURI = Protocol.encodeValue(new URIImpl(baseURI));
      params.add(new NameValuePair(Protocol.BASEURI_PARAM_NAME, encodedBaseURI));
    }
    request.sendQueryString(params);

    // Set payload
    request.sendEntity(reqEntity);
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.NameValuePair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.