Tabnine Logo
Servlet.init
Code IndexAdd Tabnine to your IDE (free)

How to use
init
method
in
javax.servlet.Servlet

Best Java code snippets using javax.servlet.Servlet.init (Showing top 20 results out of 1,080)

origin: spring-projects/spring-framework

/**
 * Initialize the wrapped Servlet instance.
 * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
 */
@Override
public void afterPropertiesSet() throws Exception {
  if (this.servletClass == null) {
    throw new IllegalArgumentException("'servletClass' is required");
  }
  if (this.servletName == null) {
    this.servletName = this.beanName;
  }
  this.servletInstance = ReflectionUtils.accessibleConstructor(this.servletClass).newInstance();
  this.servletInstance.init(new DelegatingServletConfig());
}
origin: jersey/jersey

@Override
public void init(ServletConfig config) throws ServletException {
  wrappedServlet.init(new ServletConfigWrapper(config));
}
origin: spring-projects/spring-framework

@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
  if (bean instanceof Servlet) {
    ServletConfig config = this.servletConfig;
    if (config == null || !this.useSharedServletConfig) {
      config = new DelegatingServletConfig(beanName, this.servletContext);
    }
    try {
      ((Servlet) bean).init(config);
    }
    catch (ServletException ex) {
      throw new BeanInitializationException("Servlet.init threw exception", ex);
    }
  }
  return bean;
}
origin: org.springframework/spring-webmvc

/**
 * Initialize the wrapped Servlet instance.
 * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
 */
@Override
public void afterPropertiesSet() throws Exception {
  if (this.servletClass == null) {
    throw new IllegalArgumentException("'servletClass' is required");
  }
  if (this.servletName == null) {
    this.servletName = this.beanName;
  }
  this.servletInstance = ReflectionUtils.accessibleConstructor(this.servletClass).newInstance();
  this.servletInstance.init(new DelegatingServletConfig());
}
origin: Atmosphere/atmosphere

/**
 * Initialize the {@link Filter}
 *
 * @throws javax.servlet.ServletException
 */
public void init() throws ServletException {
  for (FilterConfigImpl f : filters) {
    if (f != null) {
      f.getFilter().init(f);
    }
  }
  if (servlet != null) {
    servlet.init(configImpl);
  }
}
origin: org.springframework/spring-webmvc

@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
  if (bean instanceof Servlet) {
    ServletConfig config = this.servletConfig;
    if (config == null || !this.useSharedServletConfig) {
      config = new DelegatingServletConfig(beanName, this.servletContext);
    }
    try {
      ((Servlet) bean).init(config);
    }
    catch (ServletException ex) {
      throw new BeanInitializationException("Servlet.init threw exception", ex);
    }
  }
  return bean;
}
origin: com.liferay.portal/com.liferay.portal.kernel

@Override
protected void doPortalInit() throws Exception {
  ServletContext servletContext = servletConfig.getServletContext();
  ClassLoader classLoader = (ClassLoader)servletContext.getAttribute(
    PluginContextListener.PLUGIN_CLASS_LOADER);
  String servletClass = servletConfig.getInitParameter("servlet-class");
  servlet = (Servlet)InstanceFactory.newInstance(
    classLoader, servletClass);
  servlet.init(servletConfig);
}
origin: org.apache.cxf/cxf-rt-frontend-jaxws

public void setServletConfig(ServletConfig servletConfig) {
  try {
    shadowCxfServlet = (Servlet)servletClass.newInstance();
  } catch (InstantiationException | IllegalAccessException e) {
    throw new RuntimeException(e);
  }
  try {
    shadowCxfServlet.init(servletConfig);
  } catch (ServletException ex) {
    throw new RuntimeException(ex.getMessage(), ex);
  }
}
origin: spring-projects/spring-framework

servlet.init(new MockServletConfig(servletContext, "myHandler"));
origin: com.liferay.portal/com.liferay.portal.kernel

@Override
protected void doPortalInit() throws Exception {
  ServletContext servletContext = servletConfig.getServletContext();
  ClassLoader classLoader = (ClassLoader)servletContext.getAttribute(
    PluginContextListener.PLUGIN_CLASS_LOADER);
  String servletClass = servletConfig.getInitParameter("servlet-class");
  _subcontext = servletConfig.getInitParameter("sub-context");
  if (_subcontext == null) {
    _subcontext = getServletName();
  }
  servlet = (Servlet)InstanceFactory.newInstance(
    classLoader, servletClass);
  if (!(servlet instanceof HttpServlet)) {
    throw new IllegalArgumentException(
      "servlet-class is not an instance of " +
        HttpServlet.class.getName());
  }
  servlet.init(servletConfig);
  PortalDelegatorServlet.addDelegate(_subcontext, (HttpServlet)servlet);
}
origin: pentaho/mondrian

