public HTTPTransportFactory() { this(new DestinationRegistryImpl()); }
public AbstractHTTPDestination getDestinationForPath(String path) { return getDestinationForPath(path, false); }
@Override public void onServletConfigAvailable(ServletConfig config) throws ServletException { for (final AbstractHTTPDestination destination: getDestinations()) { if (destination instanceof ServletConfigAware) { ((ServletConfigAware)destination).onServletConfigAvailable(config); } } }
public AbstractHTTPDestination checkRestfulRequest(String address) { AbstractHTTPDestination ret = getRestfulDestination(getDestinationsPaths(), address); if (ret == null) { ret = getRestfulDestination(decodedDestinations.keySet(), address); } if (ret != null && ret.getMessageObserver() == null) { return null; } return ret; } private AbstractHTTPDestination getRestfulDestination(Set<String> destPaths, String address) {
public AbstractHTTPDestination getDestinationForPath(String path, boolean tryDecoding) { // to use the url context match String m = getTrimmedPath(path); AbstractHTTPDestination s = destinations.get(m); if (s == null) { s = decodedDestinations.get(m); } return s; }
public AbstractHTTPDestination checkRestfulRequest(String address) { AbstractHTTPDestination ret = getRestfulDestination(getDestinationsPaths(), address); if (ret == null) { ret = getRestfulDestination(decodedDestinations.keySet(), address); } if (ret != null && ret.getMessageObserver() == null) { return null; } return ret; } private AbstractHTTPDestination getRestfulDestination(Set<String> destPaths, String address) {
public synchronized void addDestination(AbstractHTTPDestination destination) { String path = getTrimmedPath(destination.getEndpointInfo().getAddress()); AbstractHTTPDestination dest = destinations.putIfAbsent(path, destination); if (dest != null && dest != destination) { throw new RuntimeException("Already a destination on " + path); } try { String path2 = URLDecoder.decode(path, "UTF-8"); if (!path.equals(path2)) { decodedDestinations.put(path2, destination); } } catch (UnsupportedEncodingException e) { throw new RuntimeException("Unsupported Encoding", e); } }
protected HTTPTransportFactory(List<String> transportIds, DestinationRegistry registry) { super(transportIds); if (registry == null) { registry = new DestinationRegistryImpl(); } this.registry = registry; }
public AbstractHTTPDestination checkRestfulRequest(String address) { AbstractHTTPDestination ret = getRestfulDestination(getDestinationsPaths(), address); if (ret == null) { ret = getRestfulDestination(decodedDestinations.keySet(), address); } if (ret != null && ret.getMessageObserver() == null) { return null; } return ret; } private AbstractHTTPDestination getRestfulDestination(Set<String> destPaths, String address) {
public AbstractHTTPDestination getDestinationForPath(String path, boolean tryDecoding) { // to use the url context match String m = getTrimmedPath(path); AbstractHTTPDestination s = destinations.get(m); if (s == null) { s = decodedDestinations.get(m); } return s; }
private AbstractHTTPDestination getRestfulDestination(Set<String> destPaths, String address) { int len = -1; AbstractHTTPDestination ret = null; for (String path : destPaths) { String thePath = path.length() > 1 && path.endsWith(SLASH) ? path.substring(0, path.length() - 1) : path; if ((address.equals(thePath) || SLASH.equals(thePath) || (address.length() > thePath.length() && address.startsWith(thePath) && address.charAt(thePath.length()) == '/')) && thePath.length() > len) { ret = getDestinationForPath(path); len = path.length(); } } return ret; }
public AbstractDestination[] getSortedDestinations() { List<AbstractHTTPDestination> dest2 = new LinkedList<>( getDestinations()); Collections.sort(dest2, new Comparator<AbstractHTTPDestination>() { public int compare(AbstractHTTPDestination o1, AbstractHTTPDestination o2) { InterfaceInfo i1 = o1.getEndpointInfo().getInterface(); InterfaceInfo i2 = o2.getEndpointInfo().getInterface(); if (i1 == null && i2 == null) { return 0; } else if (i1 == null) { return -1; } else if (i2 == null) { return 1; } else { return i1.getName().getLocalPart() .compareTo( i2.getName().getLocalPart()); } } }); return dest2.toArray(new AbstractDestination[0]); }
public Destination getDestination(EndpointInfo endpointInfo, Bus bus) throws IOException { if (destination == null) { destination = new JAXWSHttpSpiDestination(bus, new DestinationRegistryImpl(), endpointInfo); // set handler into the provided HttpContext, our Destination hook into the server container HttpHandlerImpl handler = new HttpHandlerImpl(destination); context.setHandler(handler); } return destination; }
public AbstractHTTPDestination getDestinationForPath(String path, boolean tryDecoding) { // to use the url context match String m = getTrimmedPath(path); AbstractHTTPDestination s = destinations.get(m); if (s == null) { s = decodedDestinations.get(m); } return s; }
public AbstractHTTPDestination getDestinationForPath(String path) { return getDestinationForPath(path, false); }
@Override public void onServletConfigAvailable(ServletConfig config) throws ServletException { for (final AbstractHTTPDestination destination: getDestinations()) { if (destination instanceof ServletConfigAware) { ((ServletConfigAware)destination).onServletConfigAvailable(config); } } }
public void start(final BundleContext context) throws Exception { ConfigAdminHttpConduitConfigurer conduitConfigurer = new ConfigAdminHttpConduitConfigurer(); registerService(context, ManagedServiceFactory.class, conduitConfigurer, ConfigAdminHttpConduitConfigurer.FACTORY_PID); registerService(context, HTTPConduitConfigurer.class, conduitConfigurer, "org.apache.cxf.http.conduit-configurer"); if (PropertyUtils.isTrue(context.getProperty(DISABLE_DEFAULT_HTTP_TRANSPORT))) { //TODO: Review if it also makes sense to support "http.transport.disable" // directly in the CXF_CONFIG_SCOPE properties file return; } DestinationRegistry destinationRegistry = new DestinationRegistryImpl(); HTTPTransportFactory transportFactory = new HTTPTransportFactory(destinationRegistry); HttpServiceTrackerCust customizer = new HttpServiceTrackerCust(destinationRegistry, context); httpServiceTracker = new ServiceTracker<>(context, HttpService.class, customizer); httpServiceTracker.open(); context.registerService(DestinationRegistry.class.getName(), destinationRegistry, null); context.registerService(HTTPTransportFactory.class.getName(), transportFactory, null); BlueprintNameSpaceHandlerFactory factory = new BlueprintNameSpaceHandlerFactory() { @Override public Object createNamespaceHandler() { return new HttpBPHandler(); } }; NamespaceHandlerRegisterer.register(context, factory, "http://cxf.apache.org/transports/http/configuration"); }
public synchronized void addDestination(AbstractHTTPDestination destination) { String path = getTrimmedPath(destination.getEndpointInfo().getAddress()); AbstractHTTPDestination dest = destinations.putIfAbsent(path, destination); if (dest != null && dest != destination) { throw new RuntimeException("Already a destination on " + path); } try { String path2 = URLDecoder.decode(path, "ISO-8859-1"); if (!path.equals(path2)) { decodedDestinations.put(URLDecoder.decode(path, "ISO-8859-1"), destination); } } catch (UnsupportedEncodingException e) { throw new RuntimeException("Unsupported Encoding", e); } }
public AbstractHTTPDestination getDestinationForPath(String path) { return getDestinationForPath(path, false); }
public AbstractDestination[] getSortedDestinations() { List<AbstractHTTPDestination> dest2 = new LinkedList<>( getDestinations()); Collections.sort(dest2, new Comparator<AbstractHTTPDestination>() { public int compare(AbstractHTTPDestination o1, AbstractHTTPDestination o2) { InterfaceInfo i1 = o1.getEndpointInfo().getInterface(); InterfaceInfo i2 = o2.getEndpointInfo().getInterface(); if (i1 == null && i2 == null) { return 0; } else if (i1 == null) { return -1; } else if (i2 == null) { return 1; } else { return i1.getName().getLocalPart() .compareTo( i2.getName().getLocalPart()); } } }); return dest2.toArray(new AbstractDestination[0]); }