Class StaticResourceController
java.lang.Object
com.bobocode.bring.web.staticcontent.controller.StaticResourceController
- All Implemented Interfaces:
BringServlet
Controller responsible for handling static resource requests.
Provides an endpoint to retrieve static files based on the requested URI.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgetStaticFile(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Handles GET requests for static resources.private voidsetContentType(jakarta.servlet.http.HttpServletResponse response, Path path) Sets the content type in the HTTP response based on the file type.
-
Field Details
-
staticResourceService
-
-
Constructor Details
-
StaticResourceController
public StaticResourceController()
-
-
Method Details
-
getStaticFile
public void getStaticFile(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Handles GET requests for static resources.- Parameters:
request- The incoming HTTP request.response- The outgoing HTTP response.
-
setContentType
private void setContentType(jakarta.servlet.http.HttpServletResponse response, Path path) throws IOException Sets the content type in the HTTP response based on the file type.- Parameters:
response- The outgoing HTTP response.path- The path of the static file.- Throws:
IOException- If an I/O error occurs while processing the response.
-