@Override public void start(final Deployment dep) { for (final Endpoint ep : dep.getService().getEndpoints()) { final Object serviceBean = ep.getAttachment(Object.class); org.apache.cxf.endpoint.Endpoint cxfEp = ep.getAttachment(org.apache.cxf.endpoint.Endpoint.class); ep.setInstanceProvider(new CXFInstanceProvider(serviceBean, cxfEp)); } setUserEndpointBus(dep); }
/** Initialize the service endpoint */ public void init(Endpoint endpoint) { this.endpoint = endpoint; ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null) throw NativeMessages.MESSAGES.cannotObtainEndpointMetaData(endpoint); bindingProvider = new CommonBindingProvider(sepMetaData); delegate = new HandlerDelegateJAXRPC(sepMetaData); }
public Endpoint query(Iterator<Endpoint> endpoints) { Endpoint endpoint = null; String pcName = this.pcLink; int hashIndex = this.pcLink.indexOf("#"); if (hashIndex > 0) { pcName = pcLink.substring(hashIndex + 1); } while(endpoints.hasNext()) { Endpoint auxEndpoint = endpoints.next(); if (EndpointState.STARTED.equals(auxEndpoint.getState())) { ServerEndpointMetaData sepMetaData = auxEndpoint.getAttachment(ServerEndpointMetaData.class); if (pcName.equals(sepMetaData.getPortComponentName())) { if (endpoint != null) { NativeLoggers.ROOT_LOGGER.multipleServiceEndpointFoundFor(pcLink); endpoint = null; break; } endpoint = auxEndpoint; } } } return endpoint; }
@Override protected Invocation setupInvocation(Endpoint ep, EndpointInvocation epInv, InvocationContext invContext) throws Exception { Invocation inv = super.setupInvocation(ep, epInv, invContext); // Attach the handler callback ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); invContext.addAttachment(HandlerCallback.class, new HandlerCallbackImpl(sepMetaData)); return inv; }
/** * Get the serviceURL as string for a given serviceID. */ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String pcLink = req.getParameter("pcLink"); if (pcLink == null) throw NativeMessages.MESSAGES.illegalNullArgument("pcLink"); Endpoint endpoint = epRegistry.resolve( new PortComponentResolver(pcLink) ); if (endpoint == null) throw NativeMessages.MESSAGES.cannotResolvePortComponentLink(pcLink); res.setContentType("text/plain"); PrintWriter out = res.getWriter(); ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); String endpointAddress = sepMetaData.getEndpointAddress(); out.println(endpointAddress); if (log.isDebugEnabled()) log.debug("Resolved " + pcLink + " to: " + endpointAddress); out.close(); } }
private static void injectServiceAndHandlerResources(Endpoint endpoint) { org.apache.cxf.endpoint.Endpoint ep = endpoint.getAttachment(org.apache.cxf.endpoint.Endpoint.class); if (ep != null) { @SuppressWarnings("rawtypes") List<Handler> chain = ((JaxWsEndpointImpl) ep).getJaxwsBinding().getHandlerChain(); if (chain != null) { for (Handler<?> handler : chain) { if (handler instanceof ConfigDelegateHandler) { handler = ((ConfigDelegateHandler<?>) handler).getDelegate(); } final Reference handlerReference = endpoint.getInstanceProvider().getInstance(handler.getClass().getName()); if (!handlerReference.isInitialized()) { final Object handlerInstance = handlerReference.getValue(); InjectionHelper.callPostConstructMethod(handlerInstance); handlerReference.setInitialized(); } } } } }
throw MESSAGES.cannotResolvePortComponentLink(pcLink); ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); endpointAddress = sepMetaData.getEndpointAddress();
private void handleWSDLRequest(Endpoint endpoint, OutputStream outputStream, String resPath, URL reqURL) throws MalformedURLException, IOException { ServerEndpointMetaData epMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); if (epMetaData == null) throw MESSAGES.cannotObtainEndpointMetaData(endpoint.getName()); //The WSDLFilePublisher should set the location to an URL URL wsdlLocation = epMetaData.getServiceMetaData().getWsdlLocation(); String wsdlPublishLoc = epMetaData.getServiceMetaData().getWsdlPublishLocation(); WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(wsdlLocation, wsdlPublishLoc, AbstractServerConfig.getServerIntegrationServerConfig()); Document document = wsdlRequestHandler.getDocumentForPath(reqURL, resPath); OutputStreamWriter writer = new OutputStreamWriter(outputStream); new DOMWriter(writer, Constants.DEFAULT_XML_CHARSET).setPrettyprint(true).print(document); }
@Override public void start(Deployment dep) { for (Endpoint ep : dep.getService().getEndpoints()) { ServiceEndpointInvoker epInvoker = ep.getAttachment(ServiceEndpointInvoker.class); if (epInvoker == null) { if (isJaxrpcEjbEndpoint(ep)) { epInvoker = new ServiceEndpointInvokerEJB21(); } else { epInvoker = new ServiceEndpointInvoker(); } ep.addAttachment(ServiceEndpointInvoker.class, epInvoker); epInvoker.init(ep); } } } }
/** * This overrides org.apache.cxf.jaxws.AbstractInvoker in order for using the JBossWS integration logic * to invoke the JBoss AS target bean. */ @Override protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, Object[] paramArray) throws Exception { Endpoint ep = exchange.get(Endpoint.class); final InvocationHandler invHandler = ep.getInvocationHandler(); final Invocation inv = createInvocation(invHandler, serviceObject, ep, m, paramArray); if (factory != null) { inv.getInvocationContext().setProperty("forceTargetBean", true); } Bus threadBus = BusFactory.getThreadDefaultBus(false); BusFactory.setThreadDefaultBus(disableDepUserDefThreadBus ? null : ep.getAttachment(Bus.class)); setNamespaceContextSelector(exchange); ClassLoader cl = SecurityActions.getContextClassLoader(); SecurityActions.setContextClassLoader(serviceObject.getClass().getClassLoader()); try { invHandler.invoke(ep, inv); return inv.getReturnValue(); } finally { SecurityActions.setContextClassLoader(cl); //make sure the right bus is restored after coming back from the endpoint method BusFactory.setThreadDefaultBus(threadBus); clearNamespaceContextSelector(exchange); } }
Endpoint ep = exchange.get(Endpoint.class); EJBMethodSecurityAttributeProvider attributeProvider = ep .getAttachment(EJBMethodSecurityAttributeProvider.class); if (attributeProvider != null) //ejb endpoints only can be associated with this...
ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null) throw MESSAGES.cannotObtainEndpointMetaData(ep.getName()); MessageFactoryImpl msgFactory = ep.getAttachment(MessageFactoryImpl.class); reqMessage = msgFactory.createMessage(headers, inputStream); ServiceEndpointInvoker epInvoker = ep.getAttachment(ServiceEndpointInvoker.class); if (epInvoker == null) throw MESSAGES.cannotObtainServiceEndpointInvoker(ep.getName());
ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null)
ROOT_LOGGER.trace("handleRequest: " + endpoint.getName()); ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null) throw MESSAGES.cannotObtainEndpointMetaData(endpoint.getName());