Send local html files to Browser

I have a Servlet program which can send any HTML files located on the computer which Tomcat is running to client browser. The HTML files are not necessarily in Tomcat's "webapps" folder. My method is quite simple. Read the content of the local HTML file and write it out through HttpServletResponse object. But there is problem that if the HTML file includes images, the images don't appear in client browser. Is there a way to send those images to client browse as well? Thanks in advance.

Well, this is just an idea, but:
You would probably have to create a new Servlet, that will identify the image type, set the correct content type (response.setContentType("image/gif") for example). It would have to get a binary InputStream to the image and copy the input to the output stream in the response(use the getOutputStream and not getWriter...)
In your HTML writing servlet you would have to scan each line for an <img ... > tag parse out the source and replace it with the image servlet.
Locating the image may be problematic if it is not given in absolute "file://" url. You may need to scan for a <base> tag in the HTML as well, or use the HTML page's directory for the path in which to find the image... but it could come in more complicated then that depending on how complicated the HTML was written (ie, for a server with multiple hosts, or with aliased paths...)
Or, you might be able to write a filter that looks for images(*.gif *.jpg) and sends the request to your image servlet....

Similar Messages

  • "local" html files hangs browser more that 3.X any work arounds?

    I have a program on another machine that creates an html file every 30 seconds. This html file has javascript which compares dates and figures out when to check for the next 30 second update. Works fine in the office. When I VPN in it takes longer to fetch this file. Firefox 3.X did not seem hang for minutes at a time, 4 does. Any tweaks available? I don't want to down grade to Firefox 3 because I LOVE the pinned tabs feature!! For now I'm running a separate instance of firefox just for this page.

    ( links in emails )
    this is what fixed my issue with links in my windows live mail
    in Firefox go to tools >options >advanced > general tab > at the bottom click the check now button to make sure Firefox is your default browser . if its not click yes to make it default now your links in emails should open in Firefox properly

  • Open Local HTML file in app browser?

    Hi,
    We have a question, we would like to link to a local HTML file form within a DPS article, we need the HTML file to open up in the in-app browser; we cannot use a web content overlay for this particular feature. We are able to achieve this easily with content from an online source by creating a Go To URL link with the website in the URL section.
    Can this be done form the HTML resource folder and can this be tested in the adobe content viewer?
    Or even better can we easily link to a local folder using the Go TO URL with a local file path? If so what would this be?
    Thanks
    Daydream

    Yes, you can open an HTML file in an in-app browser by adding the HTML file to the HTMLResources.zip. Create a button with a Go To URL action that looks something like this:
    HTMLResources/HTML_Local/index.html
    Make sure that you create your HTMLResources.zip file properly and upload it to the folder. You can test this in the Adobe Content Viewer on either the iPad or the Desktop as long as you preview the folio (not the article or layout).
    Basically, you use the same technique to link to the HTML file that you use to link to PDF files. For details, see the DPS Tips app > Advanced Overlays > Linking to PDF Files.

  • How to display local HTML file in web-view?

    Hello everyone,
    we have no problem with showing of remote HTML content from server in box on page in web view. But how we can show such a content when included in HTMLResources? In guide is just "Display a local HTML file in an in-app browser", which works wihout problem, but we don't want to show this HTML content in in-app viewer, it should be part of page.
    Thanks
    Martin

    Now i'm confused. In guide is this:
    To use local HTML files, click the folder icon and specify the local HTML file. The HTML file (such as index.html) should appear in a folder that includes any images or scripts used in the HTML file.
    But no info where such a local HTML file should reside. If this file is in HTMLResources, it is ignored.

  • How do i send an html file exported from muse as email blast with images and live links?

    My question it:
    How do i send an html file exported from muse as email blast with images and live links?
    I have designed a "website" in adobe muse and exported it as an html file. I am not sure how to send my .html file in an email!
    Best,
    Nicole

    Unfortunately, the answer is, you don't. The requirements for HTML displayed in an e-mail reader are very different than those for HTML displayed in a browser. The output of Muse won't work as an HTML e-mail. You could upload the Muse site as a website and provide a link to it in an e-mail, but the HTML generated by Muse is not suitable for direct display by an e-mail program.

  • FF 10: cannot load local html files by dragging to FF; links in email don't open

    Just upgraded to FF 10. I cannot open a local html file by dragging it to to FF, or by clicking the file name. Clicking the file name brings up an error message: There was a problem sending the command to the program. Dragging just shows a circle with a slash.
    I can open a local file by typing "file///<file location>" in the location bar.
    Also, clicking a link in an email to any site does not open the site.

    Hi,
    Please see [http://kb.mozillazine.org/Windows_error_opening_Internet_shortcut_or_local_HTML_file_-_Firefox this]. You can start Firefox in [https://support.mozilla.com/en-US/kb/Safe%20Mode Safe Mode] to check if an add-on is causing the problem. You can also try to '''Open with''' by right-clicking on the HTML file and choose Firefox and enable '''Always use the selected program to open this kind of file'''.

  • Can't select local html files with web object in captivate 8

    I can select pdf's via browse, but it I want to add local html files I have to type the path in manually. I'm guessing this is just a bug, I should be able to choose web pages for the web object even if they are local right?

    Fireworks is a graphics editor that can export code; it is not an HTML/code editor.
    If you have exported HTML from Fireworks, you ought to be able to re-import that, but I would think most people who use Fireworks exported code would just modify their Fireworks document and re-export. (Fireworks' code is not robust and it is only intended for mockups and prototypes. Fireworks is not intended for developing and maintaining live Web sites; Dreamweaver is.)
    If your developer used Dreamweaver, then I really don't expect that Fireworks would be able to import that, nor any code that isn't in exactly the format that it can export. If you know your developer used Fireworks, then you need to look for .png files. Fireworks uses an enhanced version of the PNG format for its native document format.
    If you are making small adjustments to your site, then you might be better off working in Dreamweaver. If you're doing a site re-design, then Fireworks is an excellent tool for laying out your design and producing your graphics, but you will, at some point, need to move over to Dreamweaver for coding.

  • Workflow- sending a html file in a mail(outlook)

    Hi Guys,
      i want to send a html file in a mail(outlook) in workflow. whenever enduser click that file its open automatically sap inbox.
    html file belongs to a logo, if we click on that file it will automatically opens the SAP INBOX.
    this is the my requirement.
    give me suggestion for this requirement or any other solution.
    we appriciate your reply.
    Thanks
    Sankar.
    Message was edited by: sankar surya

    Unless you are prepared to zip and email every folder and
    file related to
    the page,
    exactly as it is on your computer, it would be wiser to
    upload it all to
    your hosting
    server, and send a link to the recipient.
    "2start" <[email protected]> wrote in
    message
    news:erat61$h8m$[email protected]..
    >I need to email a frame page I have created in
    DreamWeaver.. How can I do
    >that?

  • How to load local html-file into webBrowser tool? [SDK 6.5]

    The webbroser tool lets you load an external html by inputting the adress in its "Url"-property.
    But how do you load a local html-file that is added to your project? Lets say the path is: Folder1/Subfolder1/Webpage1.html. What would I put in the Url-property to make this work?
    While on this subject, what is the support for css and javascript when using locally loaded webpages in the webbrowser?

    Thanks for the answer Malleswar, but I have now played around with all variations of that code-line that I can think of, but still I can not locate the html-file that is located within the project. Since Im planning to distribute the html-files with the executable (as one file) it should read it directly from wherever the application is installed.
    The html-file is included within the project. Solution Explorer -> Solution 'myProject' -> myProject -> Webpage1.html
    Which is (as usual) also where the Form1.cs (which contains the webBrowser-component) is located.
    Any ideas of how the Uri should be constructed in this case?
    Thanks,
    Daniel

  • Opening local .html files on iPad

    I have created a personal homepage that I have loaded on my Macs at home. Any way I can use this file on my iPad 3?

    It is possible to open local HTML files in Safari on iPad2. Easy!
    Open your Safari.
    Touch Bookmark icon for a little while.
    A dialogue box appears with "/var/Mobile" title.
    Go to "Applications" > your app (iFile, GoodReade or whatever yours) > Documents.
    And you are there. Open your HTML files.
    Now you can go anywhere to and fro without problem.
    It is FTP:///.
    If need later, Bookmark that.
    With Loving-Kindness!
    bhikkhusirin

  • Parse local HTML files

    Hi,
    I want to parse local HTML files.
    Is there another way than using the Internet Explorer($ie = new-object -com "InternetExplorer.Application";) (without relaying on external packages)?
    At the moment I do something like that:
    $ie = new-object -com "InternetExplorer.Application";
    Start-Sleep -Seconds 1
    $ie.Navigate($srcFile)
    Start-Sleep -Seconds 1
    $ParsedHtml = $ie.Document
    foreach($child in $ParsedHtml.body.getElementsByTagName('table'))
    I still want to have the methods like 'getElementById()' or 'getElementByTagName()'.
    With my current approache, the performance is not realy good and it seems that the iexplorer.exe process is not terminating at the end of the script. 
    Also it seems to have sideeffects with running internet explorer instances (from GUI) - not working to start IE in powershell sometimes.
    Last time I also have a hanging script, not continuing till i manually terminate the iexplorer.exe process.
    The error was:
    Exception calling "Navigate" with "1" argument(s): "The remote procedure call f
    ailed. (Exception from HRESULT: 0x800706BE)"
    At D:\Scripts\Run.ps1:529 char:14
    + $ie.Navigate <<<< ($src)
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation
    so I would prefere a method parsing HTML without IE.

    Hi John Mano,
    Please also try to Parse local HTML files with
    System.Xml.Linq, the script may be helpful for you:
    Using PowerShell to parse local HTML files  
    I hope this helps.                               
    XML?
    I thought HTML is not compatible with xml. 
    And as I don't know LINQ good ... 
    Ok, I'll give it a try. later.
    I can't answer the question about other ways to parse HTML, but to close your IE session you should do the following:
    $ie.Quit() # this terminates the IE process
    $ie = $null # this frees the COM object memory
    Thanks for that.
    I now use that, but seems to be still some IEs open ...
    Maybe a path missing where i dont do it.
    But finally I still get this error. And it is blocking the whole script ...
    Exception calling "Navigate" with "1" argument(s): "The remote procedure call f
    ailed. (Exception from HRESULT: 0x800706BE)"
    At E:\DailyBuild\Scripts\PublishTestResults.ps1:533 char:15
    + $ie.Navigate <<<< ($srcFile)
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

  • Many fonts don't render when Firefox opens local html file

    I'm using a 3rd-party program called Fontlist. It reads all fonts in the Windows fonts folder, and then uses a user-chosen line of text to generate an html file on the hard drive that shows the line of text displayed in each font. Since it's a 3rd-party program, I don't have control over it's html programming.
    When the generated html file is browsed with Internet Explorer, all fonts display correctly. When browsing it with Firefox, perhaps half or more of the fonts have an ordinary-looking backup font substituted. I've not been able to discern any pattern as to what kind of font displays correctly or does not.
    In researching the problem online, I saw a hint that setting security.fileuri.strict_origin_policy to false might fix the issue. I tried it, and it did not have any effect. Also, in the Fonts and Colors Advanced option, I've checked the box to let web pages choose their own fonts.
    Might there be any other settings that would enable Firefox to render virtually any industry-standard font installed on the system? This can affect any html files from 3rd-party sources, not just Fontlist.

    Do the font-family names that have a space have quotes around them?
    *font-family:"Aldine 721";
    See also:
    *https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
    <blockquote>Font family names must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. This means that punctuation characters and digits at the start of each token must be escaped in unquoted font family names.</blockquote>

  • WebView with local html file

    How can I use webview to display a local html file?

    Here is a link that will help:
    "How To Read a File From Your Application Bundle"
    http://iphoneincubator.com/blog/data-management/how-to-read-a-file-from-your-app lication-bundle
    but basically you do this:
    // urlLocation is of type (NSURL *) and
    // webView is of type (UIWebview *)
    NSString *filePath = \[\[NSBundle mainBundle\] pathForResource:@"MyFileName" ofType:@"html"\];
    urlLocation = \[NSURL fileURLWithPath:filePath\];
    \[webView loadRequest:\[NSURLRequest requestWithURL:urlLocation\]\];
    ALSO, make sure your html file is part of your project so that it's also part of the bundle.
    Hope this helps!

  • Safari 5.1 does not open local html files

    Safari 5.1 does not open local html files (with .htm or .html extensions). It fails on files that previous versions of Safari opened. Firefox continues to open them. Any suggestions?

    Turn this option off:
    Regards,
    Colin R.

  • Opening up a local html file

    From within an authorware exe file I want to open an local html file.
    It can't seem to find it even though I put the relevant files in the same folder currently C:\EP
    here's my code:
    JumpFileReturn("\\EP103\\pe16\\pt1\\page_01.htm", "", "")

    Try JumpOutReturn("",FileLocation^"myfile.htm")
    Or  JumpOutReturn("",FileLocation^"MySubFolder\\MySubSubFolder\\MyFile.htm") depending on the file hierarchy.
    This should work.
    +27 82 853 1010
    http://www.jfmultimedia.co.za
    Skype:  johannfouche
    Telephone VOIP:  +27 127435670

Maybe you are looking for

  • Questions on OBIEE reporting against transactional Database

    Hello guys I have a situation where I have to bring in 5 tables from transactional database to do reporting on.. I looked at the tables, there are not typically dimension or fact tables. Each table contains information very specifically, at the same

  • F-22,f-43 tables

    Hi all, I need some information regarding “Customer and Vendor Invoices ” 1.     Can any one please help me what are all the tables that update when we post customer and vendor invoice with F-22 and F-43. please give me all relevant information,. I w

  • Need to show Previous months data in report

    Hi All, I have a crystal report 2011 which shows monthly Cash data. It has 3 other columns like Previous 3 months cash data, previous 6 months cash data, Previous 12 months cash data in report. My report also has two parameters- start date and end da

  • Want to delete out.log files

    Log files having a file name of {servername}-out n.log (where n is a numeric identifying separate log files) accumulate in great numbers in the folder, \JRun4\logs\. Some log files appear to expand beyond their typical 200kb size into the hundreds of

  • Usage of more number of Staging tables

    Hi, We use more staging tables for our processes in DWH project. Hence, it increases the total number of tables in our schema. Will it put more stress on Oracle Catalog/Meta-data management, please suggest, what is the optimal number of tables to be