Package org.cipango.servlet

Examples of org.cipango.servlet.SipServletHandler


 
  public void deconfigure(WebAppContext context) throws Exception
  {
    // TODO preserve any configuration that pre-existed.

        SipServletHandler servletHandler = ((SipAppContext) context).getSipServletHandler();
      
        servletHandler.setSipServlets(null);
        servletHandler.setSipServletMappings(null);

        context.setEventListeners(null);

        // TODO remove classpaths from classloader
  }
View Full Code Here


    SipMetaData metaData = context.getSipMetaData();
    metaData.setSipXml(getResource("/org/cipango/xml/sip-sample-1.0.xml"));
    metaData.addDescriptorProcessor(new StandardDescriptorProcessor());
    metaData.resolve(context);

    SipServletHandler servletHandler = (SipServletHandler) context.getServletHandler();
   
    assertEquals(SipAppContext.VERSION_10, context.getSpecVersion());
    assertEquals("SIP Servlet based Registrar", context.getDisplayName());
   
    Enumeration<String> e = context.getInitParameterNames();
    String name = (String) e.nextElement();
    assertEquals("contextConfigLocation", name);
    assertEquals("/WEB-INF/kaleo.xml", context.getInitParameter(name));
    assertFalse(e.hasMoreElements())
   
    assertEquals(TestListener.class, context.getTimerListeners()[0].getClass());
 
    // servlets
    SipServletHolder[] holders = servletHandler.getSipServlets();
    assertEquals(2, holders.length);
   
    assertEquals("main", holders[0].getName());
    // TODO assertEquals("PBX Servlet", holders[0].getDisplayName());
    assertEquals("org.cipango.kaleo.PbxServlet", holders[0].getClassName());
    e = holders[0].getInitParameterNames();
    name = (String) e.nextElement();
    assertEquals("value", holders[0].getInitParameter(name));
    assertFalse(e.hasMoreElements())
    assertEquals(10, holders[0].getInitOrder());
   
    assertEquals("presence", holders[1].getName());
    assertEquals("org.cipango.kaleo.presence.PresenceServlet", holders[1].getClassName());
    assertFalse(holders[1].getInitParameterNames().hasMoreElements())
    assertEquals(0, holders[1].getInitOrder());
   
    // servlet-mapping
    SipServletMapping[] mappings = servletHandler.getSipServletMappings();
    assertEquals(1, mappings.length);
    assertEquals("main", mappings[0].getServletName());
    assertEquals("((request.method == REGISTER) or (request.method == PUBLISH) or (request.method == SUBSCRIBE) or (request.method == INVITE))",
        mappings[0].getMatchingRuleExpression());
    assertEquals(60, context.getSessionTimeout());
   
    assertNull(servletHandler.getMainServlet());
  }
View Full Code Here

    assertFalse(e.hasMoreElements())
   
    assertEquals(TestListener.class, context.getTimerListeners()[0].getClass());
 
    // servlets
    SipServletHandler servletHandler = (SipServletHandler) context.getServletHandler();
    SipServletHolder[] holders = servletHandler.getSipServlets();
    assertEquals(2, holders.length);
   
    assertEquals("main", holders[0].getName());
    // TODO assertEquals("PBX Servlet", holders[0].getDisplayName());
    assertEquals("org.cipango.kaleo.PbxServlet", holders[0].getClassName());
    e = holders[0].getInitParameterNames();
    name = (String) e.nextElement();
    assertEquals("value", holders[0].getInitParameter(name));
    assertFalse(e.hasMoreElements())
    assertEquals(10, holders[0].getInitOrder());
   
    assertEquals("presence", holders[1].getName());
    assertEquals("org.cipango.kaleo.presence.PresenceServlet", holders[1].getClassName());
    assertFalse(holders[1].getInitParameterNames().hasMoreElements())
    assertEquals(0, holders[1].getInitOrder());
   
    // servlet-mapping
    SipServletMapping[] mappings = servletHandler.getSipServletMappings();
    assertNull(mappings);
    assertEquals(60, context.getSessionTimeout());
   
    assertNotNull(servletHandler.getMainServlet());
    assertEquals("main", servletHandler.getMainServlet().getName());
    assertEquals("org.cipango.kaleo", context.getName());
  }
