java - How to make a filter to detect if the user requested a page that is not found? -
i want create filter in app such before each request, detects whether requested page exists. if doesn't exist, forward user error page.
how detect page exists?
i need solution filter , not using web.xml tag method.
if don't have authentication, can.
- make
filter
- use httpservletresponsewrapper , override
senderror()
,setstatus()
- pass wrapped response through
chain.dofilter(req, wrapper)
- if
senderror()
in wrapper, see if it's 404. - take appropriate response.
you may have override getoutputstream()
, getwriter()
avoid response flushed client before chance stuff.
Comments
Post a Comment