• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serving uploaded HTML

 
John Farrel
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a requirement to do the following;

Allow users to upload a zip containing an html document + associated images.
Allow emails to be sent using the contents of that upload as the html of an email.

That's fine. What I'm finding to be tricky is a requirement to show a preview of the html.

These files will be accessible to the file system of the tomcat web server, but how can I effectively serve them into an iframe?

Any ideas?

John
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either they are stored as part of the public web hierarchy of your web app -in which case the iframe can source them directly-, or you need a servlet as an intermediary to stream them to the browser.
 
John Farrel
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

So I've been looking at streaming the html + associated images...
The html is a single file in a directory with its associated images in the same directory.

I can find the file and stream it with no problems.
The problem I have is with the associated images.
Can I send a multipart response with the html + images?

The only solution I've seen so far is to massage the html and alter the image src values to reference another servlet that will stream the correct image.

This is on a tomcat server.



 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't you just put the html file and its images somewhere where they can be served? That's by far the simplest solution.
 
John Farrel
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Why can't you just put the html file and its images somewhere where they can be served? That's by far the simplest solution.


We have multiple production servers accessing these files from a network drive.
Even if I could make a directory on the network drive become part of the deployment, I don't think I'd want to, and it removes the simplicity of that solution.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doesn't sound simple to me. If it were, why would you be posting here?

Personally, I'd go for a build-time solution. But if you want run-time, why not host the shared resources in their own web app, and all other web apps can reference them?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!