Example usage for javax.servlet RequestDispatcher toString

List of usage examples for javax.servlet RequestDispatcher toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.liferay.portlet.PortletContextImpl.java

public PortletRequestDispatcher getRequestDispatcher(String path) {
    RequestDispatcher rd = _ctx.getRequestDispatcher(path);

    // Workaround for bug in Jetty that returns the default request
    // dispatcher instead of null for an invalid path

    if ((rd != null) && (rd.getClass().getName().equals("org.mortbay.jetty.servlet.Dispatcher"))) {

        // Dispatcher[/,default[org.mortbay.jetty.servlet.Default]]

        String rdToString = rd.toString();

        String rdPath = rdToString.substring(11, rdToString.indexOf(","));

        if (rdPath.equals(StringPool.SLASH) && !path.equals(StringPool.SLASH)) {

            rd = null;/*from   w ww .java 2  s .c  o  m*/
        }
    }

    if (rd != null) {
        return new PortletRequestDispatcherImpl(rd, this, path);
    } else {
        return null;
    }
}