All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.tesla.webserver.WebServer Maven / Gradle / Ivy

/**
 * Copyright (c) 2016 Takari, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package io.tesla.webserver;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;

import javax.net.ssl.SSLContext;
import javax.servlet.Servlet;

public interface WebServer {

  void stop() throws Exception;

  void start() throws Exception;

  int getPort();

  URL getUrl() throws MalformedURLException;

  void enableSsl(SSLContext sslContext);

  /**
   * Add authentication handler to the given pathspec.
   * 
   * @param pathSpec e.g. "/path/*"
   * @param authName e.g. BASIC, DIGEST
   */
  void addAuthentication(String pathSpec, String authName);

  /**
   * Add the given user and password to the servers security realm. The password may be any type supported by the
   * authentication type (e.g. a certificate for client side certificate auth).
   */
  void addUser(String user, Object password);

  void addServlet(Servlet servlet, String pathSpec);
  void addServlet(Servlet servlet, String contextPath, String pathspec);
  void addServlet(Servlet servlet, String contextPath, String pathspec, Map params);

  void enableProxy();

  // server.addResourceContext("/", "src/main/webapp");
  void addResourceContext(String context, String directory) throws MalformedURLException, IOException;

  void addWebAppContext(String context) throws MalformedURLException, IOException;

  void run() throws Exception;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy