Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to get http response status code into theme?
Hi
I use liferay 7.4
I would like to get status code
inside theme (portal_normal.ftl) on user request for web page (like
200, 404 etc).
Session errors object is empty on theme level (it
is weird, because on liferay 7.4 it contains data I need)
Any
ideas how to get status code?
Inside
html/common/themes/body_top.jsp or whatever page status code can be
got like that : <%= response.getStatus() %>
Help
please
Or maybe I need to create some additional module, get
status code there and inject it in theme somehow?
The way you'd typically operate is to create a specific 404 page, on
which you don't need to check for the error code.
The
code can heavily depend on server-side caching (e.g. 500 can be
triggered after half a page, if the response is not yet flushed to the
client. So you're not even guaranteed to get the correct value back.
What are you trying to achieve?
I'm trying to create custom 404 page
This question is connected
to the https://liferay.dev/ask/questions/development/session-errors-are-not-visible-inside-portal_normal-ftl
Powered by Liferay™