Examples of WebApplicationContext


Examples of org.mortbay.jetty.servlet.WebApplicationContext

   */
  public <T extends HttpServlet>
   void addServlet(String name, String pathSpec,
                   Class<T> servletClass) {
  
    WebApplicationContext context = webAppContext;
    try {
      if (name == null) {
        context.addServlet(pathSpec, servletClass.getName());
      } else {
        context.addServlet(name, pathSpec, servletClass.getName());
      }
    } catch (ClassNotFoundException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
    } catch (InstantiationException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
View Full Code Here

Examples of org.mortbay.jetty.servlet.WebApplicationContext

   * @param pathSpec The path spec for the servlet
   * @param servletClass The servlet class
   */
  public <T extends HttpServlet> void addServlet(String name, String pathSpec,
      Class<T> servletClass) {
    WebApplicationContext context = webAppContext;
    try {
      if (name == null) {
        context.addServlet(pathSpec, servletClass.getName());
      } else {
        context.addServlet(name, pathSpec, servletClass.getName());
      }
    } catch (ClassNotFoundException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
    } catch (InstantiationException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
View Full Code Here

Examples of org.mortbay.jetty.servlet.WebApplicationContext

   * @param pathSpec The path spec for the servlet
   * @param servletClass The servlet class
   */
  public <T extends HttpServlet> void addServlet(String name, String pathSpec,
      Class<T> servletClass) {
    WebApplicationContext context = webAppContext;
    try {
      if (name == null) {
        context.addServlet(pathSpec, servletClass.getName());
      } else {
        context.addServlet(name, pathSpec, servletClass.getName());
      }
    } catch (ClassNotFoundException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
    } catch (InstantiationException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
View Full Code Here

Examples of org.mortbay.jetty.servlet.WebApplicationContext

   */
  public <T extends HttpServlet>
   void addServlet(String name, String pathSpec,
                   Class<T> servletClass) {
  
    WebApplicationContext context = webAppContext;
    try {
      if (name == null) {
        context.addServlet(pathSpec, servletClass.getName());
      } else {
        context.addServlet(name, pathSpec, servletClass.getName());
      }
    } catch (ClassNotFoundException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
    } catch (InstantiationException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
View Full Code Here

Examples of org.mortbay.jetty.servlet.WebApplicationContext

    listener.setMaxThreads(numThreads);
    webServer.addListener(listener);
    NCSARequestLog ncsa = new NCSARequestLog();
    ncsa.setLogLatency(true);
    webServer.setRequestLog(ncsa);
    WebApplicationContext context =
      webServer.addWebApplication("/api", InfoServer.getWebAppDir("rest"));
    context.addServlet("stacks", "/stacks",
      StatusHttpServer.StackServlet.class.getName());
    context.addServlet("logLevel", "/logLevel",
      org.apache.hadoop.log.LogLevel.Servlet.class.getName());
    webServer.start();
  }
View Full Code Here

Examples of org.openqa.jetty.jetty.servlet.WebApplicationContext

     */
    protected WebApplicationContext newWebApplicationContext(
       String webApp
    )
    {
        return new WebApplicationContext(webApp);
    }
View Full Code Here

Examples of org.soybeanMilk.example.spring.org.springframework.web.context.WebApplicationContext

  public void contextInitialized(ServletContextEvent event)
  {
    ResolverObjectFactory rof=null;
   
    ServletContext servletContext=event.getServletContext();
    final WebApplicationContext springContext=WebApplicationContextUtils.getWebApplicationContext(servletContext);
   
    if(springContext != null)
    {
      rof=new ResolverObjectFactory()
      {
        public Object getResolverObject(Serializable resolverObjectId)
        {
          String name=(resolverObjectId instanceof String ? (String)resolverObjectId : resolverObjectId.toString());
         
          if(springContext.containsBean(name))
            return springContext.getBeans(name);
          else
            return null;
        }
       
        public void addResolverObject(Serializable resolverObjectId, Object resolverObject){}
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

  public void testSource()
  {
    Class actionBeanClass = TestAction.class;

    ServletContext servletContext = createStrictMock(ServletContext.class);
    WebApplicationContext wac = createStrictMock(WebApplicationContext.class);

    expect(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE))
        .andReturn(wac);
    expect(wac.isSingleton("beanName")).andReturn(false);
    expect(wac.getBean("beanName", TestAction.class)).andReturn(new TestAction());

    // second call - note that isSingleton is not called second time
    expect(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE))
        .andReturn(wac);
    expect(wac.getBean("beanName", TestAction.class)).andReturn(new TestAction());

    replay(servletContext);
    replay(wac);

    SpringActionBeanSource source = new SpringActionBeanSource(actionBeanClass, "beanName");
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

  {

    Class actionBeanClass = TestAction.class;

    ServletContext servletContext = createStrictMock(ServletContext.class);
    WebApplicationContext wac = createStrictMock(WebApplicationContext.class);

    expect(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE))
        .andReturn(wac);
    expect(wac.isSingleton("beanName")).andReturn(false);
    expect(wac.getBean("beanName", TestAction.class)).andThrow(
        new NoSuchBeanDefinitionException("beanName", "message"));

    replay(servletContext);
    replay(wac);
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

    }

    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("Starting FtpServer");  

        WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext());
       
        FtpServer server = (FtpServer) ctx.getBean("myServer");
       
        sce.getServletContext().setAttribute(FTPSERVER_CONTEXT_NAME, server);
       
        try {
            server.start();
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.