use of org.apache.cxf.transport.http.AbstractHTTPDestination in project BIMserver by opensourceBIM.
the class GenericWebServiceServlet method destroy.
public void destroy() {
for (String path : destinationRegistry.getDestinationsPaths()) {
// clean up the destination in case the destination itself can no
// longer access the registry later
AbstractHTTPDestination dest = destinationRegistry.getDestinationForPath(path);
synchronized (dest) {
destinationRegistry.removeDestination(path);
dest.releaseRegistry();
}
}
destinationRegistry = null;
destroyBus();
}
use of org.apache.cxf.transport.http.AbstractHTTPDestination in project jbossws-cxf by jbossws.
the class RequestHandlerImpl method findDestination.
/**
* 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;
}
Aggregations