View Full Code Here

    metaData.addDescriptorProcessor(new StandardDescriptorProcessor());
    metaData.resolve(context);
       
    assertEquals(SipAppContext.VERSION_11, context.getSpecVersion());
   
    SipServletHandler servletHandler = (SipServletHandler) context.getServletHandler();
    SipServletMapping[] mappings = servletHandler.getSipServletMappings();
    assertEquals(2, mappings.length);
  }
View Full Code Here

    assertEquals("contextConfigLocation", name);
    assertEquals("/WEB-INF/kaleo.xml", context.getInitParameter(name));
    assertFalse(e.hasMoreElements())
   
    // servlets
    SipServletHandler servletHandler = (SipServletHandler) context.getServletHandler();
    SipServletHolder[] holders = servletHandler.getSipServlets();
    assertEquals(1, holders.length);
   
    assertEquals("main", holders[0].getName());
    // TODO assertEquals("PBX Servlet", holders[0].getDisplayName());
    assertEquals("org.cipango.kaleo.PbxServlet", holders[0].getClassName());
    e = holders[0].getInitParameterNames();
    name = (String) e.nextElement();
    assertEquals("value", holders[0].getInitParameter(name));
    assertFalse(e.hasMoreElements());     
   
    // servlet-mapping
    SipServletMapping[] mappings = servletHandler.getSipServletMappings();
    assertNull(mappings);
   
    assertEquals("main", servletHandler.getMainServlet().getName());
   
    assertEquals("org.cipango.kaleo", context.getName())
  }
View Full Code Here

 
        _parser.parse(AnnotedServlet.class.getName(), new SimpleResolver());
        AbstractDiscoverableAnnotationHandler annotHandler = (AbstractDiscoverableAnnotationHandler) _parser.getAnnotationHandlers().get(0);
        _sac.getSipMetaData().addDiscoveredAnnotations(annotHandler.getAnnotationList());   
        _sac.getSipMetaData().resolve(_sac);
        SipServletHandler handler = (SipServletHandler) _sac.getServletHandler();
        SipServletHolder[] holders = handler.getSipServlets();
        assertEquals(1, holders.length);
        assertEquals("AnnotedServlet", holders[0].getName());
        assertEquals(-1, holders[0].getInitOrder());
  }
View Full Code Here

            SipAppContext context = new SipAppContext();
            context.setServer(server);
            context.getSipMetaData().setAppName("myApp");
            context.setClassLoader(new WebAppClassLoader(Thread.currentThread().getContextClassLoader(), context));
            context.setOverrideSipDescriptors(Arrays.asList(getClass().getResource("/sip.xml").toString()));
            context.setServletHandler(new SipServletHandler());
           
            Thread.currentThread().setContextClassLoader(context.getClassLoader());
           
      PlusConfiguration plusConfiguration = new PlusConfiguration();
      EnvConfiguration envConfiguration = new EnvConfiguration();
View Full Code Here

        _context.getSipMetaData().resolve(_context);
       
        assertEquals("org.cipango.kaleo", _context.getName());
        assertEquals("Kaleo", _context.getDisplayName());
       
        SipServletHandler handler = (SipServletHandler) _context.getServletHandler();
        SipServletHolder[] holders = handler.getSipServlets();
        assertEquals(1, holders.length);
        assertEquals("AnnotedServlet", holders[0].getName());
        assertEquals(-1, holders[0].getInitOrder());
       
        assertEquals(holders[0], handler.getMainServlet());
       
        InjectionCollection injectionCollection = (InjectionCollection) _context.getAttribute(InjectionCollection.INJECTION_COLLECTION);
        List<Injection> injections = injectionCollection.getInjections(AnnotedServlet.class.getName());
    // Value is set to 9 due to jetty issue at https://bugs.eclipse.org/bugs/show_bug.cgi?id=332796 assertEquals(3, injections.size());
    Iterator<Injection> it  = injections.iterator();
View Full Code Here

   
  public SipAppContext()
  {
    super();
    setSessionHandler(new SessionHandler(new ConvergedSessionManager()));
    setServletHandler(new SipServletHandler());
    setConfigurationClasses((String[]) LazyList.addToArray(
        getConfigurationClasses(),
        SIP_CONFIGURATION_CLASS,
        String.class));
        _scontext = new Context();
View Full Code Here

TOP

Related Classes of org.cipango.servlet.SipServletHandler

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.