In my application, i have to generate images on fly using java code and have to give a path of generated image in html page to show generated image to the user in html.
In my case,we can not place generated image in jar file on fly.So I can generate image file outside of the jar.But i can not locate image in html file.
Can you please help me out on this.
Jar file location is java -jar /usr/syam/test/test.jar
but i am generating images in /usr/syam/captcha/test.jpg
in html file,
Please help me on this.
You can use resource handler e.g.
@Component
class WebConfigurer extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/captcha/**").addResourceLocations("file:///usr/syam/captcha");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With