use of org.apache.cxf.message.Message in project jbossws-cxf by jbossws.
the class AnotherEndpointImpl method echo.
@WebMethod
public String echo(String input) {
Logger.getLogger(this.getClass()).info("echo:." + input);
Message cxfMessage = (Message) ctx.getMessageContext().get(Message.class.getName());
cxfMessage.getExchange().put(Counter.class, new Counter() {
@Override
public void increment() {
counter.incrementAndGet();
}
});
return input + "." + cxfMessage.get(StringBuilder.class) + "." + counter.get();
}
use of org.apache.cxf.message.Message in project jbossws-cxf by jbossws.
the class EndpointImpl method echo.
@WebMethod
public String echo(String input) {
Logger.getLogger(this.getClass()).info("echo: " + input);
Message cxfMessage = (Message) ctx.getMessageContext().get(Message.class.getName());
cxfMessage.getExchange().put(Counter.class, new Counter() {
@Override
public void increment() {
counter.incrementAndGet();
}
});
return input + " " + cxfMessage.get(StringBuilder.class) + " " + counter.get();
}
use of org.apache.cxf.message.Message in project jbossws-cxf by jbossws.
the class SOAPConnectionImpl method get.
@Override
public SOAPMessage get(Object addressObject) throws SOAPException {
checkClosed();
String address = getAddress(addressObject);
ConduitInitiator ci = getConduitInitiator(address);
// create a new Message and Exchange
EndpointInfo info = new EndpointInfo();
info.setAddress(address);
Message outMessage = new MessageImpl();
Exchange exch = new ExchangeImpl();
outMessage.setExchange(exch);
// sent GET request
try {
// TODO verify bus
final Conduit c = ci.getConduit(info, BusFactory.getThreadDefaultBus(false));
if (c instanceof HTTPConduit) {
((HTTPConduit) c).getClient().setAutoRedirect(true);
}
outMessage.put(Message.HTTP_REQUEST_METHOD, "GET");
c.prepare(outMessage);
c.setMessageObserver(createMessageObserver(c));
c.close(outMessage);
} catch (Exception ex) {
throw MESSAGES.getRequestCouldNotBeSent(ex);
}
// read SOAPMessage
return readSoapMessage(exch);
}
use of org.apache.cxf.message.Message in project jbossws-cxf by jbossws.
the class SOAPConnectionImpl method createMessageObserver.
@SuppressWarnings("unchecked")
private MessageObserver createMessageObserver(final Conduit c) {
return new MessageObserver() {
public void onMessage(Message inMessage) {
LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream();
try {
IOUtils.copy(inMessage.getContent(InputStream.class), bout);
inMessage.getExchange().put(InputStream.class, bout.createInputStream());
Map<String, List<String>> inHeaders = (Map<String, List<String>>) inMessage.get(Message.PROTOCOL_HEADERS);
inMessage.getExchange().put(Message.PROTOCOL_HEADERS, inHeaders);
c.close(inMessage);
} catch (IOException e) {
// ignore
Logger.getLogger(SOAPConnectionImpl.class).trace(e);
}
}
};
}
use of org.apache.cxf.message.Message in project jbossws-cxf by jbossws.
the class UDPConduit method dataReceived.
private void dataReceived(Message message, byte[] bytes, boolean async) {
final Message inMessage = new MessageImpl();
inMessage.setExchange(message.getExchange());
message.getExchange().setInMessage(inMessage);
inMessage.setContent(InputStream.class, new ByteArrayInputStream(bytes));
incomingObserver.onMessage(inMessage);
if (!message.getExchange().isSynchronous()) {
message.getExchange().setInMessage(null);
}
}
Aggregations