Java Code Examples for org.apache.axis2.context.ConfigurationContext#getAxisConfiguration()

The following examples show how to use org.apache.axis2.context.ConfigurationContext#getAxisConfiguration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiscoveryShutdownHandler.java    From carbon-commons with Apache License 2.0 6 votes vote down vote up
public void invoke() {

        ConfigurationContext mainCfgCtx =
                ConfigHolder.getInstance().getServerConfigurationContext();
        if (mainCfgCtx != null) {
            AxisConfiguration mainAxisConfig = mainCfgCtx.getAxisConfiguration();
            if (mainAxisConfig.getParameter(DiscoveryConstants.DISCOVERY_PROXY) != null) {
                if (log.isDebugEnabled()) {
                    log.debug("Sending BYE messages for services deployed in the super tenant");
                }
                Util.unregisterServiceObserver(mainAxisConfig, true);
            }
        } else {
            log.warn("Unable to notify service undeployment. ConfigurationContext is " +
                    "unavailable.");
        }
    }
 
Example 2
Source File: WSDL2FormGenerator.java    From carbon-commons with Apache License 2.0 6 votes vote down vote up
private AxisService getAxisService(String url, String serviceContextRoot,
                                   ConfigurationContext configCtx) throws AxisFault {
    String service =
            url.substring(url.indexOf(serviceContextRoot) + serviceContextRoot.length(),
                    url.indexOf("?"));
    AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
    AxisService axisService = axisConfig.getServiceForActivation(service);
    if (axisService == null) {
        // Try to see whether the service is available in a tenant
        axisService = TenantAxisUtils.getAxisService(url, configCtx);
        axisConfig = TenantAxisUtils.getTenantAxisConfiguration(TenantAxisUtils
                .getTenantDomain(url), configCtx);
    }
    if (GhostDeployerUtils.isGhostService(axisService) && axisConfig != null) {
        // if the existing service is a ghost service, deploy the actual one
        axisService = GhostDeployerUtils.deployActualService(axisConfig, axisService);
    }
    return axisService;
}
 
Example 3
Source File: StatisticsAxis2ConfigurationContextObserver.java    From carbon-commons with Apache License 2.0 6 votes vote down vote up
public void createdConfigurationContext(ConfigurationContext configurationContext) {
    AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
    try {
        if (axisConfig.getModule(StatisticsConstants.STATISTISTICS_MODULE_NAME) != null) {
            axisConfig.engageModule(StatisticsConstants.STATISTISTICS_MODULE_NAME);
        }
    } catch (Throwable e) {
        PrivilegedCarbonContext carbonContext =
                PrivilegedCarbonContext.getThreadLocalCarbonContext();
        String msg;
        if (carbonContext.getTenantDomain() != null) {
            msg = "Could not globally engage " + StatisticsConstants.STATISTISTICS_MODULE_NAME +
                  " module to tenant " + carbonContext.getTenantDomain() +
                  "[" + carbonContext.getTenantId() + "]";
        } else {
            msg = "Could not globally engage " + StatisticsConstants.STATISTISTICS_MODULE_NAME +
                  " module to super tenant ";
        }
        log.error(msg, e);
    }
}
 
Example 4
Source File: SecurityMgtServiceComponent.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
protected void activate(ComponentContext ctxt) {
    try {
        ConfigurationContext mainConfigCtx = configContextService.getServerConfigContext();
        AxisConfiguration mainAxisConfig = mainConfigCtx.getAxisConfiguration();
        BundleContext bundleCtx = ctxt.getBundleContext();
        String enablePoxSecurity = ServerConfiguration.getInstance()
                .getFirstProperty("EnablePoxSecurity");
        if (enablePoxSecurity == null || "true".equals(enablePoxSecurity)) {
            mainAxisConfig.engageModule(POX_SECURITY_MODULE);
        } else {
            log.info("POX Security Disabled");
        }

        bundleCtx.registerService(SecurityConfigAdmin.class.getName(),
                new SecurityConfigAdmin(mainAxisConfig,
                        registryService.getConfigSystemRegistry(),
                        null),
                null);
        bundleCtx.registerService(Axis2ConfigurationContextObserver.class.getName(),
                new SecurityAxis2ConfigurationContextObserver(),
                null);
        log.debug("Security Mgt bundle is activated");
    } catch (Throwable e) {
        log.error("Failed to activate SecurityMgtServiceComponent", e);
    }
}
 
