Beispiel #1
0
 /**
  * Add a servlet class.
  *
  * @param klass the servlet class
  * @param urlPattern the URL pattern for requests that should be handled by instances of {@code
  *     klass}
  * @return a {@link ServletConfiguration} instance allowing for further configuration
  */
 public ServletConfiguration addServlet(Class<? extends Servlet> klass, String urlPattern) {
   final ServletHolder holder = new ServletHolder(checkNotNull(klass));
   final ServletConfiguration configuration = new ServletConfiguration(holder, servlets);
   configuration.addUrlPattern(checkNotNull(urlPattern));
   return configuration;
 }
Beispiel #2
0
 /**
  * Add a servlet instance.
  *
  * @param servlet the servlet instance
  * @param urlPattern the URL pattern for requests that should be handled by {@code servlet}
  * @return a {@link ServletConfiguration} instance allowing for further configuration
  */
 public ServletConfiguration addServlet(Servlet servlet, String urlPattern) {
   final ServletHolder holder = new NonblockingServletHolder(checkNotNull(servlet));
   final ServletConfiguration configuration = new ServletConfiguration(holder, servlets);
   configuration.addUrlPattern(checkNotNull(urlPattern));
   return configuration;
 }