Package com.jk.web.util
Class JKServletResourceLoader
java.lang.Object
com.jk.core.resources.JKDefaultResourceLoader
com.jk.web.util.JKServletResourceLoader
- All Implemented Interfaces:
JKResourceLoader
This class extends
JKDefaultResourceLoader
and provides resource
loading capabilities within a servlet context.- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
ConstructorsConstructorDescriptionJKServletResourceLoader
(jakarta.servlet.ServletContext context) This method constructs a newJKServletResourceLoader
with the specified servlet context. -
Method Summary
Modifier and TypeMethodDescriptiongetResourceAsStream
(String resourceName) This method retrieve anInputStream
for reading the specified resource.getResourceUrl
(String fileName) This method retrieve a URL pointing to the location of the specified file resource.
-
Constructor Details
-
JKServletResourceLoader
@Autowired public JKServletResourceLoader(jakarta.servlet.ServletContext context) This method constructs a newJKServletResourceLoader
with the specified servlet context.- Parameters:
context
- Specifies the servlet context.
-
-
Method Details
-
getResourceAsStream
This method retrieve anInputStream
for reading the specified resource.- Specified by:
getResourceAsStream
in interfaceJKResourceLoader
- Overrides:
getResourceAsStream
in classJKDefaultResourceLoader
- Parameters:
resourceName
- Specifies the name of the resource to be retrieved.- Returns:
- an
InputStream
for reading the resource, or null if the resource is not found.
-
getResourceUrl
This method retrieve a URL pointing to the location of the specified file resource.- Specified by:
getResourceUrl
in interfaceJKResourceLoader
- Overrides:
getResourceUrl
in classJKDefaultResourceLoader
- Parameters:
fileName
- Specifies the name of the file resource to be located.- Returns:
- a URL representing the location of the resource, or null if the resource is not found.
-