/** * 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(); } }
/** * Initialize the service endpoint * @param contextPath context path * @param servletName servlet name */ private void initEndpoint(String contextPath, String servletName) { final EndpointResolver resolver = newEndpointResolver(contextPath, servletName); this.endpoint = epRegistry.resolve(resolver); if (this.endpoint == null) { ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath + "," + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName ); throw NativeMessages.MESSAGES.cannotObtainEndpoint(oname); } }
Endpoint endpoint = epRegistry.resolve( new PortComponentResolver(pcLink) ); if (endpoint == null) throw MESSAGES.cannotResolvePortComponentLink(pcLink);