use of org.apache.cxf.transport.Conduit in project cxf by apache.
the class UndertowHTTPDestinationTest method testGetBackChannelSendFault.
@Test
public void testGetBackChannelSendFault() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false, true, 500);
destination.doService(request, response);
setUpInMessage();
Conduit backChannel = destination.getBackChannel(inMessage);
outMessage = setUpOutMessage();
backChannel.prepare(outMessage);
verifyBackChannelSend(backChannel, outMessage, 500);
}
use of org.apache.cxf.transport.Conduit in project cxf by apache.
the class CorbaBindingFactoryTest method testGetCorbaConduit.
@Test
public void testGetCorbaConduit() throws Exception {
setupServiceInfo("http://cxf.apache.org/bindings/corba/simple", "/wsdl_corbabinding/simpleIdl.wsdl", "SimpleCORBAService", "SimpleCORBAPort");
Conduit conduit = factory.getConduit(endpointInfo, bus);
assertNotNull(conduit);
conduit = factory.getConduit(endpointInfo, null, bus);
assertNotNull(conduit);
target = EasyMock.createMock(EndpointReferenceType.class);
conduit = factory.getConduit(endpointInfo, target, bus);
assertNotNull(conduit);
}
use of org.apache.cxf.transport.Conduit in project cxf by apache.
the class JavascriptGetInterceptor method handleMessage.
public void handleMessage(Message message) throws Fault {
String method = (String) message.get(Message.HTTP_REQUEST_METHOD);
String query = (String) message.get(Message.QUERY_STRING);
if (!"GET".equals(method) || StringUtils.isEmpty(query)) {
return;
}
String baseUri = (String) message.get(Message.REQUEST_URL);
URI uri = null;
try {
uri = URI.create(baseUri);
} catch (IllegalArgumentException iae) {
// invalid URI, ignore and continue
return;
}
Map<String, String> map = UrlUtils.parseQueryString(query);
if (isRecognizedQuery(map, uri, message.getExchange().getEndpoint().getEndpointInfo())) {
try {
Conduit c = message.getExchange().getDestination().getBackChannel(message);
Message mout = new MessageImpl();
mout.setExchange(message.getExchange());
message.getExchange().setOutMessage(mout);
mout.put(Message.CONTENT_TYPE, "application/javascript;charset=UTF-8");
c.prepare(mout);
OutputStream os = mout.getContent(OutputStream.class);
writeResponse(uri, map, os, message.getExchange().getEndpoint());
} catch (IOException ioe) {
throw new Fault(ioe);
}
}
}
use of org.apache.cxf.transport.Conduit in project cxf by apache.
the class JAXRSClientFactoryBeanTest method testGetConduit.
@Test
public void testGetConduit() throws Exception {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress("http://bar");
bean.setResourceClass(BookStore.class);
BookStore store = bean.create(BookStore.class);
Conduit conduit = WebClient.getConfig(store).getConduit();
assertTrue(conduit instanceof HTTPConduit);
}
use of org.apache.cxf.transport.Conduit in project cxf by apache.
the class AbstractSTSClient method findOperation.
protected BindingOperationInfo findOperation(String suffix) {
BindingInfo bi = client.getEndpoint().getBinding().getBindingInfo();
for (BindingOperationInfo boi : bi.getOperations()) {
SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class);
String soapAction = soi != null ? soi.getAction() : null;
Object o = boi.getOperationInfo().getInput().getExtensionAttribute(new QName("http://www.w3.org/2007/05/addressing/metadata", "Action"));
if (o instanceof QName) {
o = ((QName) o).getLocalPart();
}
String wsamAction = o == null ? null : o.toString();
if ((soapAction != null && soapAction.endsWith(suffix)) || (wsamAction != null && wsamAction.endsWith(suffix))) {
PolicyEngine pe = bus.getExtension(PolicyEngine.class);
Conduit conduit = client.getConduit();
EffectivePolicy effectivePolicy = pe.getEffectiveClientRequestPolicy(client.getEndpoint().getEndpointInfo(), boi, conduit, PhaseInterceptorChain.getCurrentMessage());
setPolicyInternal(effectivePolicy.getPolicy());
return boi;
}
}
// we can at least find it by name and then set the action and such manually later.
for (BindingOperationInfo boi : bi.getOperations()) {
if (suffix.endsWith(boi.getName().getLocalPart())) {
return boi;
}
}
// Still didn't find anything useful
for (BindingOperationInfo boi : bi.getOperations()) {
if (boi.getInput().getMessageInfo().getMessagePartsNumber() > 0) {
MessagePartInfo mpi = boi.getInput().getMessageInfo().getFirstMessagePart();
if ("RequestSecurityToken".equals(mpi.getConcreteName().getLocalPart())) {
return boi;
}
}
}
return null;
}
Aggregations