Example 5
Source File: SecurityAxis2ConfigurationContextObserver.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
@Override
public void createdConfigurationContext(ConfigurationContext configurationContext) {
    AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
    AxisModule poxSecModule =
            axisConfig.getModule("POXSecurityModule");
    if (poxSecModule != null) {
        try {
            axisConfig.engageModule(poxSecModule);
        } catch (AxisFault e) {
            log.error("Cannot globally engage POX Security module", e);
        }
    }
}
 
Example 6
Source File: VirtualHostClusterServiceComponent.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "config.context.service",
        service = org.wso2.carbon.utils.ConfigurationContextService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetConfigurationContextService")
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);
}
 
Example 7
Source File: DiscoveryAxis2ConfigurationContextObserver.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public void createdConfigurationContext(ConfigurationContext configurationContext) {
    AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
    try {
        if (DiscoveryMgtUtils.isServiceDiscoveryEnabled(axisConfig)) {
            if (log.isDebugEnabled()) {
                String domain = PrivilegedCarbonContext.getThreadLocalCarbonContext().
                        getTenantDomain(true);
                log.debug("Registering the Axis observer for WS-Discovery in tenant: " + domain);
            }
            Util.registerServiceObserver(axisConfig);
        }
    } catch (RegistryException e) {
        log.error("Checking whether service discovery is enabled for a tenant", e);
    }
}
 
Example 8
Source File: StatisticsModule.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public void init(ConfigurationContext configContext,
                 AxisModule module) throws AxisFault {

    AxisConfiguration axisConfig = configContext.getAxisConfiguration();

    {
        AtomicInteger globalRequestCounter = new AtomicInteger(0);
        Parameter globalRequestCounterParam = new Parameter();
        globalRequestCounterParam.setName(StatisticsConstants.GLOBAL_REQUEST_COUNTER);
        globalRequestCounterParam.setValue(globalRequestCounter);
        axisConfig.addParameter(globalRequestCounterParam);
    }

    {
        AtomicInteger globalResponseCounter = new AtomicInteger(0);
        Parameter globalResponseCounterParam = new Parameter();
        globalResponseCounterParam.setName(StatisticsConstants.GLOBAL_RESPONSE_COUNTER);
        globalResponseCounterParam.setValue(globalResponseCounter);
        axisConfig.addParameter(globalResponseCounterParam);
    }

    {
        AtomicInteger globalFaultCounter = new AtomicInteger(0);
        Parameter globalFaultCounterParam = new Parameter();
        globalFaultCounterParam.setName(StatisticsConstants.GLOBAL_FAULT_COUNTER);
        globalFaultCounterParam.setValue(globalFaultCounter);
        axisConfig.addParameter(globalFaultCounterParam);
    }

    {
        ResponseTimeProcessor responseTimeProcessor = new ResponseTimeProcessor();
        Parameter responseTimeProcessorParam = new Parameter();
        responseTimeProcessorParam.setName(StatisticsConstants.RESPONSE_TIME_PROCESSOR);
        responseTimeProcessorParam.setValue(responseTimeProcessor);
        axisConfig.addParameter(responseTimeProcessorParam);
    }
}
 
Example 9
Source File: TracerAdmin.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
/**
 * @param flag; support ON or OFF.
 * @return The information about the Tracer service
 * @throws AxisFault If the tracer module is not found
 */
public TracerServiceInfo setMonitoring(String flag) throws AxisFault {
    if (!flag.equalsIgnoreCase("ON") && !flag.equalsIgnoreCase("OFF")) {
        throw new RuntimeException("IllegalArgument for monitoring status. Only 'ON' and 'OFF' is allowed");
    }
    TracerServiceInfo tracerServiceInfo = new TracerServiceInfo();
    ConfigurationContext configurationContext = getConfigContext();
    AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration();
    AxisModule axisModule = axisConfiguration.getModule(TracerConstants.WSO2_TRACER);

    if (axisModule == null) {
        throw new RuntimeException(TracerAdmin.class.getName() + " " +
                                   TracerConstants.WSO2_TRACER + " is not available");
    }

    if (flag.equalsIgnoreCase("ON")) {
        if (!axisConfiguration.isEngaged(axisModule.getName())) {
            try {
                axisConfiguration.engageModule(axisModule);
            } catch (AxisFault axisFault) {
                log.error(axisFault);
                throw new RuntimeException(axisFault);
            }
        }
    } else if (flag.equalsIgnoreCase("OFF")) {
        if (axisConfiguration.isEngaged(axisModule.getName())) {
            axisConfiguration.disengageModule(axisModule);
            configurationContext.removeProperty(TracerConstants.MSG_SEQ_BUFFER);
        }
    }
    TracePersister tracePersister = getTracePersister();
    tracePersister.saveTraceStatus(flag);
    tracerServiceInfo.setEmpty(true);
    tracerServiceInfo.setFlag(flag);
    tracerServiceInfo.setTracePersister(tracePersister.getClass().getName());

    return tracerServiceInfo;
}
 
