• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to write dynamic images to web server?

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a module for creating images dynamically, which is not a servlet. I'm trying to store the images on web server and return their URLs back to client. My question is how can I get to know the path of WebContent from my module. I hold a reference to the HTTPRequest, does it help? Or should I treat it a same process as client uploading images to server?

Thanks.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Louis Wang wrote:I have a module for creating images dynamically, which is not a servlet. I'm trying to store the images on web server


Exactly how are they being stored?

My question is how can I get to know the path of WebContent from my module


What is "WebContent"? A folder? TellTheDetails please.

I hold a reference to the HTTPRequest, does it help?


After the request is over? I hope not! Never hold a reference to a container object.

Essentially you treat it like any other image. The <ing> tag references a URL that serves the image data. That URL is usually to a static file or a servlet that streams the image data.
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Bear.

I intend to save images as files to the WebContent folder. The WebContent folder is where the static html pages located. It's supposed to be accessed by client through URLs.

For now I do it as below:
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, so if the file is being created on disk, how is it any different from any other image file? Just use an tag with a URL that addresses the file.
 
For my next trick, I'll need the help of a tiny ad ...
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic