本文整理汇总了Java中org.apache.cxf.transport.http.DestinationRegistry类的典型用法代码示例。如果您正苦于以下问题:Java DestinationRegistry类的具体用法?Java DestinationRegistry怎么用?Java DestinationRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DestinationRegistry类属于org.apache.cxf.transport.http包,在下文中一共展示了DestinationRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initFrameworkServlet
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的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);
}
示例2: getDestinationRegistryFromBus
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的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;
}
示例3: UndertowServerDestination
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
public UndertowServerDestination(Bus b, DestinationRegistry registry, EndpointInfo ei) throws IOException
{
super(b, registry, ei);
this.serverEngineFactory = getServerEngineFactory();
getAddressValue(ei, true); //generate address if not specified
this.url = new URL(ei.getAddress());
}
示例4: handleRequest
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的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: HttpServerDestination
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
public HttpServerDestination(Bus b, DestinationRegistry registry, EndpointInfo ei) throws IOException
{
super(b, registry, ei);
this.serverEngineFactory = getServerEngineFactory();
getAddressValue(ei, true); //generate address if not specified
this.url = new URL(ei.getAddress());
}
示例6: getDestinationRegistryFromBus
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的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: UndertowHTTPDestination
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
/**
* Constructor
*
* @param bus the associated Bus
* @param registry the associated destinationRegistry
* @param ei the endpoint info of the destination
* @throws java.io.IOException
*/
public UndertowHTTPDestination(Bus bus, DestinationRegistry registry, EndpointInfo ei) throws IOException {
//Add the default port if the address is missing it
super(bus, registry, ei, getAddressValue(ei, true).getAddress(), true);
this.serverEngineFactory = bus.getExtension(HttpServerEngineFactory.class);
if (serverEngineFactory != null) {
nurl = new URL(getAddress(endpointInfo));
}
loader = bus.getExtension(ClassLoader.class);
}
示例8: TestServiceServlet
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
/**
* @see org.apache.cxf.transport.servlet.CXFNonSpringServlet#CXFNonSpringServlet(org.apache.cxf.transport.http.DestinationRegistry)
*/
public TestServiceServlet(DestinationRegistry destinationRegistry) {
super(destinationRegistry);
}
示例9: findDestination
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
/**
* Finds destination based on request URI
* @param requestURI to be recognized
* @return destination associated with the request URI
* @throws ServletException when destination wasn't found
*/
private AbstractHTTPDestination findDestination(HttpServletRequest req, Bus bus) throws ServletException
{
// Find destination based on request URI
String requestURI = req.getRequestURI();
DestinationRegistry destRegistry = getDestinationRegistryFromBus(bus);
if (destRegistry == null)
{
throw Messages.MESSAGES.cannotObtainRegistry(DestinationRegistry.class.getName());
}
requestURI = pathPattern.matcher(requestURI).replaceAll("/");
//first try looking up the destination in the registry map
final AbstractHTTPDestination dest = destRegistry.getDestinationForPath(requestURI, true);
if (dest != null) {
return dest;
}
//if there's no direct match, iterate on the destinations to see if there's valid "catch-all" destination
//(servlet-based endpoints, with "/*" url-pattern in web.xml)
Collection<AbstractHTTPDestination> destinations = destRegistry.getDestinations();
AbstractHTTPDestination returnValue = null;
for (AbstractHTTPDestination destination : destinations)
{
String path = destination.getEndpointInfo().getAddress();
try
{
path = new URL(path).getPath();
}
catch (MalformedURLException ex)
{
// ignore
Logger.getLogger(RequestHandlerImpl.class).trace(ex);
}
if (path != null && requestURI.startsWith(path)) {
returnValue = destination;
}
}
if (returnValue == null)
throw Messages.MESSAGES.cannotObtainDestinationFor(requestURI);
return returnValue;
}
示例10: createDestination
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
@Override
public AbstractHTTPDestination createDestination(EndpointInfo endpointInfo, Bus bus, DestinationRegistry registry)
throws IOException
{
return new UndertowServerDestination(bus, registry, endpointInfo);
}
示例11: PublishingServlet
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
public PublishingServlet(DestinationRegistry destinationRegistry,
boolean loadBus) {
super(destinationRegistry, loadBus);
}
示例12: ServiceServletController
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
public ServiceServletController(DestinationRegistry destReg) throws ServletException {
super(destReg, ServiceController.this.servletConfig, new ServiceListGeneratorServlet(destReg, ServiceController.this.bus));
this.serviceListRelativePath = ServiceController.this.listPath;
}
示例13: createDestination
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
@Override
public AbstractHTTPDestination createDestination(EndpointInfo endpointInfo, Bus bus, DestinationRegistry registry)
throws IOException
{
return new HttpServerDestination(bus, registry, endpointInfo);
}
示例14: createDestination
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
@Override
public AbstractHTTPDestination createDestination(final EndpointInfo endpointInfo, final Bus bus,
final DestinationRegistry registry) throws IOException {
return new HttpDestination(bus, registry, endpointInfo, endpointInfo.getAddress());
}
示例15: HttpDestination
import org.apache.cxf.transport.http.DestinationRegistry; //导入依赖的package包/类
public HttpDestination(Bus bus, DestinationRegistry registry, EndpointInfo endpointInfo, String path) throws IOException {
super(bus, registry, endpointInfo, path, true);
}