Example 10
Source File: CappDeployer.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public void init(ConfigurationContext configurationContext) {
    if (log.isDebugEnabled()) {
        log.debug("Initializing Capp Deployer..");
    }
    this.axisConfig = configurationContext.getAxisConfiguration();

    //delete the older extracted capps for this tenant.
    String appUnzipDir = AppDeployerUtils.getAppUnzipDir() + File.separator +
            AppDeployerUtils.getTenantIdString();
    FileManipulator.deleteDir(appUnzipDir);
}
 
Example 11
Source File: AbstractWsdlProcessor.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
protected void printWSDL(ConfigurationContext configurationContext,
                         String serviceName,
                         CarbonHttpResponse response,
                         WSDLPrinter wsdlPrinter) throws IOException {
    AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
    AxisService axisService = axisConfig.getServiceForActivation(serviceName);

    OutputStream outputStream = response.getOutputStream();
    if (axisService != null) {

        if(!RequestProcessorUtil.canExposeServiceMetadata(axisService)){
            response.setError(HttpStatus.SC_FORBIDDEN,
                              "Access to service metadata for service: " + serviceName +
                              " has been forbidden");
            return;
        }
        if (!axisService.isActive()) {
            response.addHeader(HTTP.CONTENT_TYPE, "text/html");
            outputStream.write(("<h4>Service " +
                                serviceName +
                                " is inactive. Cannot display WSDL document.</h4>").getBytes());
            outputStream.flush();
        } else {
            response.addHeader(HTTP.CONTENT_TYPE, "text/xml");
            wsdlPrinter.printWSDL(axisService);
        }
    } else {
        response.addHeader(HTTP.CONTENT_TYPE, "text/html");
        outputStream.write(("<h4>Service " + serviceName +
                " not found. Cannot display WSDL document.</h4>").getBytes());
        response.setError(HttpStatus.SC_NOT_FOUND);
        outputStream.flush();
    }
}
 
Example 12
Source File: AbstractTransportService.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public void removeTransportParameter(String param,
                                     boolean listener, ConfigurationContext cfgCtx) throws Exception {
    ParameterInclude transport;
    AxisConfiguration axisConfig = cfgCtx.getAxisConfiguration();
    if (listener) {
        transport = axisConfig.getTransportIn(transportName);
    } else {
        transport = axisConfig.getTransportOut(transportName);
    }

    if (transport == null) {
    } else {
        TransportParameter[] params = getGlobalTransportParameters(listener, axisConfig);
        if (params != null) {
            List<TransportParameter> newParams = new ArrayList<TransportParameter>();
            boolean paramFound = false;
            for (TransportParameter p : params) {
                if (p.getName().equals(param)) {
                    paramFound = true;
                    continue;
                }
                newParams.add(p);
            }

            if (paramFound) {
                updateGlobalTransportParameters(newParams.toArray(
                        new TransportParameter[newParams.size()]), listener, cfgCtx);
                return;
            }
        }

        throw new CarbonException("The transport parameter : " + param + " does not exist");
    }
}
 
Example 13
Source File: AbstractTransportService.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public void updateServiceLevelTransportParameters(String service, TransportParameter[] params,
                                                  boolean listener, ConfigurationContext cfgCtx) throws Exception {

    AxisConfiguration axisConfig = cfgCtx.getAxisConfiguration();
    if (axisConfig.getService(service) == null) {
        throw new CarbonException("No service exists by the name : " + service);
    }

    updateGlobalTransportParameters(params, listener, cfgCtx);
}
 
