Package org.osgi.service.http

Examples of org.osgi.service.http.HttpContext


    ArrayList<String> aliases = new ArrayList<String>();
   
    String[] resources = findResources(bundle);
   
    if ( resources != null ) {
      HttpContext ctx = new ProxyHttpContext(bundle);
     
      for ( String p : resources ) {
        String[] split = p.split("\\s*=\\s*");
        String alias = split[0];
        String file = split.length == 1 ? split[0] : split[1];
View Full Code Here


        if (httpServiceRef != null && !registerService) {
            LOG.info("Register the servlet service");
            final HttpService httpService = (HttpService)bundleContext.getService(httpServiceRef);
            if (httpService != null) {
                // create a default context to share between registrations
                final HttpContext httpContext = httpService.createDefaultHttpContext();
                // register the hello world servlet
                final Dictionary<String, String> initParams = new Hashtable<String, String>();
                initParams.put("servlet-name", "TestServlet");
                httpService.registerServlet("/test/services", // alias
                        new MyServlet(), // register servlet
View Full Code Here

        if (httpServiceRef != null && !registerService) {
            LOG.info("Regist the servlet service");
            final HttpService httpService = (HttpService)bundleContext.getService(httpServiceRef);
            if (httpService != null) {
                // create a default context to share between registrations
                final HttpContext httpContext = httpService.createDefaultHttpContext();
                // register the hello world servlet
                final Dictionary initParams = new Hashtable();
                initParams.put("matchOnUriPrefix", "false");
                initParams.put("servlet-name", "camelServlet");
                httpService.registerServlet("/camel/services", // alias
View Full Code Here

        httpServiceRef = bc.getServiceReference(HttpService.class.getName());
        if (httpServiceRef != null) {
            final HttpService httpService = (HttpService)bc.getService(httpServiceRef);
            if (httpService != null) {
                // create a default context to share between registrations
                final HttpContext httpContext = httpService.createDefaultHttpContext();
                // register the hello world servlet
                final Dictionary initParams = new Hashtable();
                initParams.put("matchOnUriPrefix", "false");
                initParams.put("servlet-name", "camelServlet");
                httpService.registerServlet("/camel/services", // alias
View Full Code Here

        if (httpServiceRef != null && !registerService) {
            LOG.info("Register the servlet service");
            final HttpService httpService = (HttpService)bundleContext.getService(httpServiceRef);
            if (httpService != null) {
                // create a default context to share between registrations
                final HttpContext httpContext = httpService.createDefaultHttpContext();
                // register the hello world servlet
                final Dictionary<String, String> initParams = new Hashtable<String, String>();
                initParams.put("matchOnUriPrefix", "false");
                initParams.put("servlet-name", "CamelServlet");
                httpService.registerServlet("/camel/services", // alias
View Full Code Here

    public void setHttpContext(HttpContext httpContext) {
        this.httpContext = httpContext;
    }
    public void register() throws Exception {
        HttpContext actualHttpContext = (httpContext == null)
            ? httpService.createDefaultHttpContext()
            : httpContext;
        final Dictionary<String, String> initParams = new Hashtable<String, String>();
        // The servlet will always have to match on uri prefix as some endpoints may do so
        initParams.put("matchOnUriPrefix", "true");
View Full Code Here

    public void register() throws Exception {
        ObjectHelper.notEmpty(alias, "alias", this);
        ObjectHelper.notEmpty(servletName, "servletName", this);

        HttpContext actualHttpContext = (httpContext == null)
            ? httpService.createDefaultHttpContext()
            : httpContext;
        final Dictionary<String, String> initParams = new Hashtable<String, String>();
        initParams.put("matchOnUriPrefix", matchOnUriPrefix ? "true" : "false");
        initParams.put("servlet-name", servletName);
View Full Code Here

        if (httpServiceRef != null && !registerService) {
            LOG.info("Register the servlet service");
            final HttpService httpService = (HttpService)bundleContext.getService(httpServiceRef);
            if (httpService != null) {
                // create a default context to share between registrations
                final HttpContext httpContext = httpService.createDefaultHttpContext();
                // register the hello world servlet
                final Dictionary<String, String> initParams = new Hashtable<String, String>();
                initParams.put("matchOnUriPrefix", "false");
                initParams.put("servlet-name", "CamelServlet");
                httpService.registerServlet("/camel/services", // alias
View Full Code Here

    // Injected by Felix DM...
    private volatile HttpService m_http;
    private volatile BundleContext m_bundleContext;

    public void start() throws Exception {
        final HttpContext context = m_http.createDefaultHttpContext();

        m_http.registerResources(RESOURCE_PATH, RESOURCE_PATH, new HttpContext() {
            public String getMimeType(String name) {
                return context.getMimeType(name);
            }

            /**
             * ACE uses a slightly modified version of the 'reindeer' theme. To avoid having to copy all resources in
             * the Vaadin jar, we only override the files we changed and do replace the theme name 'ace' with 'reindeer'
             * before we go looking for the original files.
             *
             * When updating to a new Vaadin version, usually you need to copy the styles.css file from the original
             * archive again and append the ACE changes to the end, as this file tends to change considerably between
             * versions.
             */
            public URL getResource(String name) {
                URL resource = null;
                // fix for ACE-156
                if (!name.startsWith("/")) {
                    name = "/".concat(name);
                }

                String prefix = RESOURCE_PATH.concat("/");
                if (name.startsWith(prefix)) {
                    String originalName = name.replace("/ace/", "/reindeer/");
                    resource = m_bundleContext.getBundle().getEntry(originalName);
                    if (resource == null) {
                        // try to find the resource in the Vaadin bundle instead
                        resource = com.vaadin.Application.class.getResource(originalName);
                    }
                }
                return resource;
            }

            public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
                return context.handleSecurity(request, response);
            }
        });
    }
View Full Code Here

        uiResourceRegistry.initialize(bundleContext);
        uiResourceRegistry.setDefaultUIResourceProvider(
                uiBundleDeployer.getBundleBasedUIResourcePrvider());
//        BundleResourcePathRegistry resourcePathRegistry = uiBundleDeployer.getBundleResourcePathRegistry();

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

        //Registering filedownload servlet
        Servlet fileDownloadServlet = new ContextPathServletAdaptor(new FileDownloadServlet(
                context, getConfigurationContextService()), "/filedownload");
View Full Code Here

TOP

Related Classes of org.osgi.service.http.HttpContext

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.