Reputation: 51
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.
Upvotes: 4
Views: 3599
Reputation: 4683
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");
}
}
Upvotes: 9