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

The following examples show how to use org.apache.axis2.context.ConfigurationContext#getServiceContextPath() . 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: Wsdl11Processor.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public void process(final CarbonHttpRequest request,
                    final CarbonHttpResponse response,
                    final ConfigurationContext configurationContext) throws Exception {

    WSDLPrinter wsdlPrinter = new WSDLPrinter() {
        public void printWSDL(AxisService axisService) throws IOException {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            String importedWSDL = getImportedWSDL(request, "wsdl");
            if ("".equals(importedWSDL)) {
                axisService.printWSDL(baos, NetworkUtils.getLocalHostname());
            } else {
                axisService.printUserWSDL(baos, importedWSDL);
            }
            RequestProcessorUtil.writeDocument(baos,
                                               response.getOutputStream(),
                                               "annotated-wsdl.xsl",
                                               configurationContext.getContextRoot(),
                                               checkForAnnotation(request));
        }
    };
    String requestURI = request.getRequestURI();
    String contextPath = configurationContext.getServiceContextPath();
    String serviceName = requestURI.substring(requestURI.indexOf(contextPath) + contextPath.length() + 1);
    printWSDL(configurationContext, serviceName, response, wsdlPrinter);
}
 
Example 2
Source File: Wsdl20Processor.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public void process(final CarbonHttpRequest request,
                    final CarbonHttpResponse response,
                    final ConfigurationContext configurationContext) throws Exception {
    WSDLPrinter wsdlPrinter = new WSDLPrinter() {
        public void printWSDL(AxisService axisService) throws IOException {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            axisService.printWSDL2(baos);
            RequestProcessorUtil.writeDocument(baos,
                                               response.getOutputStream(),
                                               "annotated-wsdl2.xsl",
                                               configurationContext.getContextRoot(),
                                               checkForAnnotation(request));
        }
    };
    String requestURI = request.getRequestURI();
    String contextPath = configurationContext.getServiceContextPath();
    String serviceName = requestURI.substring(requestURI.indexOf(contextPath) + contextPath.length() + 1);
    printWSDL(configurationContext, serviceName, response, wsdlPrinter);
}
 
Example 3
Source File: InfoProcessor.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public void process(CarbonHttpRequest request,
                    CarbonHttpResponse response,
                    ConfigurationContext configurationContext) throws Exception {
    String requestURI = request.getRequestURI();
    String contextPath = configurationContext.getServiceContextPath();
    String serviceName =
            requestURI.substring(requestURI.indexOf(contextPath) + contextPath.length() + 1);
    AxisService axisService =
            configurationContext.getAxisConfiguration().getServiceForActivation(serviceName);
    if (!RequestProcessorUtil.canExposeServiceMetadata(axisService)) {
        response.setError(HttpStatus.SC_FORBIDDEN,
                          "Access to service metadata for service: " + serviceName +
                          " has been forbidden");
        return;
    }
    String serviceHtml = ServiceHTMLProcessor.printServiceHTML(
            serviceName, configurationContext);
    if (serviceHtml != null) {
        response.setStatus(HttpStatus.SC_OK);
        response.addHeader(HTTP.CONTENT_TYPE, "text/html");
        response.getOutputStream().write(serviceHtml.getBytes());
    }
}
 
Example 4
Source File: RequestProcessorUtil.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public static String getServiceContextPath(ConfigurationContext configCtx) {
    String serviceContextPath = configCtx.getServiceContextPath();
    if (!configCtx.getContextRoot().equals("/")
        && !serviceContextPath.startsWith("/")) {
        serviceContextPath = "/" + serviceContextPath;
    }
    return serviceContextPath;
}
 
Example 5
Source File: XsdProcessor.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public void process(CarbonHttpRequest request,
                    CarbonHttpResponse response,
                    ConfigurationContext configCtx) throws Exception {
    String requestURI = request.getRequestURI();
    String contextPath = configCtx.getServiceContextPath();
    String serviceName = requestURI.substring(requestURI.indexOf(contextPath) + contextPath.length() + 1);
    AxisService axisService =
            configCtx.getAxisConfiguration().getServiceForActivation(serviceName);
    XsdUtil.printXsd(request, response, configCtx, serviceName, axisService);

}