/** * Hack for Tuscany to get ?wsdl working with Tuscany service names * Can go once moved up to Axis2 1.3 */ private void setContextRoot(String filePart, String serviceName) { String contextRoot = configContext.getContextRoot(); if (contextRoot != null && contextRoot.length() > 0) { if (contextRoot.equals("/")) { configContext.setServicePath("/"); } else { int i = filePart.indexOf(contextRoot) + contextRoot.length(); int j = filePart.lastIndexOf(serviceName); if (i>=j || (i+1 == j)) { configContext.setServicePath("/"); } else { String mapping = filePart.substring(i+1, j); configContext.setServicePath(mapping); } } configContext.setContextRoot(contextRoot); } }
public Object addingService(ServiceReference serviceReference) { ConfigurationContext configCtx = (ConfigurationContext) context.getService(serviceReference); OSGiAxisServlet axisServlet = new OSGiAxisServlet(configCtx); String propServiceContextRoot = context.getProperty(AXIS2_OSGi_ROOT_CONTEXT); String serviceContextRoot = "services"; if (propServiceContextRoot != null && propServiceContextRoot.length() != 0) { if (propServiceContextRoot.startsWith("/")) { serviceContextRoot = propServiceContextRoot.substring(1); } else { serviceContextRoot = propServiceContextRoot; } } configCtx.setServicePath(serviceContextRoot); String contextRoot = "/" + serviceContextRoot; log.info("Registering SOAP message listener servlet to context : " + contextRoot); Hashtable props = new Hashtable(); props.put("alias", contextRoot); // Register the servlet as an OSGi service to be picked up by the HTTP whiteboard service. // We return the ServiceRegistration so that we can unregister the servlet later. return context.registerService(Servlet.class.getName(), axisServlet, props); }
private static void setContextPaths(AxisConfiguration axisConfig, ConfigurationContext configContext) { // Checking for context path Parameter servicePath = axisConfig.getParameter(Constants.PARAM_SERVICE_PATH); if (servicePath != null) { String spath = ((String) servicePath.getValue()).trim(); if (spath.length() > 0) { configContext.setServicePath(spath); } } else { configContext.setServicePath(Constants.DEFAULT_SERVICES_PATH); } Parameter contextPath = axisConfig.getParameter(Constants.PARAM_CONTEXT_ROOT); if (contextPath != null) { String cpath = ((String) contextPath.getValue()).trim(); if (cpath.length() > 0) { configContext.setContextRoot(cpath); } } else { configContext.setContextRoot("axis2"); } }
private static void setContextPaths(AxisConfiguration axisConfig, ConfigurationContext configContext) { // Checking for context path Parameter servicePath = axisConfig.getParameter(Constants.PARAM_SERVICE_PATH); if (servicePath != null) { String spath = ((String) servicePath.getValue()).trim(); if (spath.length() > 0) { configContext.setServicePath(spath); } } else { configContext.setServicePath(Constants.DEFAULT_SERVICES_PATH); } Parameter contextPath = axisConfig.getParameter(Constants.PARAM_CONTEXT_ROOT); if (contextPath != null) { String cpath = ((String) contextPath.getValue()).trim(); if (cpath.length() > 0) { configContext.setContextRoot(cpath); } } else { configContext.setContextRoot("axis2"); } }
protected void setConfigurationContextService(ConfigurationContextService ccService) { ConfigurationContext serverCtx = ccService.getServerConfigContext(); AxisConfiguration serverConfig = serverCtx.getAxisConfiguration(); LocalTransportReceiver.CONFIG_CONTEXT = new ConfigurationContext(serverConfig); LocalTransportReceiver.CONFIG_CONTEXT.setServicePath("services"); LocalTransportReceiver.CONFIG_CONTEXT.setContextRoot("local:/"); Util.setConfigurationContextService(ccService); }
protected void setConfigurationContextService(ConfigurationContextService ccService) { ConfigurationContext serverCtx = ccService.getServerConfigContext(); AxisConfiguration serverConfig = serverCtx.getAxisConfiguration(); LocalTransportReceiver.CONFIG_CONTEXT = new ConfigurationContext(serverConfig); LocalTransportReceiver.CONFIG_CONTEXT.setServicePath("services"); LocalTransportReceiver.CONFIG_CONTEXT.setContextRoot("local:/"); DataHolder.getInstance().setConfigurationContextService(ccService); }
@Override public void init() throws Exception { super.init(); String rootContext = null; String servicePath = null; String location = trimContext(this.portInfo.getLocation()); int pos = location.indexOf('/'); if (pos > 0) { rootContext = location.substring(0, pos); servicePath = location.substring(pos + 1); } else { rootContext = "/"; servicePath = location; } this.configurationContext.setServicePath(servicePath); //need to setContextRoot after servicePath as cachedServicePath is only built //when setContextRoot is called. this.configurationContext.setContextRoot(rootContext); // configure handlers try { configureHandlers(); } catch (Exception e) { throw new WebServiceException("Error configuring handlers", e); } this.factoryRegistry = new GeronimoFactoryRegistry(); this.factoryRegistry.put(EndpointLifecycleManager.class, new EJBEndpointLifecycleManager()); }
configurationContext.setServicePath(servicePath);
@Setup @SuppressWarnings("unused") private void setUp(TransportDescriptionFactory tdf, AxisTestEndpointContextConfigurator[] configurators) throws Exception { server = new UtilsTransportServer(); TransportOutDescription trpOutDesc = tdf.createTransportOutDescription(); trpInDesc = tdf.createTransportInDescription(); server.addTransport(trpInDesc, trpOutDesc); for (AxisTestEndpointContextConfigurator configurator : configurators) { configurator.setupTransport(trpInDesc, trpOutDesc); } ConfigurationContext cfgCtx = server.getConfigurationContext(); cfgCtx.setContextRoot("/"); cfgCtx.setServicePath("services"); AxisConfiguration axisConfiguration = server.getAxisConfiguration(); server.start(); }
@Setup @SuppressWarnings("unused") private void setUp(TransportDescriptionFactory tdf, AxisTestEndpointContextConfigurator[] configurators) throws Exception { server = new UtilsTransportServer(); TransportOutDescription trpOutDesc = tdf.createTransportOutDescription(); trpInDesc = tdf.createTransportInDescription(); server.addTransport(trpInDesc, trpOutDesc); for (AxisTestEndpointContextConfigurator configurator : configurators) { configurator.setupTransport(trpInDesc, trpOutDesc); } ConfigurationContext cfgCtx = server.getConfigurationContext(); cfgCtx.setContextRoot("/"); cfgCtx.setServicePath("services"); AxisConfiguration axisConfiguration = server.getAxisConfiguration(); server.start(); }
@Setup @SuppressWarnings("unused") private void setUp(TransportDescriptionFactory tdf, AxisTestEndpointContextConfigurator[] configurators) throws Exception { server = new UtilsTransportServer(); TransportOutDescription trpOutDesc = tdf.createTransportOutDescription(); trpInDesc = tdf.createTransportInDescription(); server.addTransport(trpInDesc, trpOutDesc); for (AxisTestEndpointContextConfigurator configurator : configurators) { configurator.setupTransport(trpInDesc, trpOutDesc); } ConfigurationContext cfgCtx = server.getConfigurationContext(); cfgCtx.setContextRoot("/"); cfgCtx.setServicePath("services"); AxisConfiguration axisConfiguration = server.getAxisConfiguration(); server.start(); }
@Override protected void setUp() throws Exception { service = new AxisService(); outputStream = new ByteArrayOutputStream(); schemas = new ArrayList<XmlSchema>(); loadSampleSchemaFile(schemas); service.addSchema(schemas); AxisConfiguration axisConfiguration = new AxisConfiguration(); service.setName("test_service"); axisConfiguration.addChild(service); axisConfiguration.addService(service); configurationContext = new ConfigurationContext(axisConfiguration); configurationContext.setServicePath("test_service"); configurationContext.setContextRoot("test/context"); messageContext.setConfigurationContext(configurationContext); }