private static Servlet getServlet(
  String cbClassName,
  String dataSourceText,
  Map<List<String>, Servlet> cache)
  throws ServletException
{
  final List<String> key =
    Collections.singletonList(
      dataSourceText);
  Servlet servlet = cache.get(key);
  if (servlet != null) {
    return servlet;
  }
  MockServletContext servletContext = new MockServletContext();
  MockServletConfig servletConfig = new MockServletConfig(servletContext);
  servletConfig.addInitParameter(
    XmlaServlet.PARAM_CALLBACKS, cbClassName);
  servletConfig.addInitParameter(
    XmlaServlet.PARAM_CHAR_ENCODING, "UTF-8");
  servletConfig.addInitParameter(
    XmlaServlet.PARAM_DATASOURCES_CONFIG,
    "inline:" + dataSourceText);
  servlet = new MondrianXmlaServlet();
  servlet.init(servletConfig);
  if (cache != null) {
    cache.put(key, servlet);
  }
  return servlet;
}
origin: com.atlassian.jira/jira-core

@Override
public void init(ServletConfig config) throws ServletException
{
  displayChart.init(config);
}
origin: apache/cxf

public void setServletConfig(ServletConfig servletConfig) {
  try {
    shadowCxfServlet = (Servlet)servletClass.newInstance();
  } catch (InstantiationException | IllegalAccessException e) {
    throw new RuntimeException(e);
  }
  try {
    shadowCxfServlet.init(servletConfig);
  } catch (ServletException ex) {
    throw new RuntimeException(ex.getMessage(), ex);
  }
}
origin: apache/felix

@Override
public void init(final ServletConfig config) throws ServletException
{
  super.init(config);
  dispatcherServlet.init(config);
  getHttpServiceController().register(config.getServletContext(), serviceRegProps);
}
origin: io.github.factoryfx/jettyFactory

public void update(Servlet servlet, Collection<BasicRequestHandler> basicRequestHandlers){
  try {
    servlet.init(this.servlet.getServletConfig());
  } catch (ServletException e) {
    throw new RuntimeException(e);
  }
  this.servlet=servlet;
  this.basicRequestHandler = basicRequestHandlers==null? Collections.emptyList():new ArrayList<>(basicRequestHandlers);
}
origin: httpunit/httpunit

synchronized Servlet getServlet() throws ClassNotFoundException, InstantiationException, IllegalAccessException, ServletException {
  if (_servlet == null) {
    Class servletClass = Class.forName( getClassName() );
    _servlet = (Servlet) servletClass.newInstance();
    String servletName = _servletName != null ? _servletName : _servlet.getClass().getName();
    _servlet.init( new ServletUnitServletConfig( servletName, WebApplication.this, getInitParams() ) );
  }
  return _servlet;
}
origin: org.kohsuke.httpunit/httpunit

synchronized Servlet getServlet() throws ClassNotFoundException, InstantiationException, IllegalAccessException, ServletException {
  if (_servlet == null) {
    Class servletClass = Class.forName( getClassName() );
    _servlet = (Servlet) servletClass.newInstance();
    String servletName = _servletName != null ? _servletName : _servlet.getClass().getName();
    _servlet.init( new ServletUnitServletConfig( servletName, WebApplication.this, getInitParams() ) );
  }
  return _servlet;
}
origin: javaee/grizzly

/**
 * Starts {@link Servlet} instance of this {@link OSGiServletHandler}.
 *
 * @throws ServletException If {@link Servlet} startup failed.
 */
public void startServlet() throws ServletException {
  configureServletEnv();
  servletInstance.init(getServletConfig());
}
origin: stackoverflow.com

 String jspClassName = findJspClassForJSP("your.jsp");
Class jspClass = Class.forName(jspClassName);
Servlet jspServlet = (Servlet)jspClass.newInstance();
MyServletRequest req = new MyServletRequest();
MyServletResponse resp = new MyServletResponse();
jspServlet.init();
jspServlet.service(req, resp);
jspServlet.destroy();
String results = reps.getContent();
origin: OpenNMS/opennms

@Override
public void init()
  throws ServletException
{
  String name = "servlet_" + getId();
  ServletConfig config = new ServletConfigImpl(name, getContext(), getInitParams());
  this.servlet.init(config);
}
javax.servletServletinit

Javadoc

Called by the servlet container to indicate to a servlet that the servlet is being placed into service.

The servlet container calls the init method exactly once after instantiating the servlet. The init method must complete successfully before the servlet can receive any requests.

The servlet container cannot place the servlet into service if the init method

  1. Throws a ServletException
  2. Does not return within a time period defined by the Web server

Popular methods of Servlet

  • service
    Called by the servlet container to allow the servlet to respond to a request. This method is only ca
  • destroy
    Called by the servlet container to indicate to a servlet that the servlet is being taken out of serv
  • getServletConfig
    Returns a ServletConfig object, which contains initialization and startup parameters for this servle
  • getServletInfo
    Returns information about the servlet, such as author, version, and copyright. The string that this

Popular in Java

  • Finding current android device location
  • runOnUiThread (Activity)
  • requestLocationUpdates (LocationManager)
  • addToBackStack (FragmentTransaction)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • BoxLayout (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now