本文整理汇总了Java中org.apache.cxf.io.CachedOutputStream类的典型用法代码示例。如果您正苦于以下问题:Java CachedOutputStream类的具体用法?Java CachedOutputStream怎么用?Java CachedOutputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CachedOutputStream类属于org.apache.cxf.io包,在下文中一共展示了CachedOutputStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decryptContent
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
public static void decryptContent( SecurityManager securityManager, Message message, String hostIdSource,
String hostIdTarget )
{
InputStream is = message.getContent( InputStream.class );
CachedOutputStream os = new CachedOutputStream();
LOG.debug( String.format( "Decrypting IDs: %s -> %s", hostIdSource, hostIdTarget ) );
try
{
int copied = IOUtils.copyAndCloseInput( is, os );
os.flush();
byte[] data = copied > 0 ? decryptData( securityManager, hostIdSource, os.getBytes() ) : null;
org.apache.commons.io.IOUtils.closeQuietly( os );
if ( !ArrayUtils.isEmpty( data ) )
{
LOG.debug( String.format( "Decrypted payload: \"%s\"", new String( data ) ) );
message.setContent( InputStream.class, new ByteArrayInputStream( data ) );
}
else
{
LOG.debug( "Decrypted data is NULL!!!" );
}
}
catch ( Exception e )
{
LOG.error( "Error decrypting content", e );
}
}
示例2: handleMessage
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
try
{
OutputStream originalOs = message.getContent(OutputStream.class);
message.put(OUTPUT_STREAM_HOLDER,originalOs);
CachedOutputStream cos = new CachedOutputStream();
message.setContent(OutputStream.class,cos);
message.setContent(XMLStreamWriter.class,StaxOutInterceptor.getXMLOutputFactory(message).createXMLStreamWriter(cos,getEncoding(message)));
message.getInterceptorChain().add(new OracleEbMSXMLPrefixFixingOutEndingInterceptor());
}
catch (Exception e)
{
throw new Fault(e);
}
}
示例3: handleMessage
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
try
{
OutputStream originalOs = message.getContent(OutputStream.class);
message.put(OUTPUT_STREAM_HOLDER,originalOs);
CachedOutputStream cos = new CachedOutputStream();
message.setContent(OutputStream.class,cos);
message.setContent(XMLStreamWriter.class,StaxOutInterceptor.getXMLOutputFactory(message).createXMLStreamWriter(cos,getEncoding(message)));
message.getInterceptorChain().add(new XMLSecSignatureOutEndingInterceptor());
}
catch (XMLStreamException e)
{
throw new Fault(e);
}
}
示例4: handleMessage
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
try
{
OutputStream originalOs = message.getContent(OutputStream.class);
message.put(OUTPUT_STREAM_HOLDER,originalOs);
CachedOutputStream cos = new CachedOutputStream();
message.setContent(OutputStream.class,cos);
message.setContent(XMLStreamWriter.class,StaxOutInterceptor.getXMLOutputFactory(message).createXMLStreamWriter(cos,getEncoding(message)));
message.getInterceptorChain().add(getEndingInterceptor());
}
catch (XMLStreamException e)
{
throw new Fault(e);
}
}
示例5: handleMessage
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
try
{
OutputStream originalOs = message.getContent(OutputStream.class);
message.put(OUTPUT_STREAM_HOLDER,originalOs);
CachedOutputStream cos = new CachedOutputStream();
message.setContent(OutputStream.class,cos);
message.setContent(XMLStreamWriter.class,StaxOutInterceptor.getXMLOutputFactory(message).createXMLStreamWriter(cos,getEncoding(message)));
message.getInterceptorChain().add(new XMLDSignatureOutEndingInterceptor());
}
catch (XMLStreamException e)
{
throw new Fault(e);
}
}
示例6: handleMessage
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
try
{
OutputStream originalOs = message.getContent(OutputStream.class);
message.put(OUTPUT_STREAM_HOLDER,originalOs);
CachedOutputStream cos = new CachedOutputStream();
message.setContent(OutputStream.class,cos);
message.setContent(XMLStreamWriter.class,StaxOutInterceptor.getXMLOutputFactory(message).createXMLStreamWriter(cos,getEncoding(message)));
message.getInterceptorChain().add(new LoggingOutEndingInterceptor());
}
catch (XMLStreamException e)
{
throw new Fault(e);
}
}
示例7: printDebug
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
public void printDebug(){
boolean debugLogEnabled = log.isDebugEnabled();
if(log.isDebugEnabled()){
log.debug("name:" + name);
log.debug("description:" + description);
log.debug("type:" + type);
log.debug("contentType:" + type);
log.debug("scope:" + scope);
CachedOutputStream bos = new CachedOutputStream();
try {
String fileName = bos.getOut().toString();
log.debug("fileName:"+fileName);
bos.close();
} catch (IOException e) {
log.error("Exception occured during reading the file name", e);
}
log.debug("Stream String:" + new String(attachmentArray));
}
}
示例8: exportQuestionnairDefinition
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
@GET
@Path("/{questionnaireDefinitionId}/export")
@ApiOperation(value = "Export given questionnaire definition into xml", response = QuestionnaireDefinitionDTO.class, produces = "application/xml")
@ApiResponses(value = { @ApiResponse(code = 404, message = "Not enough access rights"),
@ApiResponse(code = 200, message = "Questionnaire Definition available") })
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public InputStream exportQuestionnairDefinition(
@NotNull @PathParam("questionnaireDefinitionId") @ApiParam(value = "Questionnaire DefinitionId id", required = true) Integer questionnairDefinitionId)
throws XmlMappingException, IOException {
logger.info("New exporting petition received for QuestionnairDefinitionId {}", questionnairDefinitionId);
CachedOutputStream outputStream = new CachedOutputStream();
questionnaireDefinitionAccessorFacade.exportQuestionnaireDefinition(questionnairDefinitionId, outputStream);
logger.info("QuestionnaireDefinition with id = {} exported succesfully", questionnairDefinitionId);
return outputStream.getInputStream();
}
示例9: doInterfaceLog
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
private void doInterfaceLog(Message message)
{
String messageId = (String)message.getExchange().get(LoggingMessage.ID_KEY);
String currentEnvelopeMessage = "";
/*****/
OutputStream os = message.getContent(OutputStream.class);
CachedStream cs = new CachedStream();
message.setContent(OutputStream.class, cs);
message.getInterceptorChain().doIntercept(message);
try
{
cs.flush();
IOUtils.closeQuietly(cs);
CachedOutputStream csnew = (CachedOutputStream)message.getContent(OutputStream.class);
currentEnvelopeMessage = IOUtils.toString(csnew.getInputStream(), "UTF-8");
csnew.flush();
IOUtils.closeQuietly(csnew);
InputStream replaceInStream = IOUtils.toInputStream(currentEnvelopeMessage, "UTF-8");
IOUtils.copy(replaceInStream, os);
replaceInStream.close();
IOUtils.closeQuietly(replaceInStream);
os.flush();
message.setContent(OutputStream.class, os);
IOUtils.closeQuietly(os);
}
catch (IOException ioe)
{
throw new RuntimeException(ioe);
}
/*****/
InterfaceLogBean bean = new InterfaceLogBean();
bean.setTransactionId(messageId);
bean.setReq(false);
bean.setRespTime(new Date());
bean.setResultCode(getResultCode(currentEnvelopeMessage));
IInterfaceLog logger = ApplicationContextUtil.getBean("interfaceLogger");
logger.info(bean);
}
示例10: getStringFromInputStream
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
private static String getStringFromInputStream(InputStream in) throws Exception {
CachedOutputStream bos = new CachedOutputStream();
IOUtils.copy(in, bos);
in.close();
bos.close();
return bos.getOut().toString();
}
示例11: getStringFromInputStream
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
public static String getStringFromInputStream(InputStream in) throws Exception {
CachedOutputStream bos = new CachedOutputStream();
IOUtils.copy(in, bos);
in.close();
bos.close();
return bos.getOut().toString();
}
示例12: toString
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
private String toString(InputStream is) throws IOException {
StringBuilder out = new StringBuilder();
CachedOutputStream os = new CachedOutputStream();
IOHelper.copy(is, os);
is.close();
os.writeCacheTo(out);
return out.toString();
}
示例13: commitOutputMessage
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
private void commitOutputMessage() throws IOException {
Exchange camelExchange = (Exchange)outMessage.get(CamelTransportConstants.CAMEL_EXCHANGE);
propagateResponseHeadersToCamel(outMessage, camelExchange);
// check if the outMessage has the exception
Exception exception = outMessage.getContent(Exception.class);
if (checkException && exception != null) {
camelExchange.setException(exception);
}
CachedOutputStream outputStream = (CachedOutputStream)outMessage.getContent(OutputStream.class);
camelExchange.getOut().setBody(outputStream.getInputStream());
LOG.debug("send the response message: {}", outputStream);
}
示例14: commitOutputMessage
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
private void commitOutputMessage() throws IOException {
ExchangePattern pattern;
if (isOneWay) {
pattern = ExchangePattern.InOnly;
} else {
pattern = ExchangePattern.InOut;
}
LOG.debug("send the message to endpoint {}", this.targetCamelEndpointUri);
final org.apache.camel.Exchange exchange = this.producer.createExchange(pattern);
exchange.setProperty(Exchange.TO_ENDPOINT, this.targetCamelEndpointUri);
CachedOutputStream outputStream = (CachedOutputStream) outMessage.getContent(OutputStream.class);
// Send out the request message here, copy the protocolHeader back
CxfHeaderHelper.propagateCxfToCamel(this.headerFilterStrategy, outMessage, exchange.getIn().getHeaders(), exchange);
// TODO support different encoding
exchange.getIn().setBody(outputStream.getInputStream());
LOG.debug("template sending request: ", exchange.getIn());
if (outMessage.getExchange().isSynchronous()) {
syncInvoke(exchange);
} else {
// submit the request to the work queue
asyncInvokeFromWorkQueue(exchange);
}
}
示例15: handleMessage
import org.apache.cxf.io.CachedOutputStream; //导入依赖的package包/类
public void handleMessage(Message message) throws Fault
{
String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
if (!method.equals("POST"))
{
return;
}
StringBuilder sb = new StringBuilder();
InputStream is = message.getContent(InputStream.class);
if (is != null)
{
CachedOutputStream bos = new CachedOutputStream();
try
{
copy(is, bos, 4096);
bos.flush();
is.close();
message.setContent(InputStream.class, bos.getInputStream());
bos.writeCacheTo(sb);
bos.close();
}
catch (IOException e)
{
throw new Fault(e);
}
}
if (!sb.toString().contains("http://www.w3.org/2005/08/addressing"))
{
throw new Fault("Could not find any reference to namespace 'http://www.w3.org/2005/08/addressing' in handled message.",
java.util.logging.Logger.getLogger(CheckInterceptor.class.getName()));
}
}