Package org.emrys.webosgi.core.jeeres

Examples of org.emrys.webosgi.core.jeeres.ServletDelegate


  private void initOnStartServlet() throws ServletException {
    List<ServletDelegate> servlets = new ArrayList<ServletDelegate>();
    servlets.addAll(servletContext.getServletsInfo());
    Collections.sort(servlets, new Comparator() {
      public int compare(Object o1, Object o2) {
        ServletDelegate info1 = (ServletDelegate) o1;
        ServletDelegate info2 = (ServletDelegate) o2;
        if (info1.loadOnSetupPriority < info2.loadOnSetupPriority)
          return -1;
        else if (info1.loadOnSetupPriority > info2.loadOnSetupPriority)
          return 1;
        else
View Full Code Here


            urlParttern = urlParttern
                + FilterDelegate.MULTI_MAP_SEG_SEPERATOR + s;
        }
      }

      ServletDelegate info = new ServletDelegate();
      info.name = servletName;
      info.className = clazzName;
      info.jspFile = jspFilePath;
      info.setRawURLPatterns(urlParttern);
      info.parameters = params;
      info.loadOnSetupPriority = loadOnSetupPriority;
      info.setBundleContext(servletContext);
      servletContext.getServletsInfo().add(info);
    }
  }
View Full Code Here

    // We wrap the servlet to monitor the Jasper Runtime change event by
    // other plugin.
    servlet = new ServletWrapper(servlet);

    ServletDelegate servletDelegate = new ServletDelegate();
    servletDelegate.className = servlet.getClass().getName();
    servletDelegate.loadOnSetupPriority = 1;
    servletDelegate.name = alias;

    Hashtable<String, String> params = new Hashtable<String, String>();
    if (initparams != null && !initparams.isEmpty()) {
      Enumeration keys = initparams.keys();
      while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        if (key instanceof String
            && initparams.get(key) instanceof String)
          params.put((String) key, (String) initparams.get(key));
      }
    }

    servletDelegate.parameters = params;
    servletDelegate.setBundleContext(servletContext);
    servletDelegate.servlet = servlet;
    String nsPrefix = HelpSupportActivator.getInstance()
        .getServiceNSPrefix();
    if (alias.indexOf('*') == -1 && alias.indexOf('.') == -1)
      alias = "/" + nsPrefix + alias
          + ServletDelegate.MULTI_MAP_SEG_SEPERATOR + "/" + nsPrefix
          + alias + "/*";
    else {
      // case /*.jsp map from org.eclipse.help.webapp extension point.
      alias = "/" + nsPrefix + alias;
    }

    servletDelegate.setRawURLPatterns(alias);
    servletContext.addHttpContext(context);
    servletContext.getServletsInfo().add(servletDelegate);
  }
View Full Code Here

  public void unregister(String alias) {
    Iterator<ServletDelegate> it = servletContext.getServletsInfo()
        .iterator();
    while (it.hasNext()) {
      ServletDelegate delegate = it.next();
      if (delegate.getRawURLPatterns().equals(alias))
        it.remove();
    }

    // need to refresh OSGiJEEContainer
  }
View Full Code Here

      } catch (Exception e) {
        throw new ServletException(e);
      }

      if (servletDelegateCopy != null) {
        ServletDelegate servletDelegate = servletDelegateCopy
            .getOriginalObj();
        Object oldBundle = topRequest.getBundle();
        // Only need to set once, because the filter of same bundle
        // with the servlet can be called.
        getFwkContainerHelper().switchReqBundleContext(
            servletDelegate.getBundleContext().getBundle());
        try {
          doServletMapFilter(servletDelegate, request, response,
              filters);
        } finally {
          // Revert bundle of Top Req
View Full Code Here

  private void initOnStartServlet() throws ServletException {
    List<ServletDelegate> servlets = new ArrayList<ServletDelegate>();
    servlets.addAll(servletContext.getServletsInfo());
    Collections.sort(servlets, new Comparator() {
      public int compare(Object o1, Object o2) {
        ServletDelegate info1 = (ServletDelegate) o1;
        ServletDelegate info2 = (ServletDelegate) o2;
        if (info1.loadOnSetupPriority < info2.loadOnSetupPriority)
          return -1;
        else if (info1.loadOnSetupPriority > info2.loadOnSetupPriority)
          return 1;
        else
View Full Code Here

            urlParttern = urlParttern
                + FilterDelegate.MULTI_MAP_SEG_SEPERATOR + s;
        }
      }

      ServletDelegate info = new ServletDelegate();
      info.name = servletName;
      info.className = clazzName;
      info.jspFile = jspFilePath;
      info.setRawURLPatterns(urlParttern);
      info.parameters = params;
      info.loadOnSetupPriority = loadOnSetupPriority;
      info.setBundleContext(this.getBundleServletContext());
      getBundleServletContext().getServletsInfo().add(info);
    }
  }
View Full Code Here

  }

  @Override
  protected void startWebService(BundleContext context)
      throws ServiceInitException {
    ServletDelegate delegate = new ServletDelegate();
    delegate.servlet = new DocResServlet();
    delegate.setRawURLPatterns("/" + this.getServiceNSPrefix() + "/*");
    delegate.parameters = new Hashtable<String, String>();
    delegate.setBundleContext(getBundleServletContext());
    this.getBundleServletContext().getServletsInfo().add(delegate);

    // Register the Update Site Listener to synchronize the Feature's
    // Documents when Update site
    // updated.
View Full Code Here

TOP

Related Classes of org.emrys.webosgi.core.jeeres.ServletDelegate

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.