Package org.eclipse.equinox.http.helper

Examples of org.eclipse.equinox.http.helper.ContextPathServletAdaptor


            HttpContext commonContext =
                    new BundleEntryHttpContext(context.getBundle(), "/web");
            httpService.registerResources("/jsp-examples", "/",
                                          commonContext);

            Servlet adaptedJspServlet = new ContextPathServletAdaptor(
                    new JspServlet(context.getBundle(), "/web"),
                    "/jsp-examples");
            httpService.registerServlet("/jsp-examples/*.jsp", adaptedJspServlet, null,
                                        commonContext);
        } catch (Exception e) {
View Full Code Here


            try {
                HttpContext commonContext =
                        new DefaultComponentEntryHttpContext(bundleContext.getBundle(), INTERNAL_CONTEXT);

                //register our .jsp files at the httpService
                Servlet servlet = new ContextPathServletAdaptor(
                        new JspServlet(bundleContext.getBundle(), "/web"), CONTEXT);
                httpService.registerResources(CONTEXT, "/", commonContext);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
View Full Code Here

      final HttpService httpService = (HttpService) context.getService(reference);
      try {     
        HttpContext commonContext = new BundleEntryHttpContext(context.getBundle(), "/web");
        httpService.registerResources("/struts-examples", "/", commonContext); //$NON-NLS-1$ //$NON-NLS-2$
       
        Servlet adaptedJspServlet = new ContextPathServletAdaptor(new JspServlet(context.getBundle(), "/web"), "/struts-examples"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        httpService.registerServlet("/struts-examples/*.jsp", adaptedJspServlet, null, commonContext); //$NON-NLS-1$
       
        Dictionary initparams = new Hashtable();
        initparams.put("servlet-name", "action"); //Note: requires servlet-name support in Http Service Implementation
        initparams.put("config", "/WEB-INF/struts-config.xml");
        initparams.put("config/exercise", "/WEB-INF/exercise/struts-config.xml");
        initparams.put("config/upload", "/WEB-INF/upload/struts-config.xml");
        initparams.put("config/validator", "/WEB-INF/validator/struts-config.xml");
        initparams.put("config/dispatch", "/WEB-INF/dispatch/struts-config.xml");
        initparams.put("debug", "2");
        initparams.put("detail", "2");
        Servlet adaptedActionServlet = new ContextPathServletAdaptor(new ActionServlet(), "/struts-examples");
        httpService.registerServlet("/struts-examples/*.do", adaptedActionServlet, initparams, commonContext);
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
View Full Code Here

        HttpContext commonContext =
                new CarbonSecuredHttpContext(context.getBundle(), "/web", uiResourceRegistry, registry);

        //Registering filedownload servlet
        Servlet fileDownloadServlet = new ContextPathServletAdaptor(new FileDownloadServlet(
                context, getConfigurationContextService()), "/filedownload");
        httpService.registerServlet("/filedownload", fileDownloadServlet, null, commonContext);
        fileDownloadServlet.getServletConfig().getServletContext().setAttribute(
                CarbonConstants.SERVER_URL, serverURL);
        fileDownloadServlet.getServletConfig().getServletContext().setAttribute(
                CarbonConstants.INDEX_PAGE_URL, indexPageURL);

        //Registering fileupload servlet
        Servlet fileUploadServlet = new ContextPathServletAdaptor(new FileUploadServlet(
                context, configContext, webContext), "/fileupload");
        httpService.registerServlet("/fileupload", fileUploadServlet, null, commonContext);
        fileUploadServlet.getServletConfig().getServletContext().setAttribute(
                CarbonConstants.SERVER_URL, serverURL);
        fileUploadServlet.getServletConfig().getServletContext().setAttribute(
                CarbonConstants.INDEX_PAGE_URL, indexPageURL);

        uiBundleDeployer.deploy(bundleContext, commonContext);
        context.addBundleListener(uiBundleDeployer);

        httpService.registerServlet("/", new org.apache.tiles.web.startup.TilesServlet(),
                                    initparams,
                                    commonContext);
        httpService.registerResources("/" + webContext, "/", commonContext);

        adaptedJspServlet = new ContextPathServletAdaptor(
                new TilesJspServlet(context.getBundle(), uiResourceRegistry), "/" + webContext);
        httpService.registerServlet("/" + webContext + "/*.jsp", adaptedJspServlet, null,
                                    commonContext);

        ServletContext jspServletContext =
View Full Code Here

                HttpContext commonContext =
                        new BundleEntryHttpContext(context.getBundle(), "/web"); //$NON-NLS-1$
                httpService.registerResources("/jstl-examples", "/",
                                              commonContext); //$NON-NLS-1$ //$NON-NLS-2$

                Servlet adaptedJspServlet = new ContextPathServletAdaptor(
                        new JspServlet(context.getBundle(), "/web"),
                        "/jstl-examples")//$NON-NLS-1$//$NON-NLS-2$
                httpService.registerServlet("/jstl-examples/*.jsp", adaptedJspServlet, null,
                                            commonContext); //$NON-NLS-1$
            } catch (Exception e) {
View Full Code Here

        } catch (Exception e) {
            throw new CarbonException("An instance of HttpService is not available");
        }
        try {
            if (event == ServiceEvent.REGISTERED) {
                Servlet adaptedJspServlet = new ContextPathServletAdaptor(servlet, urlPattern);
                if (associatedFilter == null) {
                    httpService.registerServlet(urlPattern, adaptedJspServlet, params, httpContext);
                } else {
                    httpService.registerServlet(urlPattern,
                            new FilterServletAdaptor(associatedFilter, null, adaptedJspServlet), params, httpContext);
                }
                if (servletAttrs != null) {
                    for (Enumeration enm = servletAttrs.keys(); enm.hasMoreElements();) {
                        String key = (String) enm.nextElement();
                        adaptedJspServlet.getServletConfig().getServletContext().setAttribute(key, servletAttrs.get(key));
                    }
                }
            } else if (event == ServiceEvent.UNREGISTERING) {
                httpService.unregister(urlPattern);
            }
View Full Code Here

        HttpContext commonContext =
                new CarbonSecuredHttpContext(context.getBundle(), "/web", uiResourceRegistry, registry);

        //Registering filedownload servlet
        Servlet fileDownloadServlet = new ContextPathServletAdaptor(new FileDownloadServlet(
                context, getConfigurationContextService()), "/filedownload");
        httpService.registerServlet("/filedownload", fileDownloadServlet, null, commonContext);
        fileDownloadServlet.getServletConfig().getServletContext().setAttribute(
                CarbonConstants.SERVER_URL, serverURL);
        fileDownloadServlet.getServletConfig().getServletContext().setAttribute(
                CarbonConstants.INDEX_PAGE_URL, indexPageURL);

        //Registering fileupload servlet
        Servlet fileUploadServlet;
        if (isLocalTransportMode) {
            fileUploadServlet = new ContextPathServletAdaptor(new FileUploadServlet(
                    context, serverConfigContext, webContext), "/fileupload");
        } else {
            fileUploadServlet = new ContextPathServletAdaptor(new FileUploadServlet(
                    context, clientConfigContext, webContext), "/fileupload");
        }

        httpService.registerServlet("/fileupload", fileUploadServlet, null, commonContext);
        fileUploadServlet.getServletConfig().getServletContext().setAttribute(
                CarbonConstants.SERVER_URL, serverURL);
        fileUploadServlet.getServletConfig().getServletContext().setAttribute(
                CarbonConstants.INDEX_PAGE_URL, indexPageURL);

        uiBundleDeployer.deploy(bundleContext, commonContext);
        context.addBundleListener(uiBundleDeployer);

        httpService.registerServlet("/", new org.apache.tiles.web.startup.TilesServlet(),
                                    initparams,
                                    commonContext);
        httpService.registerResources("/" + webContext, "/", commonContext);

        adaptedJspServlet = new ContextPathServletAdaptor(
                new TilesJspServlet(context.getBundle(), uiResourceRegistry), "/" + webContext);
        httpService.registerServlet("/" + webContext + "/*.jsp", adaptedJspServlet, null,
                                    commonContext);

        ServletContext jspServletContext =
View Full Code Here

        } catch (Exception e) {
            throw new CarbonException("An instance of HttpService is not available");
        }
        try {
            if (event == ServiceEvent.REGISTERED) {
                Servlet adaptedJspServlet = new ContextPathServletAdaptor(servlet, urlPattern);
                if (associatedFilter == null) {
                    httpService.registerServlet(urlPattern, adaptedJspServlet, params, httpContext);
                } else {
                    httpService.registerServlet(urlPattern,
                            new FilterServletAdaptor(associatedFilter, null, adaptedJspServlet), params, httpContext);
                }
                if (servletAttrs != null) {
                    for (Enumeration enm = servletAttrs.keys(); enm.hasMoreElements();) {
                        String key = (String) enm.nextElement();
                        adaptedJspServlet.getServletConfig().getServletContext().setAttribute(key, servletAttrs.get(key));
                    }
                }
            } else if (event == ServiceEvent.UNREGISTERING) {
                httpService.unregister(urlPattern);
            }
View Full Code Here

            try {
                HttpContext commonContext =
                        new DefaultComponentEntryHttpContext(bundleContext.getBundle(), INTERNAL_CONTEXT);

                //register our .jsp files at the httpService
                Servlet servlet = new ContextPathServletAdaptor(
                        new JspServlet(bundleContext.getBundle(), "/web"), CONTEXT);
                httpService.registerResources(CONTEXT, "/", commonContext);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.eclipse.equinox.http.helper.ContextPathServletAdaptor

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.