Serving static resources
So far, we have seen that every request goes through the controller and returns a corresponding view file for the request; most of the time, these view files contain dynamic content. By dynamic content, I mean the model values that are dynamically populated in the view file during the request processing. For example, if the view file is of the JSP type, then we populate model values in the JSP file using the JSP expression notation, ${}.
However, what if we have some static content that we want to serve to the client? For example, consider an image that is static content; we don't want to go through controllers in order to serve (fetch) an image as there is nothing to process or update any values in the model. We simply ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access