public void invokeDestination(final HttpServletRequest request, HttpServletResponse response, AbstractHTTPDestination d) throws ServletException { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Service http request on thread: " + Thread.currentThread()); } try { d.invoke(servletConfig, servletConfig.getServletContext(), request, response); } catch (IOException e) { throw new ServletException(e); } finally { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Finished servicing http request on thread: " + Thread.currentThread()); } } }
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); } }
registry.addDestination(d); configure(bus, d); d.finalizeConfig();
@Override public String getId(Map<String, Object> context) { String id = null; if (isMultiplexWithAddress()) { String address = (String)context.get(Message.PATH_INFO); if (null != address) { int afterLastSlashIndex = address.lastIndexOf("/") + 1; if (afterLastSlashIndex > 0 && afterLastSlashIndex < address.length()) { id = address.substring(afterLastSlashIndex); } } else { getLogger().log(Level.WARNING, new org.apache.cxf.common.i18n.Message( "MISSING_PATH_INFO", LOG).toString()); } } else { return super.getId(context); } return id; }
protected void updateDestination(HttpServletRequest request, String base, AbstractHTTPDestination d) { String ad = d.getEndpointInfo().getAddress(); if (ad == null && d.getAddress() != null && d.getAddress().getAddress() != null) { ad = d.getAddress().getAddress().getValue(); if (ad == null) { ad = "/"; } } // Using HTTP_PREFIX check is safe for ServletController // URI.create(ad).isRelative() can be used - a bit more expensive though if (ad != null && !ad.startsWith(HTTP_PREFIX)) { if (disableAddressUpdates) { request.setAttribute("org.apache.cxf.transport.endpoint.address", base + ad); } else { BaseUrlHelper.setAddress(d, base + ad); } } }
} else { d = destinationRegistry.checkRestfulRequest(pathInfo); if (d == null || d.getMessageObserver() == null) { if (returnErrors) { LOG.warning("Can't find the request for " if (d != null && d.getMessageObserver() != null) { Bus bus = d.getBus(); ClassLoaderHolder orig = null; try {
final HttpServletRequest req, final HttpServletResponse resp) throws IOException { setupContinuation(inMessage, req, resp); setEncoding(inMessage, req, contentType); String basePath = getBasePath(contextServletPath); if (!StringUtils.isEmpty(basePath)) { inMessage.put(Message.BASE_PATH, basePath); inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder()); inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE); headers.copyFromRequest(req); String credentials = headers.getAuthorization(); AuthorizationPolicy authPolicy = getAuthorizationPolicyFromMessage(credentials, httpSecurityContext); inMessage.put(AuthorizationPolicy.class, authPolicy); propogateSecureSession(req, inMessage);
final EndpointInfo endpointInfo = dest.getEndpointInfo(); final boolean autoRewrite = SoapAddressRewriteHelper.isAutoRewriteOn(dep.getAttachment(SOAPAddressRewriteMetadata.class)); endpointInfo.setProperty(WSDLGetUtils.AUTO_REWRITE_ADDRESS, autoRewrite); endpointInfo.setProperty(WSDLGetUtils.AUTO_REWRITE_ADDRESS_ALL, autoRewrite); dest.invoke(cfg, context, req, response);
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(); }
} else { d = destinationRegistry.checkRestfulRequest(pathInfo); if (d == null || d.getMessageObserver() == null) { if (returnErrors) { LOG.warning("Can't find the the request for " Bus bus = d.getBus(); ClassLoaderHolder orig = null; try { && queryHandlerRegistry != null) { EndpointInfo ei = d.getEndpointInfo(); String ctxUri = request.getPathInfo(); String baseUri = request.getRequestURL().toString()
BatchItemResponse response = new BatchItemResponse(); try { dest.invoke(servletConfig, servletConfig.getServletContext(), request, response); LOG.debug("Returned:\nstatus: {}\nheaders: {}\nbody:\n{}", response.getStatus(), response.getHeaders(), new String(response.getUnderlyingOutputStream().toByteArray())); LOG.error("Invocation of {} failed", dest.getPath(), e);
private WebSocketDestination(final AbstractHTTPDestination delegate, final WebSocketRegistry registry) throws IOException { super(delegate.getBus(), registry, new EndpointInfo(), delegate.getPath(), false); this.delegate = delegate; this.cproviderFactory = new WebSocketContinuationFactory(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 EndpointReferenceType getAddressWithId(String id) { EndpointReferenceType ref = null; if (isMultiplexWithAddress()) { String address = EndpointReferenceUtils.getAddress(reference); ref = EndpointReferenceUtils.duplicate(reference); if (address.endsWith("/")) { EndpointReferenceUtils.setAddress(ref, address + id); } else { EndpointReferenceUtils.setAddress(ref, address + "/" + id); } } else { ref = super.getAddressWithId(id); } return ref; }
sb = ((AbstractHTTPDestination)sd).getBus();
@Override public boolean isFixedParameterOrder() { return delegate.isFixedParameterOrder(); }
@Override public EndpointReferenceType getAddress() { return delegate.getAddress(); }
final HttpServletRequest req, final HttpServletResponse resp) throws IOException { setupContinuation(inMessage, req, resp); setEncoding(inMessage, req, contentType); String basePath = getBasePath(contextServletPath); if (!StringUtils.isEmpty(basePath)) { inMessage.put(Message.BASE_PATH, basePath); inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder()); inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE); headers.copyFromRequest(req); String credentials = headers.getAuthorization(); AuthorizationPolicy authPolicy = getAuthorizationPolicyFromMessage(credentials, httpSecurityContext); inMessage.put(AuthorizationPolicy.class, authPolicy); propogateSecureSession(req, inMessage);
protected void updateDestination(HttpServletRequest request, String base, AbstractHTTPDestination d) { String ad = d.getEndpointInfo().getAddress(); if (ad == null && d.getAddress() != null && d.getAddress().getAddress() != null) { ad = d.getAddress().getAddress().getValue(); if (ad == null) { ad = "/"; } } // Using HTTP_PREFIX check is safe for ServletController // URI.create(ad).isRelative() can be used - a bit more expensive though if (ad != null && !ad.startsWith(HTTP_PREFIX)) { if (disableAddressUpdates) { request.setAttribute("org.apache.cxf.transport.endpoint.address", base + ad); } else { BaseUrlHelper.setAddress(d, base + ad); } } }
public void destroy() { if (!globalRegistry) { 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(); super.destroy(); }