Example usage for javax.servlet Servlet toString

List of usage examples for javax.servlet Servlet toString

Introduction

In this page you can find the example usage for javax.servlet Servlet toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.github.jrialland.ajpclient.AbstractTomcatTest.java

/**
 * binds a servlet on the tomcat instance. the 'mapping' has the same format
 * that the 'servlet-mapping' parameter in web.xml. the path of the servlet
 * will be relative to //* www  .  ja  v a 2 s. c o  m*/
 *
 * {@link Servlet#init(javax.servlet.ServletConfig)} is called with a mock
 * object as parameter.
 *
 * @param mapping
 * @param servlet
 */
protected void addServlet(final String mapping, final Servlet servlet) {
    final MockServletContext servletContext = new MockServletContext("/");
    final MockServletConfig config = new MockServletConfig(servletContext, servlet.toString());
    try {
        servlet.init(config);
    } catch (final Exception e) {
        throw new IllegalStateException(e);
    }
    servlets.put(mapping, servlet);
}