Example usage for javax.servlet RequestDispatcher getClass

List of usage examples for javax.servlet RequestDispatcher getClass

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this 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;//w  w  w .  j  a va2 s  .c o  m
        }
    }

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