Example usage for javax.servlet ServletContext getServlet

List of usage examples for javax.servlet ServletContext getServlet

Introduction

In this page you can find the example usage for javax.servlet ServletContext getServlet.

Prototype

@Deprecated
public Servlet getServlet(String name) throws ServletException;

Source Link

Usage

From source file:com.liferay.arquillian.DeployerServlet.java

private Servlet waitForServlet(ServletContext servletContext, String servletName, long timeout) {

    long elapsedTime = 0;

    Servlet found = null;/*from ww  w .  ja  v a 2 s  .  c om*/

    final long step = 10;

    while ((found == null) && (elapsedTime < timeout)) {
        try {
            Thread.sleep(step);
        } catch (InterruptedException e) {
            break;
        }

        try {
            found = servletContext.getServlet(servletName);
        } catch (ServletException e) {
        }

        elapsedTime += step;
    }

    return found;
}