Package org.apache.openejb.server.httpd

Examples of org.apache.openejb.server.httpd.HttpListener


            throw new OpenEJBRestRuntimeException("uri syntax is not correct", e);
        }
    }

    private void undeployRestObject(String context) {
        HttpListener listener = rsRegistry.removeListener(context);
        if (listener != null) {
            RsHttpListener.class.cast(listener).undeploy();
        }
    }
View Full Code Here


    }

    @Override public HttpListener removeListener(String context) {
        String regex = addresses.get(context);
        if (regex != null) {
            HttpListener listener = registry.removeHttpListener(regex);
            if (listener instanceof ClassLoaderHttpListener)
            return ((ClassLoaderHttpListener) listener).getDelegate();
        }
        return null;
    }
View Full Code Here

    public String getServletInfo() {
        return "Webservice Servlet " + getService();
    }

    public void service(final ServletRequest req, final ServletResponse res) throws ServletException, IOException {
        final HttpListener service = getService();
        if (service == null) throw new ServletException("WebServiceContainer has not been set");

        final ServletEndpointContext context = getContext();
        endpointContext.set(new InvocationContext((HttpServletRequest) req));
        try {
            res.setContentType("text/xml");
            final HttpRequest httpRequest = new ServletRequestAdapter((HttpServletRequest) req, (HttpServletResponse) res, config.getServletContext());
            final HttpResponse httpResponse = new ServletResponseAdapter((HttpServletResponse) res);

            if (pojo != null) {
                req.setAttribute(WsConstants.POJO_INSTANCE, pojo);
            }

            try {
                service.onMessage(httpRequest, httpResponse);
            } catch (final IOException e) {
                throw e;
            } catch (final ServletException e) {
                throw e;
            } catch (final Exception e) {
View Full Code Here

        }
        return managedUrl + "/" + wildcard;
    }

    private void undeployRestObject(final String context) {
        HttpListener listener = rsRegistry.removeListener(context);
        if (listener != null) {

            if (BasicAuthHttpListenerWrapper.class.isInstance(listener)) {
                listener = BasicAuthHttpListenerWrapper.class.cast(listener).getHttpListener();
            }
View Full Code Here

    @Override
    public HttpListener removeListener(final String context) {
        final String regex = addresses.get(context);
        if (regex != null) {
            final HttpListener listener = registry.removeHttpListener(regex);
            if (listener instanceof ClassLoaderHttpListener) {
                return ((ClassLoaderHttpListener) listener).getDelegate();
            }
        }
        return null;
View Full Code Here

                    final ClassLoader old = Thread.currentThread().getContextClassLoader();
                    Thread.currentThread().setContextClassLoader(beanContext.getClassLoader());
                    try {
                        final PortData port = WsBuilder.toPortData(portInfo, beanContext.getInjections(), moduleBaseUrl, beanContext.getClassLoader());

                        final HttpListener container = createEjbWsContainer(moduleBaseUrl, port, beanContext, new ServiceConfiguration(beanContext.getProperties(), appInfo.services));

                        // generate a location if one was not assigned
                        String location = port.getLocation();
                        if (location == null) {
                            location = autoAssignWsLocation(bean, port, contextData, deploymentIdTemplate);
View Full Code Here

                final PortData port = WsBuilder.toPortData(portInfo, injections, moduleBaseUrl, classLoader);

                pojoConfiguration = PojoUtil.findPojoConfig(pojoConfiguration, appInfo, webApp);

                final HttpListener container = createPojoWsContainer(classLoader, moduleBaseUrl, port, portInfo.serviceLink,
                    target, context, webApp.contextRoot, bindings,
                    new ServiceConfiguration(PojoUtil.findConfiguration(pojoConfiguration, target.getName()), appInfo.services));

                if (wsRegistry != null) {
                    String auth = authMethod;
View Full Code Here

                                       final String transportGuarantee, // ignored
                                       final String authMethod) throws Exception {

        if (path == null) throw new NullPointerException("contextRoot is null");

        HttpListener httpListener = inputListener;
        if (httpListener == null) throw new NullPointerException("httpListener is null");

        if ("BASIC".equals(authMethod)) {
            httpListener = new BasicAuthHttpListenerWrapper(httpListener, realmName);
        }
View Full Code Here

                        if (portInfo == null) continue;

                        try {
                            PortData port = WsBuilder.toPortData(portInfo, deploymentInfo.getInjections(), moduleBaseUrl, deploymentInfo.getClassLoader());

                            HttpListener container = createEjbWsContainer(moduleBaseUrl, port, deploymentInfo);

                            // generate a location if one was not assigned
                            String location = port.getLocation();
                            if (location == null) {
                                location = autoAssignWsLocation(bean, port, contextData, deploymentIdTemplate);
                            }
                            if (!location.startsWith("/")) location = "/" + location;
                            ejbLocations.put(statelessBeanInfo.ejbDeploymentId, location);

                            ClassLoader classLoader = deploymentInfo.getClassLoader();
                            if (wsRegistry != null) {
                                // add servlet to web container
                                List<String> addresses = wsRegistry.addWsContainer(location, container, virtualHost, realmName, transportGuarantee, authMethod, classLoader);

                                // one of the registered addresses to be the connonical address
                                String address = selectSingleAddress(addresses);

                                // register wsdl location
                                portAddressRegistry.addPort(portInfo.serviceId, portInfo.wsdlService, portInfo.portId, portInfo.wsdlPort, portInfo.seiInterfaceName, address);
                                logger.info("Webservice(wsdl=" + address + ", qname=" + port.getWsdlService() + ") --> Ejb(id=" + portInfo.portId + ")");
                                ejbAddresses.put(bean.ejbDeploymentId, address);
                            }
                        } catch (Throwable e) {
                            logger.error("Error deploying CXF webservice for ejb " + deploymentInfo.getDeploymentID(), e);
                        }
                    }
                }
            }
            for (WebAppInfo webApp : appInfo.webApps) {
                WebDeploymentInfo deploymentInfo = containerSystem.getWebDeploymentInfo(webApp.moduleId);
                if (deploymentInfo == null) continue;

                Map<String,PortInfo> ports = new TreeMap<String,PortInfo>();
                for (PortInfo port : webApp.portInfos) {
                    ports.put(port.serviceLink, port);
                }

                URL moduleBaseUrl = null;
                try {
                    moduleBaseUrl = new File(webApp.codebase).toURL();
                } catch (MalformedURLException e) {
                    logger.error("Invalid ejb jar location " + webApp.codebase, e);
                }

                for (ServletInfo servlet : webApp.servlets) {
                    PortInfo portInfo = ports.get(servlet.servletName);
                    if (portInfo == null) continue;

                    try {
                        ClassLoader classLoader = deploymentInfo.getClassLoader();
                        Collection<Injection> injections = deploymentInfo.getInjections();
                        Context context = deploymentInfo.getJndiEnc();
                        Class target = classLoader.loadClass(servlet.servletClass);

                        PortData port = WsBuilder.toPortData(portInfo, injections, moduleBaseUrl, classLoader);

                        HttpListener container = createPojoWsContainer(moduleBaseUrl, port, portInfo.serviceLink, target, context, webApp.contextRoot);

                        if (wsRegistry != null) {
                            // give servlet a reference to the webservice container
                            List<String> addresses = wsRegistry.setWsContainer(virtualHost, webApp.contextRoot, servlet.servletName, container);
View Full Code Here

                        if (portInfo == null) continue;

                        try {
                            PortData port = WsBuilder.toPortData(portInfo, deploymentInfo.getInjections(), moduleBaseUrl, deploymentInfo.getClassLoader());

                            HttpListener container = createEjbWsContainer(moduleBaseUrl, port, deploymentInfo);

                            // generate a location if one was not assigned
                            String location = port.getLocation();
                            if (location == null) {
                                location = autoAssignWsLocation(bean, port, contextData, deploymentIdTemplate);
View Full Code Here

TOP

Related Classes of org.apache.openejb.server.httpd.HttpListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.