Examples of HttpRequest

Otherwise, the HTTP request will go directly to the host:
header "Connection" or "Proxy-Connection"
The HttpRequest sets the appropriate connection header to "Keep-Alive" to keep alive the connection to the host or proxy (respectively). By setting the appropriate connection header, the user can control whether the HttpRequest tries to use Keep-Alives.
header "Host"
The HTTP/1.1 protocol requires that the "Host" header be set to the name of the machine being contacted. By default, this is derived from the URL used to construct the HttpRequest, and is set automatically if the user does not set it.
header "Content-Length"
If the user calls getOutputStream and writes some data to it, the "Content-Length" header will be set to the amount of data that has been written at the time that connect is called.
Once all data has been read from the remote host, the underlying socket may be automatically recycled and used again for subsequent requests to the same remote host. If the user is not planning on reading all the data from the remote host, the user should call close to release the socket. Although it happens under the covers, the user should be aware that if an IOException occurs or once data has been read normally from the remote host, close is called automatically. This is to ensure that the minimal number of sockets are left open at any time.

The input stream that getInputStream provides automatically hides whether the remote host is providing HTTP/1.1 "chunked" encoding or regular streaming data. The user can simply read until reaching the end of the input stream, which signifies that all the available data from this request has been read. If reading from a "chunked" source, the data is automatically de-chunked as it is presented to the user. Currently, no access is provided to the underlying raw input stream. @author Colin Stevens (colin.stevens@sun.com) @version 2.5

  • twitter4j.internal.http.HttpRequest

  • Examples of api.http.HttpRequest

      public KeyValuePair toAuthHeader(){
        return new KeyValuePair("Authorization", String.format("GoogleLogin auth=\"%s\"", this.authToken));
      }

      private void login() throws IOException{
        HttpRequest httpRequest = new HttpRequest(new URL("https://www.google.com/accounts/ClientLogin"));
        HttpQuery httpQuery = new HttpQuery();
        httpQuery.add("Email", this.user);
        httpQuery.add("Passwd", this.password);
        httpQuery.add("service", this.service);
        httpQuery.add("source", this.source);
        httpRequest.setData(httpQuery.toString());
        String response = httpRequest.send();
        String responses[] = response.split("\n");
        String authHeader = "Auth=";
        for (String r : responses){
          if (r.indexOf(authHeader) == 0){
            this.authToken = r.substring(authHeader.length());
    View Full Code Here

    Examples of ch.rolandschaer.ascrblr.HttpRequest

       
        InputStream resultStream = null;
       
        try {

          HttpRequest request = requestFactory.getRequest(RequestType.QUERY, new URL(feed.getUrl()))
         
          if(connectTimeout>0) {
            request.setConnectTimeout(connectTimeout);
          }
         
          if(readTimeout>0) {
            request.setReadTimeout(readTimeout);
          }

          // Execute the request
          request.execute();     
          resultStream = request.getResponseStream();
         
          feed.parse(resultStream);

          return feed;
         
    View Full Code Here

    Examples of cn.baiweigang.qtaf.toolkit.httpclient.HttpRequest

        this.httpUrl = "";
        this.headersMap = new TreeMap<String, String>();
        this.urlParaMap = new LinkedHashMap<String, String>();
        this.formParaMap = new LinkedHashMap<String, String>();
        if (IftConf.ProxyEnable.equals("Y")) {
          sendRequestCore = new HttpRequest(IftConf.ProxyIp,IftConf.PROXY_PORT);
        } else {
          sendRequestCore = new HttpRequest();
        }
      }
    View Full Code Here

    Examples of cn.edu.hfut.dmic.webcollector.net.HttpRequest

         * @return 实现Request接口的对象
         * @throws Exception
         */
        @Override
        public Request createRequest(String url) throws Exception {
            HttpRequest request = new HttpRequest();
            URL _URL = new URL(url);
            request.setURL(_URL);
            request.setProxy(proxy);
            request.setConnectionConfig(conconfig);
            return request;
        }
    View Full Code Here

    Examples of cn.org.ape.http.HttpRequest

       * 该过滤器主要用于request的转码
       */
      @Override
      public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
          FilterChain chain) throws IOException, ServletException {
        HttpRequest request=new RequestContext((HttpServletRequest) servletRequest);
        HttpResponse response = new ResponseContext((HttpServletResponse) servletResponse);
        // 主要是修改post方式提交的数据
        request.setCharacterEncoding(encoding); //设设置编码
        //修改get方式提交的数据
        /**
         * get方式的修改只有将取得的数据强行转码
         * value = new String(value.getBytes("ISO-8859-1"), 
         *          "UTF-8");
    View Full Code Here

    Examples of co.cask.cdap.common.http.HttpRequest

      }

      public void setAclForUser(EntityId entityId, String userId, List<PermissionType> permissions) throws IOException {
        URL url = resolveURL(String.format("/v2/admin/acls/%s/%s/user/%s", entityId.getType().getPluralForm(),
                                           entityId.getId(), userId));
        HttpRequest request = HttpRequest.builder(HttpMethod.PUT, url).withBody(GSON.toJson(permissions)).build();
        HttpRequests.execute(request);
      }
    View Full Code Here

    Examples of com.acciente.induction.controller.HttpRequest

                Object   oParamValue       = null;
                boolean  bNullParamValid   = false;

                if ( oParamClass.isAssignableFrom( Request.class ) )
                {
                   oParamValue = new HttpRequest( _oRequest );
                }
                else if ( oParamClass.isAssignableFrom( Response.class ) )
                {
                   oParamValue = new HttpResponse( _oResponse );
                }
    View Full Code Here

    Examples of com.amazonaws.http.HttpRequest

            if (versionIdMarker != null) request.addParameter("version-id-marker", versionIdMarker);
            if (delimiter != null) request.addParameter("delimiter", delimiter);
            if (maxResults != null && maxResults.intValue() >= 0) request.addParameter("max-keys", maxResults.toString());

            signRequest(request, HttpMethodName.GET, bucketName, null);
            HttpRequest httpRequest = convertToHttpRequest(request, HttpMethodName.GET);

            S3XmlResponseHandler<VersionListing> responseHandler =
                new S3XmlResponseHandler<VersionListing>(new Unmarshallers.VersionListUnmarshaller());

            return (VersionListing)client.execute(httpRequest, responseHandler, errorResponseHandler);
    View Full Code Here

    Examples of com.caucho.server.http.HttpRequest

        TestConnection()
        {
          _conn = new StreamSocketLink();
          // _conn.setVirtualHost(_virtualHost);

          _request = new HttpRequest(_resin.getServer(), _conn);
          _request.init();

          _vfsStream = new VfsStream(null, null);

          // _conn.setSecure(_isSecure);
    View Full Code Here

    Examples of com.cloudloop.adapter.HTTPRequest

          long      startPoint
        )
      {
        // TODO: chunked downloads?
       
        HTTPRequest downloadReq = createDownloadRequest( file, startPoint );
       
        return new CloudStoreDownloadStream( downloadReq.execute(), this, file );
      }
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. 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.