Example 14
Source File: TracerAdmin.java    From carbon-commons with Apache License 2.0 4 votes vote down vote up
public TracerServiceInfo getMessages(int numberOfMessages, String filter) throws AxisFault {

        ConfigurationContext configContext = getConfigContext();
        AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
        CircularBuffer<MessageInfo> msgSeqBuff = getMessageSequenceBuffer();
        List<MessageInfo> messageObjs;
        TracerServiceInfo tracerServiceInfo = new TracerServiceInfo();
        AxisModule axisModule = axisConfiguration.getModule(TracerConstants.WSO2_TRACER);

        if (axisModule == null) {
            throw new AxisFault(TracerConstants.WSO2_TRACER + " module is not available");
        }
        TracePersister tracePersister = getTracePersister();
        tracerServiceInfo.setTracePersister(tracePersister.getClass().getName());
        if (tracePersister.isTracingEnabled()) {
            if (!axisConfiguration.isEngaged(axisModule)) {
                axisConfiguration.engageModule(axisModule);
            }
            tracerServiceInfo.setFlag("ON");
        } else {
            if (axisConfiguration.isEngaged(axisModule)) {
                axisConfiguration.disengageModule(axisModule);
            }
            tracerServiceInfo.setFlag("OFF");
        }
        if (msgSeqBuff == null) {
            tracerServiceInfo.setEmpty(true);
            return tracerServiceInfo;
        } else {
            messageObjs = msgSeqBuff.get(numberOfMessages);

            if (messageObjs.isEmpty()) {
                tracerServiceInfo.setEmpty(true);
                return tracerServiceInfo;

            } else {
                ArrayList<MessageInfo> msgInfoList = new ArrayList<MessageInfo>();
                boolean filterProvided = (filter != null && (filter = filter.trim()).length() != 0);
                tracerServiceInfo.setFilter(filterProvided);

                for (MessageInfo mi : messageObjs) {
                    if (filterProvided) {
                        MessagePayload miPayload = getMessage(mi.getServiceId(),
                                                              mi.getOperationName(),
                                                              mi.getMessageSequence());
                        String req = miPayload.getRequest();
                        if (req == null) {
                            req = "";
                        }
                        String resp = miPayload.getResponse();
                        if (resp == null) {
                            resp = "";
                        }
                        if (req.toUpperCase().contains(filter.toUpperCase())
                            || resp.toUpperCase().contains(filter.toUpperCase())) {
                            msgInfoList.add(mi);
                        }
                    } else {
                        msgInfoList.add(mi);
                    }
                }

                if (filterProvided) {
                    tracerServiceInfo.setFilterString(filter);
                    if (msgInfoList.size() == 0) {
                        tracerServiceInfo.setEmpty(true);
                        return tracerServiceInfo;
                    }
                }

                Collections.reverse(msgInfoList);
                MessageInfo lastMessageInfo = msgInfoList.get(0);
                tracerServiceInfo.setMessageInfo(
                        msgInfoList.toArray(new MessageInfo[msgInfoList.size()]));
                MessagePayload lastMsg = getMessage(lastMessageInfo.getServiceId(),
                                                    lastMessageInfo.getOperationName(),
                                                    lastMessageInfo.getMessageSequence());
                tracerServiceInfo.setLastMessage(lastMsg);
                tracerServiceInfo.setEmpty(false);
            }
        }
        return tracerServiceInfo;
    }
 
Example 15
Source File: AbstractAdmin.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
protected void setConfigurationContext(ConfigurationContext configurationContext) {
    this.configurationContext = configurationContext;
    this.axisConfig = configurationContext.getAxisConfiguration();
}
 
