本文整理汇总了Java中org.apache.cxf.endpoint.Endpoint类的典型用法代码示例。如果您正苦于以下问题:Java Endpoint类的具体用法?Java Endpoint怎么用?Java Endpoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Endpoint类属于org.apache.cxf.endpoint包,在下文中一共展示了Endpoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureMessage2
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
@Test
public void configureMessage2() throws IllegalArgumentException {
final UserImportEntry entry = Mockito.mock(UserImportEntry.class);
Mockito.when(entry.getId()).thenThrow(new RuntimeException());
final BatchTaskVo<UserImportEntry> importTask = new BatchTaskVo<>();
importTask.setEntries(Collections.singletonList(entry));
final Message message = Mockito.mock(Message.class);
final UserFullLdapTask task = new UserFullLdapTask() {
@Override
protected Message getMessage() {
return message;
}
};
final Exchange exchange = Mockito.mock(Exchange.class);
Mockito.when(message.getExchange()).thenReturn(exchange);
final Endpoint endpoint = Mockito.mock(Endpoint.class);
Mockito.when(exchange.getEndpoint()).thenReturn(endpoint);
Mockito.when(endpoint.get("org.apache.cxf.jaxrs.provider.ServerProviderFactory")).thenReturn(ServerProviderFactory.getInstance());
task.configure(importTask);
}
示例2: setupEndpoint
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
protected void setupEndpoint(Endpoint ep) {
resetPartTypes(ep.getBinding());
Class<?> fmt = Source.class;
if (ep.getBinding() instanceof SoapBinding) {
ep.getInInterceptors().add(new SAAJInInterceptor());
SAAJOutInterceptor out = new SAAJOutInterceptor();
ep.getOutInterceptors().add(out);
ep.getOutInterceptors().add(new CxfMessageSoapHeaderOutInterceptor());
ep.getOutInterceptors().add(new MessageModeOutInterceptor(out, ep.getBinding().getBindingInfo().getName()));
fmt = SOAPMessage.class;
} else {
ep.getOutInterceptors().add(new MessageModeOutInterceptor(Source.class, ep.getBinding().getBindingInfo().getName()));
}
ep.getInInterceptors().add(new MessageModeInInterceptor(fmt, ep.getBinding().getBindingInfo().getName()));
ep.put(AbstractInDatabindingInterceptor.NO_VALIDATE_PARTS, Boolean.TRUE);
// need to remove the wrapper class and holder interceptor
removeInterceptors(ep.getInInterceptors(), REMOVING_IN_INTERCEPTORS);
removeInterceptors(ep.getOutInterceptors(), REMOVING_OUT_INTERCEPTORS);
}
示例3: cleanupPreviousProps
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
private void cleanupPreviousProps(Client client) {
Endpoint ep = client.getEndpoint();
String[] previousProps = (String[])ep.get(JBOSSWS_CXF_CLIENT_CONF_PROPS);
if (previousProps != null) {
for (String p : previousProps) {
if (Constants.CXF_IN_INTERCEPTORS_PROP.equals(p)) {
InterceptorUtils.removeInterceptors(client.getInInterceptors(), (String)ep.get(p));
} else if (Constants.CXF_OUT_INTERCEPTORS_PROP.equals(p)) {
InterceptorUtils.removeInterceptors(client.getOutInterceptors(), (String)ep.get(p));
} else if (Constants.CXF_IN_FAULT_INTERCEPTORS_PROP.equals(p)) {
InterceptorUtils.removeInterceptors(client.getInFaultInterceptors(), (String)ep.get(p));
} else if (Constants.CXF_OUT_FAULT_INTERCEPTORS_PROP.equals(p)) {
InterceptorUtils.removeInterceptors(client.getOutFaultInterceptors(), (String)ep.get(p));
} else if (Constants.CXF_FEATURES_PROP.equals(p)) {
Loggers.ROOT_LOGGER.couldNoRemoveFeaturesOnClient((String)ep.get(p));
}
ep.remove(p);
}
ep.remove(JBOSSWS_CXF_CLIENT_CONF_PROPS);
}
}
示例4: handleEvent
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
public void handleEvent(Event ev, AbstractServiceFactoryBean factory, Object... args)
{
switch (ev)
{
case ENDPOINT_SELECTED : {
Class<?> cls = (Class<?>) args[2];
Class<?> implCls = (Class<?>) args[3];
Endpoint ep = (Endpoint) args[1];
addPolicies(factory, ep, cls, implCls);
break;
}
case BINDING_OPERATION_CREATED :
BindingOperationInfo boi = (BindingOperationInfo) args[1];
Method m = (Method) args[2];
addPolicies(factory, boi.getOperationInfo(), m);
break;
default :
//ignore
}
}
示例5: getTestExchange
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
private Exchange getTestExchange() {
Exchange exchange = new ExchangeImpl();
Message message = new MessageImpl();
message.setExchange(exchange);
exchange.setInMessage(message);
exchange.put(BindingOperationInfo.class, new BindingOperationInfo());
Service service = new ServiceImpl();
MethodDispatcher md = new MethodDispatcher() {
@Override
public Method getMethod(BindingOperationInfo op) {
return this.getClass().getMethods()[0];
}
@Override
public BindingOperationInfo getBindingOperation(Method m, Endpoint endpoint) {
return null;
}
@Override
public void bind(OperationInfo o, Method... methods) {
}
};
service.put(MethodDispatcher.class.getName(), md);
exchange.put(Service.class, service);
return exchange;
}
示例6: convert
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
private Object[] convert(Endpoint endpoint, QName opName, Object... params) throws Exception {
List<Object> listSoapObject = new ArrayList<Object>();
BindingOperationInfo boi = endpoint.getEndpointInfo().getBinding().getOperation(opName); // Operation name is processOrder
BindingMessageInfo inputMessageInfo = null;
if (!boi.isUnwrapped()) {
inputMessageInfo = boi.getWrappedOperation().getInput();
} else {
inputMessageInfo = boi.getUnwrappedOperation().getInput();
}
List<MessagePartInfo> parts = inputMessageInfo.getMessageParts();
int index = 0;
for(Object obj : params){
MessagePartInfo partInfo = parts.get(index++);
Class<?> soapClass = partInfo.getTypeClass();
Object soapObject = copytoSoapObject(obj, soapClass);
listSoapObject.add(soapObject);
}
return listSoapObject.toArray();
}
示例7: configure
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
public static final void configure(Endpoint endpoint, PortData port) {
final Properties p = port.getProperties();
if (p != null && p.containsKey(OPENEJB_ENDPOINT_CONFIGURATOR)) {
final String classname = p.getProperty(OPENEJB_ENDPOINT_CONFIGURATOR);
try {
final EndpointConfigurator configurator = (EndpointConfigurator) Thread.currentThread().getContextClassLoader().loadClass(classname).newInstance();
configurator.configure(endpoint, p);
} catch (Exception e) {
LOGGER.error("can't configure endpoint " + endpoint + " with configurator " + classname + ", using default config", e);
if (port.isSecure()) {
setupWSS4JChain(endpoint, p);
}
}
} else {
if (port.isSecure()) {
setupWSS4JChain(endpoint, p);
}
}
}
示例8: getEndpointReference
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
public EndpointReference getEndpointReference(Element... referenceParameters) {
org.apache.cxf.message.Message msg = getWrappedMessage();
Endpoint ep = msg.getExchange().get(Endpoint.class);
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
builder.address(ep.getEndpointInfo().getAddress());
builder.serviceName(ep.getService().getName());
builder.endpointName(ep.getEndpointInfo().getName());
if (referenceParameters != null) {
for (Element referenceParameter : referenceParameters) {
builder.referenceParameter(referenceParameter);
}
}
return builder.build();
}
示例9: handleMessage
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
/**
*/
public void handleMessage(Message message) throws Fault {
Endpoint endpoint = message.getExchange().get(Endpoint.class);
@SuppressWarnings(value = "unchecked")
Class<? extends com.google.protobuf.Message> messageClass = (Class) message.getExchange().get(IN_MESSAGE_CLASS);
if (messageClass == null) {
messageClass = (Class) endpoint
.get(IN_MESSAGE_CLASS);
}
InputStream in = message.getContent(InputStream.class);
try {
com.google.protobuf.Message m = (com.google.protobuf.Message) messageClass.getMethod("parseFrom",
InputStream.class).invoke(null, in);
message.setContent(com.google.protobuf.Message.class, m);
} catch (Exception e) {
log.error("Failed to invoke message method from protobuffer.",e);
throw new RuntimeException(e);
}
}
示例10: setExchangeProperties
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
protected void setExchangeProperties(Exchange exchange, Endpoint ep) {
if (ep != null) {
exchange.put(Endpoint.class, ep);
exchange.put(Service.class, ep.getService());
if (ep.getEndpointInfo().getService() != null) {
exchange.put(ServiceInfo.class, ep.getEndpointInfo()
.getService());
exchange.put(InterfaceInfo.class, ep.getEndpointInfo()
.getService().getInterface());
}
exchange.put(Binding.class, ep.getBinding());
exchange.put(BindingInfo.class, ep.getEndpointInfo().getBinding());
}
exchange.put(MessageObserver.class, this);
exchange.put(Bus.class, getBus());
}
示例11: setupInterceptorChain
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
protected InterceptorChain setupInterceptorChain(Exchange exchange) {
if (outgoingInterceptorChain != null) {
return outgoingInterceptorChain;
}
Endpoint endpoint = getEndpoint(exchange);
PhaseManager pm = bus.getExtension(PhaseManager.class);
@SuppressWarnings("unchecked")
List<Interceptor<? extends org.apache.cxf.message.Message>> i1 = bus.getOutInterceptors();
@SuppressWarnings("unchecked")
List<Interceptor<? extends org.apache.cxf.message.Message>> i2 = endpoint.getOutInterceptors();
@SuppressWarnings("unchecked")
List<Interceptor<? extends org.apache.cxf.message.Message>> i3 = getOutInterceptors();
@SuppressWarnings("unchecked")
List<Interceptor<? extends org.apache.cxf.message.Message>> i4 = endpoint.getBinding().getOutInterceptors();
PhaseInterceptorChain phaseInterceptorChain = outboundChainCache.get(pm
.getOutPhases(), i1, i2, i3, i4);
return phaseInterceptorChain;
}
示例12: getOutMessage
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
private Message getOutMessage(Message inMessage) {
Exchange exchange = inMessage.getExchange();
Message outMessage = exchange.getOutMessage();
if (outMessage == null) {
Endpoint endpoint = exchange.get(Endpoint.class);
outMessage = endpoint.getBinding().createMessage();
exchange.setOutMessage(outMessage);
}
outMessage.putAll(inMessage);
return outMessage;
}
示例13: configureWSSecurity
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
public static <T extends CallbackHandler> void configureWSSecurity(Object wsPort, String user, T passwordCallbackInstance)
{
Client cxfClient = ClientProxy.getClient(wsPort);
Endpoint cxfEndpoint = cxfClient.getEndpoint();
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, user);
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_REF, passwordCallbackInstance);
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
}
示例14: handleMessage
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
public void handleMessage(Message message) throws Fault {
Exchange ex = message.getExchange();
// This test verifies that the "to" endpoint is not the from endpoint.
Endpoint endpoint = ex.get(Endpoint.class);
if ("http://localhost:9003/CamelContext/RouterPort".equals(endpoint.getEndpointInfo().getAddress())) {
throw new Fault(new Exception("bad endpoint " + endpoint.getEndpointInfo().getAddress()));
}
}
示例15: publishContractToFilesystem
import org.apache.cxf.endpoint.Endpoint; //导入依赖的package包/类
/**
* Publish the contract to a file using the configured wsdl publisher
*
*/
protected void publishContractToFilesystem()
{
// Publish wsdl after endpoint deployment, as required by JSR-109, section 8.2
if (wsdlPublisher != null)
{
Endpoint endpoint = getServer().getEndpoint();
Service service = endpoint.getService();
try
{
String wsdlLocation = getWsdlLocation();
if (wsdlLocation == null) {
JaxWsImplementorInfo info = new JaxWsImplementorInfo(getImplementorClass());
wsdlLocation = info.getWsdlLocation();
}
updateSoapAddress();
wsdlPublisher.publishWsdlFiles(service.getName(), wsdlLocation, this.getBus(), service.getServiceInfos());
}
catch (IOException ioe)
{
throw new RuntimeException(ioe);
}
}
else
{
Loggers.DEPLOYMENT_LOGGER.unableToPublishContractDueToMissingPublisher(getImplementorClass());
}
}