troubleshooting Question

Get cache-control headers from request for redirect

Avatar of wpeereboom
wpeereboom asked on
JavaJSPJava EE
2 Comments1 Solution997 ViewsLast Modified:
Hello,

I have created a servlet for using in jsp pages. It's for rewriting urls so i can have nice urls in my jsp website. For example
www.example.com/nicedir/nicefile.html

redirects thru a servlet depents on the subdirectory. It's not a realy redirect but:
request.getRequestDispatcher(newURL).include(request, response);
Where newURl is the jsp page for serving the content. like article.jsp
This works fine, but i send cache-control headers with the article.jsp and these are lost when the
request.getRequestDispatcher(newURL).include(request, response); line is called. So the compleet url www.example.com/nicedir/nicefile.html doesn't contain cache-control headers.

It is possible the add hardcoded cache-control headers in the servlet, but i would like to take over the cach-control headers that are set within the jsp page. So i have to retrieve these header and set this again within the servlet.

Does anyone has experience with this ?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros