Examples of ByteArrayRequestEntity


Examples of org.apache.commons.httpclient.methods.ByteArrayRequestEntity

                // if the part has an element name, we must take the first element
                if (part.getElementName() != null) {
                    partValue = DOMUtils.getFirstChildElement(partValue);
                }
                String xmlString = DOMUtils.domToString(partValue);
                requestEntity = new ByteArrayRequestEntity(xmlString.getBytes(), contentType);
            } else {
                // should not happen because of HttpBindingValidator, but never say never
                throw new IllegalArgumentException("Unsupported content-type!");
            }
View Full Code Here

Examples of org.apache.commons.httpclient.methods.ByteArrayRequestEntity

            if (data == null) {
                return null;
            }
            String contentType = in.getHeader("Content-Type", String.class);
            if (contentType != null) {
                return new ByteArrayRequestEntity(data, contentType);
            } else {
                return new ByteArrayRequestEntity(data);
            }
        }
        return entity;
    }
View Full Code Here

Examples of org.apache.commons.httpclient.methods.ByteArrayRequestEntity

         * Called after this stream is closed.
         */
        @Override
        protected void onClose() throws IOException
        {
            RequestEntity entity = new ByteArrayRequestEntity(((ByteArrayOutputStream) out).toByteArray());
            URLFileName fileName = (URLFileName) getName();
            String urlStr = urlString(fileName);
            if (builder.isVersioning(getFileSystem().getFileSystemOptions()))
            {
                DavPropertySet set = null;
View Full Code Here

Examples of org.apache.commons.httpclient.methods.ByteArrayRequestEntity

            {
                postMethod.setRequestEntity(new InputStreamRequestEntity((InputStream) src, outboundMimeType));
            }
            else if (src instanceof byte[])
            {
                postMethod.setRequestEntity(new ByteArrayRequestEntity((byte[]) src, outboundMimeType));
            }
            else if (src instanceof OutputHandler)
            {
                final MuleEvent event = RequestContext.getEvent();
                postMethod.setRequestEntity(new StreamPayloadRequestEntity((OutputHandler) src, event));
            }
            else
            {
                final byte[] buffer = SerializationUtils.serialize((Serializable) src);
                postMethod.setRequestEntity(new ByteArrayRequestEntity(buffer, outboundMimeType));
            }
        }
        else if (msg.getOutboundAttachmentNames() != null && msg.getOutboundAttachmentNames().size() > 0)
        {
            try
View Full Code Here

Examples of org.apache.commons.httpclient.methods.ByteArrayRequestEntity

            httpMethod = (HttpMethod) sendTransformer.transform(body.toString());
        }
        else if (body instanceof byte[])
        {
            byte[] buffer = event.transformMessage(DataType.BYTE_ARRAY_DATA_TYPE);
            postMethod.setRequestEntity(new ByteArrayRequestEntity(buffer, event.getEncoding()));
            httpMethod = postMethod;
        }
        else
        {
            if (!(body instanceof OutputHandler))
View Full Code Here

Examples of org.apache.commons.httpclient.methods.ByteArrayRequestEntity

          {
            ByteArrayOutputStream tempOut = new ByteArrayOutputStream();
            requestEntity.writeRequest( tempOut );

            byte[] compressedData = CompressionSupport.compress( compressionAlg, tempOut.toByteArray() );
            ( ( EntityEnclosingMethod )method ).setRequestEntity( new ByteArrayRequestEntity( compressedData ) );
          }
        }
      }
      catch( Exception e )
      {
View Full Code Here

Examples of org.apache.commons.httpclient.methods.ByteArrayRequestEntity

    {
      String encoding = System.getProperty( "soapui.request.encoding",
          StringUtils.unquote( wsdlRequest.getEncoding() ) );
      byte[] content = StringUtils.isNullOrEmpty( encoding ) ? requestContent.getBytes() : requestContent
          .getBytes( encoding );
      postMethod.setRequestEntity( new ByteArrayRequestEntity( content ) );
    }
    else
    {
      // make sure..
      if( mp == null )
View Full Code Here

Examples of org.apache.commons.httpclient.methods.ByteArrayRequestEntity

      ClientStatusException, ServerStatusException
  {
    // internalConnect.
    internalConnect();

    postMethod.setRequestEntity( new ByteArrayRequestEntity( outBuffer.toByteArray() ) );
    HostConfiguration hostConfiguration = new HostConfiguration();

    ProxyUtils.initProxySettings( context.getModelItem() == null ? SoapUI.getSettings() : context.getModelItem()
        .getSettings(), httpState, hostConfiguration, url, context );
View Full Code Here

Examples of org.apache.commons.httpclient.methods.ByteArrayRequestEntity

        if( StringUtils.hasContent( requestContent ) && attachments.isEmpty() )
        {
          try
          {
            byte[] content = encoding == null ? requestContent.getBytes() : requestContent.getBytes( encoding );
            ( ( EntityEnclosingMethod )httpMethod ).setRequestEntity( new ByteArrayRequestEntity( content ) );
          }
          catch( UnsupportedEncodingException e )
          {
            ( ( EntityEnclosingMethod )httpMethod ).setRequestEntity( new ByteArrayRequestEntity( requestContent
                .getBytes() ) );
          }
        }
        else if( attachments.size() > 0 )
        {
View Full Code Here

Examples of org.apache.commons.httpclient.methods.ByteArrayRequestEntity

    // set body if post method or put method
    if (body != null && body.length() > 0) {
      EntityEnclosingMethod generic = (EntityEnclosingMethod) httpMethod;
//      generic.setRequestEntity(new StringRequestEntity(body.toString()));
            generic.setRequestEntity(new ByteArrayRequestEntity(body.getBytes()));

        }

    httpMethod.setFollowRedirects(false);
    return httpMethod;
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.