¿Cómo mostrar la URL solicitada en una página de error JSP?

En la página de error, me gustaría mostrar la URL que solicitó el usuario.

En miweb.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                            http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        id="WebApp_ID"
        version="3.0">

    <display-name>MyStuff</display-name>

    <error-page>
        <error-code>404</error-code>
        <location>/WEB-INF/error-404.jsp</location>
    </error-page>

</web-app>

Esto reenviará aerror-404.jsp, y aquí está el contenido de ese archivo:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Page Not found</title>
</head>
<body>
    <p align="center">
    <%
        out.println("Requested resource: " + request.getRequestURL()+ " not found");
    %>
</body>
</html>


El problema es elrequest.getRequestURL() debe cambiarse, pero no conozca la palabra clave de qué buscar.

Cuando inicio el navegador parahttp://localhost:8080/MyStuff Entonces me sale el siguiente error:

Requested resource: http://localhost:8080/MyStuff/WEB-INF/error-404.jsp not found

¿Cómo resolver esto?

Respuestas a la pregunta(1)

Su respuesta a la pregunta