Package org.jibeframework.core.app.request

Source Code of org.jibeframework.core.app.request.JibeSpringMvcDispatcher

package org.jibeframework.core.app.request;

import java.util.Enumeration;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.context.ServletContextAware;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

/**
*
* @author dhalupa
*
*/
public class JibeSpringMvcDispatcher extends DispatcherServlet implements ApplicationContextAware, ServletContextAware,
    InitializingBean {

  private static final long serialVersionUID = 1L;
  private ApplicationContext applicationContext;
  private ServletContext servletContext;

  @Override
  protected WebApplicationContext initWebApplicationContext() {
    return (WebApplicationContext) applicationContext;
  }

  public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    this.applicationContext = applicationContext;

  }

  public void afterPropertiesSet() throws Exception {
    super.setDetectAllHandlerMappings(false);
    super.initServletBean();

  }

  public void setServletContext(ServletContext servletContext) {
    this.servletContext = servletContext;

  }

  @Override
  public ServletConfig getServletConfig() {
    return new ServletConfig() {
      public String getServletName() {
        return "JibeSpringMvcDispatcher";
      }

      public ServletContext getServletContext() {
        return servletContext;
      }

      @SuppressWarnings("unchecked")
      public Enumeration getInitParameterNames() {
        return null;
      }

      public String getInitParameter(String name) {
        return null;
      }
    };
  }

}
TOP

Related Classes of org.jibeframework.core.app.request.JibeSpringMvcDispatcher

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.