/// <exception cref="Org.Apache.Http.HttpException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        public virtual void ReceiveRequestEntity(HttpEntityEnclosingRequest request)
        {
            Args.NotNull(request, "HTTP request");
            EnsureOpen();
            HttpEntity entity = PrepareInput(request);

            request.SetEntity(entity);
        }
Ejemplo n.º 2
0
        internal static void EnhanceEntity(HttpEntityEnclosingRequest request)
        {
            HttpEntity entity = request.GetEntity();

            if (entity != null && !entity.IsRepeatable() && !IsEnhanced(entity))
            {
                HttpEntity proxy = (HttpEntity)Proxy.NewProxyInstance(typeof(HttpEntity).GetClassLoader
                                                                          (), new Type[] { typeof(HttpEntity) }, new RequestEntityExecHandler(entity));
                request.SetEntity(proxy);
            }
        }
Ejemplo n.º 3
0
        /// <exception cref="Org.Apache.Http.HttpException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        public virtual void SendRequestEntity(HttpEntityEnclosingRequest request)
        {
            Args.NotNull(request, "HTTP request");
            EnsureOpen();
            HttpEntity entity = request.GetEntity();

            if (entity == null)
            {
                return;
            }
            OutputStream outstream = PrepareOutput(request);

            entity.WriteTo(outstream);
            outstream.Close();
        }
Ejemplo n.º 4
0
        private HttpResponse SendRequestAndGetResponse(HttpConnection connection, HttpRequest request)
        {
            m_cookieStore.WriteCookiesToRequest(request);

            // if we need to send a body (not only headers)
            if (request.GetType().GetInterface("HttpEntityEnclosingRequest") != null)
            {
                HttpEntityEnclosingRequest heer = (HttpEntityEnclosingRequest)request;
                connection.SendRequestHeaderAndEntity(request, heer.Entity, heer.ExpectContinue);
            }
            else
            {
                connection.SendRequestHeader(request);
            }

            return(GetResponse(connection));
        }
 /// <exception cref="Apache.Http.ProtocolException"></exception>
 public EntityEnclosingRequestWrapper(HttpEntityEnclosingRequest request) : base(request
                                                                                 )
 {
     // e.g. [gs]etEntity()
     SetEntity(request.GetEntity());
 }
 public HttpEntityEnclosingRequestWrapper(HttpEntityEnclosingRequest request) : base
         (request)
 {
     this.entity = request.GetEntity();
 }