當前位置: 首頁>>代碼示例>>Java>>正文


Java Part.sendParts方法代碼示例

本文整理匯總了Java中org.apache.commons.httpclient.methods.multipart.Part.sendParts方法的典型用法代碼示例。如果您正苦於以下問題:Java Part.sendParts方法的具體用法?Java Part.sendParts怎麽用?Java Part.sendParts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.httpclient.methods.multipart.Part的用法示例。


在下文中一共展示了Part.sendParts方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getBytes

import org.apache.commons.httpclient.methods.multipart.Part; //導入方法依賴的package包/類
/**
 * @return a byte array of the message formatted according to the given
 *         message format.
 */
public byte[] getBytes(MessageContext messageContext, OMOutputFormat format) throws AxisFault {

    OMElement omElement = messageContext.getEnvelope().getBody().getFirstElement();

    Part[] parts = createMultipatFormDataRequest(omElement);
    if (parts.length > 0) {
        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
        try {

            // This is accessing a class of Commons-FlieUpload
            Part.sendParts(bytesOut, parts, format.getMimeBoundary().getBytes());
        } catch (IOException e) {
            throw AxisFault.makeFault(e);
        }
        return bytesOut.toByteArray();
    }

    return new byte[0];  //To change body of implemented methods use File | Settings | File Templates.
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:24,代碼來源:MultipartFormDataFormatter.java

示例2: writeRequestBody

import org.apache.commons.httpclient.methods.multipart.Part; //導入方法依賴的package包/類
/**
 * Writes the request body to the given {@link HttpConnection connection}.
 *
 * @param state the {@link HttpState state} information associated with this method
 * @param conn the {@link HttpConnection connection} used to execute
 *        this HTTP method
 *
 * @return <tt>true</tt>
 *
 * @throws IOException if an I/O (transport) error occurs. Some transport exceptions
 *                     can be recovered from.
 * @throws HttpException  if a protocol exception occurs. Usually protocol exceptions 
 *                    cannot be recovered from.
 */
protected boolean writeRequestBody(HttpState state, HttpConnection conn) 
throws IOException, HttpException {
    LOG.trace("enter MultipartPostMethod.writeRequestBody(HttpState state, "
        + "HttpConnection conn)");
    OutputStream out = conn.getRequestOutputStream();
    Part.sendParts(out, getParts());
    return true;
}
 
開發者ID:jenkinsci,項目名稱:lib-commons-httpclient,代碼行數:23,代碼來源:MultipartPostMethod.java


注:本文中的org.apache.commons.httpclient.methods.multipart.Part.sendParts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。