I am not sure whether giving the direct url in location will work. But you can put a jsp there and redirect to the url from the jsp.
404
/filenotfound.jsp
filenotfound.jsp
<%@ page language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>