Example 16
Source File: ServiceBusInitializer.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
private ServerContextInformation initESB(String name) throws AxisFault {

        if (configCtxSvc != null) {
            ConfigurationContext configContext = configCtxSvc.getServerConfigContext();
            log.debug("Initializing Apache Synapse...");
            configurationInformation = ServerConfigurationInformationFactory.createServerConfigurationInformation
                    (configContext.getAxisConfiguration());
            // ability to specify the SynapseServerName as a system property
            if (System.getProperty("SynapseServerName") != null) {
                configurationInformation.setServerName(System.getProperty("SynapseServerName"));
            }
            // for now we override the default configuration location with the value in registry
            String synapseConfigsLocation = configurationInformation.getSynapseXMLLocation();
            if (synapseConfigsLocation != null) {
                configurationInformation.setSynapseXMLLocation(synapseConfigsLocation + File.separator + name);
            } else {
                configurationInformation.setSynapseXMLLocation(ServiceBusConstants.DEFAULT_SYNAPSE_CONFIGS_LOCATION +
                        name);
            }
            configurationInformation.setCreateNewInstance(false);
            configurationInformation.setServerControllerProvider(CarbonSynapseController.class.getName());
            if (isRunningSamplesMode()) {
                if (System.getProperty(ServiceBusConstants.ESB_SAMPLE_SYSTEM_PROPERTY) != null) {
                    configurationInformation.setSynapseXMLLocation("repository" + File.separator + "samples" + File
                            .separator + "synapse_sample_" + System.getProperty(ServiceBusConstants
                            .ESB_SAMPLE_SYSTEM_PROPERTY) + ".xml");
                } else {
                    configurationInformation.setSynapseXMLLocation("samples" + File.separator + "service-bus" + File
                            .separator + "synapse_sample_" + System.getProperty(ServiceBusConstants
                            .EI_SAMPLE_SYSTEM_PROPERTY) + ".xml");
                }
            }
            serverManager = new ServerManager();
            ServerContextInformation contextInfo = new ServerContextInformation(configContext,
                    configurationInformation);

            if (secretCallbackHandlerService != null) {
                contextInfo.addProperty(SecurityConstants.PROP_SECRET_CALLBACK_HANDLER, secretCallbackHandlerService
                        .getSecretCallbackHandler());
            }
            AxisConfiguration axisConf = configContext.getAxisConfiguration();
            axisConf.addParameter(new Parameter(ServiceBusConstants.SYNAPSE_CURRENT_CONFIGURATION, name));
            if (isRunningDebugMode()) {
                log.debug("Micro Integrator started in Debug mode for super tenant");
                createSynapseDebugEnvironment(contextInfo);
            }
            boolean initConnectors = !Boolean.valueOf(System.getProperty(ServiceBusConstants
                    .DISABLE_CONNECTOR_INIT_SYSTEM_PROPERTY));
            if (initConnectors) {
                // Enable connectors
                SynapseArtifactInitUtils.initializeConnectors(axisConf);
            }
            serverManager.init(configurationInformation, contextInfo);
            serverManager.start();
            AxisServiceGroup serviceGroup = axisConf.getServiceGroup(SynapseConstants.SYNAPSE_SERVICE_NAME);
            serviceGroup.addParameter("hiddenService", "true");
            return contextInfo;
        } else {
            handleFatal("Couldn't initialize Synapse, " + "ConfigurationContext service or SynapseRegistryService is " +
                    "not available");
        }
        // never executes, but keeps the compiler happy
        return null;
    }
 
Example 17
Source File: UserStoreConfigurationDeployer.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
public void init(ConfigurationContext configurationContext) {
    log.info("User Store Configuration Deployer initiated.");
    this.axisConfig = configurationContext.getAxisConfiguration();
}
 
Example 18
Source File: ServiceHTMLProcessor.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public static String printServiceHTML(String serviceName,
                                      ConfigurationContext configurationContext) {
    StringBuffer temp = new StringBuffer();
    try {
        AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
        AxisService axisService = axisConfig.getService(serviceName);
        if (axisService != null) {
            if (!axisService.isActive()) {
                temp.append("<b>Service ").append(serviceName).
                        append(" is inactive. Cannot display service information.</b>");
            } else {
                temp.append("<h3>").append(axisService.getName()).append("</h3>");
                temp.append("<a href=\"").append(axisService.getName()).append("?wsdl\">wsdl</a> : ");
                temp.append("<a href=\"").append(axisService.getName()).append("?xsd\">schema</a> : ");
                temp.append("<a href=\"").append(axisService.getName()).append("?policy\">policy</a><br/>");
                temp.append("<i>Service Description :  ").
                        append(axisService.getDocumentation()).append("</i><br/><br/>");

                for (Iterator pubOpIter = axisService.getPublishedOperations().iterator();
                     pubOpIter.hasNext();) {
                    temp.append("Published operations <ul>");
                    for (; pubOpIter.hasNext();) {
                        AxisOperation axisOperation = (AxisOperation) pubOpIter.next();
                        temp.append("<li>").
                                append(axisOperation.getName().getLocalPart()).append("</li>");
                    }
                    temp.append("</ul>");
                }
            }
        } else {
            temp.append("<b>Service ").append(serviceName).
                    append(" not found. Cannot display service information.</b>");
        }
        return "<html><head><title>Service Information</title></head>" + "<body>" + temp
               + "</body></html>";
    }
    catch (AxisFault axisFault) {
        return "<html><head><title>Error Occurred</title></head>" + "<body>"
               + "<hr><h2><font color=\"blue\">" + axisFault.getMessage() + "</font></h2></body></html>";
    }
}
 
