本文整理汇总了Java中org.apache.cxf.transport.http.HTTPTransportFactory类的典型用法代码示例。如果您正苦于以下问题:Java HTTPTransportFactory类的具体用法?Java HTTPTransportFactory怎么用?Java HTTPTransportFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTTPTransportFactory类属于org.apache.cxf.transport.http包,在下文中一共展示了HTTPTransportFactory类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConduit
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
@Override
public HTTPConduit createConduit(HTTPTransportFactory f, Bus b, EndpointInfo localInfo, EndpointReferenceType target)
throws IOException
{
HTTPConduit conduit = null;
if (delegate != null)
{
conduit = delegate.createConduit(f, b, localInfo, target);
}
else
{
conduit = createNewConduit(f, b, localInfo, target);
}
if (conduit != null)
{
configureConduit(conduit);
}
return conduit;
}
示例2: initFrameworkServlet
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
@Override
protected void initFrameworkServlet() throws ServletException, BeansException {
this.httpInvokerHandler = new KSBHttpInvokerHandler();
Bus bus = KSBServiceLocator.getCXFBus();
List<Interceptor<? extends Message>> inInterceptors = KSBServiceLocator.getInInterceptors();
if(inInterceptors != null) {
List<Interceptor<? extends Message>> busInInterceptors = bus.getInInterceptors();
busInInterceptors.addAll(inInterceptors);
}
List<Interceptor<? extends Message>> outInterceptors = KSBServiceLocator.getOutInterceptors();
if(outInterceptors != null) {
List<Interceptor<? extends Message>> busOutInterceptors = bus.getOutInterceptors();
busOutInterceptors.addAll(outInterceptors);
}
HTTPTransportFactory transportFactory = bus.getExtension(HTTPTransportFactory.class);
if (transportFactory == null) {
throw new IllegalStateException("Failed to locate HTTPTransportFactory extension on Apache CXF Bus");
}
DestinationRegistry destinationRegistry = transportFactory.getRegistry();
this.cxfServletController = new ServletController(destinationRegistry, getCXFServletConfig(
this.getServletConfig()), new ServiceListGeneratorServlet(destinationRegistry, bus));
this.setPublishEvents(false);
}
示例3: getDestinationRegistryFromBus
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
private static DestinationRegistry getDestinationRegistryFromBus(Bus bus) throws ServletException {
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
try {
DestinationFactory df = dfm
.getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
if (df instanceof HTTPTransportFactory) {
HTTPTransportFactory transportFactory = (HTTPTransportFactory)df;
return transportFactory.getRegistry();
}
} catch (BusException e) {
throw Messages.MESSAGES.cannotObtainDestinationFactoryForHttpTransport(e);
}
return null;
}
示例4: handleRequest
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
@Nullable
@Override
public ModelAndView handleRequest(HttpServletRequest servletReq, HttpServletResponse servletResp) throws Exception {
String destPath = StringUtils.prependIfMissing(
StringUtils.removeStart(((String) servletReq.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE)), this.baseUrlPath),
SdcctStringUtils.SLASH), txId;
DestinationRegistry destReg =
((HTTPTransportFactory) this.bus.getExtension(DestinationFactoryManager.class).getDestinationFactoryForUri(HTTP_TRANSPORT_NS_URI)).getRegistry();
AbstractHTTPDestination dest = destReg.getDestinationForPath(destPath, true);
if (dest == null) {
dest = destReg.checkRestfulRequest(destPath);
}
if (dest != null) {
servletReq.setAttribute(ENDPOINT_ADDR_SERVLET_REQ_ATTR_NAME, (this.baseUrlPath + dest.getEndpointInfo().getAddress()));
try {
MDC.put(SdcctPropertyNames.WS_SERVER_TX_ID, (txId = this.txIdGen.generateId().toString()));
servletReq.setAttribute(SdcctPropertyNames.HTTP_SERVER_TX_ID, txId);
BusFactory.setThreadDefaultBus(bus);
dest.invoke(this.servletConfig, this.servletContext, servletReq, servletResp);
} finally {
BusFactory.setThreadDefaultBus(null);
MDC.remove(SdcctPropertyNames.WS_SERVER_TX_ID);
}
} else {
// TODO: improve error handling
LOGGER.error(String.format("Unable to determine CXF destination (path=%s) for request.", destPath));
servletResp.setStatus(HttpStatus.NOT_FOUND.value());
}
return null;
}
示例5: afterPropertiesSet
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
this.bus.getExtension(ResourceManager.class).addResourceResolver(new ServletContextResourceResolver(this.servletConfig.getServletContext()));
this.servletController =
new ServiceServletController(((HTTPTransportFactory) this.bus.getExtension(DestinationFactoryManager.class).getDestinationFactoryForUri(
HTTPTransportFactory.DEFAULT_NAMESPACES.get(0))).getRegistry());
}
示例6: getDestinationRegistryFromBus
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
private static DestinationRegistry getDestinationRegistryFromBus(Bus bus) {
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
try {
DestinationFactory df = dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
if (df instanceof HTTPTransportFactory) {
HTTPTransportFactory transportFactory = (HTTPTransportFactory) df;
return transportFactory.getRegistry();
}
} catch (BusException e) {
// why are we throwing a busexception if the DF isn't found?
}
return null;
}
示例7: createNewConduit
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
protected HTTPConduit createNewConduit(HTTPTransportFactory f, Bus b, EndpointInfo localInfo,
EndpointReferenceType target) throws IOException
{
return new URLConnectionHTTPConduit(b, localInfo, target);
}
示例8: beforeStart
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
@Override
protected void beforeStart() {
super.beforeStart();
destinationFactory = new HTTPTransportFactory();
}
示例9: createHttpListener
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
@Override
protected RsHttpListener createHttpListener() {
return new CxfRsHttpListener(!factoryByListener ? destinationFactory : new HTTPTransportFactory(), getWildcard(), this);
}
示例10: messageTo
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
private Message messageTo(String requestBaseURL, String requestPath) {
Message message = new SoapMessage(Soap11.getInstance());
String requestURL = requestBaseURL + requestPath;
message.put(Message.ENDPOINT_ADDRESS, requestURL);
message.put(Message.BASE_PATH, requestBaseURL);
message.put(Message.REQUEST_URI, requestURL);
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put(Client.REQUEST_CONTEXT, new HashMap<String, Object>());
message.put(Message.INVOCATION_CONTEXT, ctx);
CXFBusImpl bus = new CXFBusImpl();
BindingFactoryManagerImpl bindingFactoryManager = new BindingFactoryManagerImpl();
bindingFactoryManager.registerBindingFactory("abc", new JAXRSBindingFactory());
bus.setExtension(bindingFactoryManager, BindingFactoryManager.class);
Map<String, ConduitInitiator> conduitInitiators = new HashMap<String, ConduitInitiator>();
ConduitInitiator ci = new HTTPTransportFactory(bus);
conduitInitiators.put(ENDPOINT_TRANSPORT_ID, ci);
ConduitInitiatorManagerImpl cim = new ConduitInitiatorManagerImpl(conduitInitiators);
bus.setExtension(cim, ConduitInitiatorManager.class);
Exchange exchange = exchange(message);
exchange.put(Bus.class, bus);
EndpointInfo ei = new EndpointInfo();
ei.setAddress("http://abc123");
BindingInfo b = new BindingInfo(null, "abc");
ei.setBinding(b);
Endpoint endpointMock = mock(Endpoint.class);
when(endpointMock.getEndpointInfo()).thenReturn(ei);
exchange.put(Endpoint.class, endpointMock);
message.setExchange(exchange);
message.setContent(List.class, new ArrayList<String>());
circuitBreakerTargetSelector.prepare(message);
InvocationKey key = new InvocationKey(exchange);
InvocationContext invocation = circuitBreakerTargetSelector.getInvocation(key);
invocation.getContext().put(Message.ENDPOINT_ADDRESS, requestPath);
invocation.getContext().put("org.apache.cxf.request.uri", requestPath);
return message;
}
示例11: createNewConduit
import org.apache.cxf.transport.http.HTTPTransportFactory; //导入依赖的package包/类
/**
* Creates a new HTTPConduit instance; this is used internally when no delegate is available for getting a HTTPConduit instance to configure
*
* @param f The current HTTPTransportFactory
* @param b The current Bus
* @param localInfo The current EndpointInfo
* @param target The EndpointReferenceType
* @return A new HTTPConduit instance
* @throws IOException
*/
protected abstract HTTPConduit createNewConduit(HTTPTransportFactory f, Bus b, EndpointInfo localInfo,
EndpointReferenceType target) throws IOException;