本文整理汇总了Java中org.apache.axis.Message.writeTo方法的典型用法代码示例。如果您正苦于以下问题:Java Message.writeTo方法的具体用法?Java Message.writeTo怎么用?Java Message.writeTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis.Message
的用法示例。
在下文中一共展示了Message.writeTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendResponseX
import org.apache.axis.Message; //导入方法依赖的package包/类
/**
* write a message to the response, set appropriate headers for content
* type..etc.
* @param res response
* @param responseMsg message to write
* @throws AxisFault
* @throws IOException if the response stream can not be written to
*/
private void sendResponseX(String contentType,
HttpServletResponse res,
Message responseMsg) throws AxisFault,
IOException {
if (responseMsg == null) {
res.setStatus(HttpServletResponse.SC_NO_CONTENT);
if (isDebug) {
log.debug("NO AXIS MESSAGE TO RETURN!");
}
} else {
if (isDebug) {
log.debug("Returned Content-Type:" + contentType);
}
try {
res.setContentType(contentType);
responseMsg.writeTo(res.getOutputStream());
} catch (SOAPException e) {
logException(e);
}
}
if (!res.isCommitted()) {
res.flushBuffer(); // Force it right now.
}
}
示例2: sendResponse
import org.apache.axis.Message; //导入方法依赖的package包/类
/**
* write a message to the response, set appropriate headers for content
* type..etc.
* @param res response
* @param responseMsg message to write
* @throws AxisFault
* @throws IOException if the response stream can not be written to
*/
private void sendResponse(String contentType,
HttpServletResponse res,
Message responseMsg) throws AxisFault,
IOException {
if (responseMsg == null) {
res.setStatus(HttpServletResponse.SC_NO_CONTENT);
if (isDebug) {
log.debug("NO AXIS MESSAGE TO RETURN!");
}
} else {
if (isDebug) {
log.debug("Returned Content-Type:" + contentType);
}
try {
ReqRspUtil.setContentType(res,contentType);
responseMsg.writeTo(res.getOutputStream());
} catch (SOAPException e) {
logException(e);
}
}
if (!res.isCommitted()) {
res.flushBuffer(); // Force it right now.
}
}
示例3: createHttpRequest
import org.apache.axis.Message; //导入方法依赖的package包/类
/**
* Creates an HTTP request based on the message context.
*
* @param msgContext the Axis message context
* @return a new {@link HttpRequest} with content and headers populated
*/
private HttpRequest createHttpRequest(MessageContext msgContext)
throws SOAPException, IOException {
Message requestMessage =
Preconditions.checkNotNull(
msgContext.getRequestMessage(), "Null request message on message context");
// Construct the output stream.
String contentType = requestMessage.getContentType(msgContext.getSOAPConstants());
ByteArrayOutputStream bos = new ByteArrayOutputStream(BUFFER_SIZE);
if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) {
logger.debug("Compressing request");
try (GZIPOutputStream gzipOs = new GZIPOutputStream(bos, BUFFER_SIZE)) {
requestMessage.writeTo(gzipOs);
}
} else {
logger.debug("Not compressing request");
requestMessage.writeTo(bos);
}
HttpRequest httpRequest =
requestFactory.buildPostRequest(
new GenericUrl(msgContext.getStrProp(MessageContext.TRANS_URL)),
new ByteArrayContent(contentType, bos.toByteArray()));
int timeoutMillis = msgContext.getTimeout();
if (timeoutMillis >= 0) {
logger.debug("Setting read and connect timeout to {} millis", timeoutMillis);
// These are not the same, but MessageContext has only one definition of timeout.
httpRequest.setReadTimeout(timeoutMillis);
httpRequest.setConnectTimeout(timeoutMillis);
}
// Copy the request headers from the message context to the post request.
setHttpRequestHeaders(msgContext, httpRequest);
return httpRequest;
}