Example 19
Source File: Axis2Service.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
@Override
    public void start(ModuleManager manager) throws ModuleException {
        try{
            jetty=manager.findModule(this, JettyModule.class);
            
            TopicMapService.wandora=Wandora.getWandora();
            TopicMapService.layerName=layerName;
            TopicMapService.tm=null;

            ConfigurationContext context=ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,null);
            AxisConfiguration axisConfig=context.getAxisConfiguration();
//            axisConfig.addParameter("httpContentNegotiation", "true");

            axisConfig.addMessageFormatter("application/json", new org.apache.axis2.json.JSONMessageFormatter());
            axisConfig.addMessageFormatter("application/json/badgerfish", new org.apache.axis2.json.JSONBadgerfishMessageFormatter());
            axisConfig.addMessageFormatter("text/javascript", new org.apache.axis2.json.JSONMessageFormatter());

            axisConfig.addMessageBuilder("application/json", new org.apache.axis2.json.JSONOMBuilder());
            axisConfig.addMessageBuilder("application/json/badgerfish", new org.apache.axis2.json.JSONBadgerfishOMBuilder());
            axisConfig.addMessageBuilder("text/javascript", new org.apache.axis2.json.JSONOMBuilder());

            AxisService service=AxisService.createService(TopicMapService.class.getName(), axisConfig);
            axisConfig.addService(service);

            AxisServlet axisServlet=new AxisServlet(){
                @Override
                protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
                    super.doGet(request, response);
                    response.getOutputStream().flush();
                }
            };
            
            String appName="axis";
            String relativeHome=manager.getVariable("relativeHome");
            if(relativeHome!=null){
                appName=relativeHome;
                if(appName.endsWith(File.separator)) appName=appName.substring(0,appName.length()-1);
            }

            ServletHolder holder=new ServletHolder(axisServlet);
            
            
//            jettyContext=new Context(jetty.getJetty(),"/"+appName,Context.SESSIONS);
//            jettyContext.getServletContext().setAttribute(AxisServlet.CONFIGURATION_CONTEXT, context);
//            jettyContext.addServlet(holder,"/*");


        }
        catch(Exception e){
            e.printStackTrace();
        }
        
        
        super.start(manager);
    }
 
Example 20
Source File: Axis2Handler.java    From wandora with GNU General Public License v3.0 4 votes vote down vote up
public void start(WandoraWebApp app, WandoraWebAppServer server){
        try{
            TopicMapService.wandora=server.getWandora();
            TopicMapService.layerName=layer;
            TopicMapService.tm=null;
            webApp=app;

            ConfigurationContext context=ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,null);
            AxisConfiguration axisConfig=context.getAxisConfiguration();
//            axisConfig.addParameter("httpContentNegotiation", "true");

            axisConfig.addMessageFormatter("application/json", new org.apache.axis2.json.JSONMessageFormatter());
            axisConfig.addMessageFormatter("application/json/badgerfish", new org.apache.axis2.json.JSONBadgerfishMessageFormatter());
            axisConfig.addMessageFormatter("text/javascript", new org.apache.axis2.json.JSONMessageFormatter());

            axisConfig.addMessageBuilder("application/json", new org.apache.axis2.json.JSONOMBuilder());
            axisConfig.addMessageBuilder("application/json/badgerfish", new org.apache.axis2.json.JSONBadgerfishOMBuilder());
            axisConfig.addMessageBuilder("text/javascript", new org.apache.axis2.json.JSONOMBuilder());

            AxisService service=AxisService.createService(TopicMapService.class.getName(), axisConfig);
            axisConfig.addService(service);

            AxisServlet axisServlet=new AxisServlet(){
                @Override
                protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
                    super.doGet(request, response);
                    response.getOutputStream().flush();
                }
            };

//            ServletHolder holder=new ServletHolder(axisServlet);
//            jettyContext=new Context(server.getJetty(),"/"+app.getName(),Context.SESSIONS);
//            jettyContext.getServletContext().setAttribute(AxisServlet.CONFIGURATION_CONTEXT, context);
//            jettyContext.addServlet(holder,"/*");

//            SimpleHTTPServer simple=new SimpleHTTPServer(context,8900);
//            simple.start();


        }catch(Exception e){
            e.printStackTrace();
        }
    }