当前位置: 首页>>代码示例>>Java>>正文


Java Message.writeTo方法代码示例

本文整理汇总了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.
	}
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:36,代码来源:RPCServer.java

示例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.
    }
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:36,代码来源:RPCServer.java

示例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;
}
 
开发者ID:googleads,项目名称:googleads-java-lib,代码行数:45,代码来源:HttpHandler.java


注:本文中的org.apache.axis.Message.writeTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。