Package javax.servlet

Examples of javax.servlet.ServletContext.addServlet()


    ServletContext context = sce.getServletContext();

    /* Declare Servlet */
    // Declare Servlet into the ServletContext
    Class servlet = Sample03SyncServlet.class;
    javax.servlet.ServletRegistration.Dynamic servletConfiguration = context.addServlet("Sample03SyncServlet", servlet);
    // Configure the Servlet added
    servletConfiguration.addMapping("/Sample03SyncServlet");
    servletConfiguration.setInitParameter("msg", "Hello From Dynamic declared servlet ;o)");

    /* Declare Filter */
 
View Full Code Here


    final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
    root.setServletContext(ctx);
    root.scan("app");
    root.refresh();

    final Dynamic servlet = ctx.addServlet("spring", new DispatcherServlet(root));
    servlet.setLoadOnStartup(1);
    servlet.addMapping("/");
  }

  @Override
View Full Code Here

  private void initFilter() throws Exception {
    final ServletContext servlet3Context = mock(ServletContext.class);
    when(servlet3Context.getMajorVersion()).thenReturn(3);
    when(servlet3Context.getContextPath()).thenReturn("");
    when(servlet3Context.addServlet(anyString(), any(Servlet.class))).thenReturn(mock(ServletRegistration.Dynamic.class));
    final FilterConfig filterConfig = spy(new MockFilterConfig());
    when(filterConfig.getServletContext()).thenReturn(servlet3Context);
    final RequestMonitor requestMonitor = mock(RequestMonitor.class);
    when(requestMonitor.monitor(any(MonitoredRequest.class))).then(new Answer<RequestMonitor.RequestInformation<?>>() {
      @Override
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.