How does Tomcat handle data files?

Hello,
To test something, i wrote a small test.jsp file, to figure out how tomcat handles data files. The content looks like this:
<html>
<head>
<title>test</title>
</head>
<body>
<%@ page import="java.io.*"%>
<%
          String Line;
          try
               FileWriter fw = new FileWriter("http://localhost:8080/act/testfile.dat");
     PrintWriter pw = new PrintWriter(fw);
               pw.write("yeah baby yeah");
               pw.close();
               FileReader fr = new FileReader("http://localhost:8080/act/testfile.dat");
     BufferedReader br = new BufferedReader(fr);
               Line = br.readLine();
               br.close();
          catch (Exception e)
               Line = "OEPS : " + e.getMessage();
%><%=Line%>
</body>
</html>
This give me an error.
When i chance the path of the Filewriter adn filereader to: c:/testfile.dat
it works.
Can anyone explain this to me...
many thanks
Hugo Hendriks

I think you should rewrite your code using the following.
FileWriter fw = new FileWriter(getServletContext().getRealPath("/testfile.txt"));
FileReader fr = new FileReader(getServletContext().getRealPath("/testfile.txt"));It works for me.

Similar Messages

  • How does Photostream handle duplicate file names?

    My sister has an iPhone and an iPad, and takes photos with both. Her husband has an iPhone, and also takes photos. They have a PC. Photostream is enabled on all of these devices.
    Now, since all three devices use a simple sequential file numbering system (IMG_XXXX), they will produce duplicate file names.
    This, of course, becomes an issue when you consolidate the photos taken by multiple iOS devices in one folder as is done by Photostream on PC.
    Which brings me to my question: How does Photostream (on PC) handle duplicate file names? Does it simply overwrite, keeping the one with the latest date, or what? Does it inform the user in any way?
    Oddly, I have seen little discussion on this. It really seems like Photostream is pointless

    FOLLOWUP. Below, is a clearer explanation of my concern/question.
    My sister has an iPhone and an iPad, and takes photos with both. Her husband has an iPhone, and also takes photos. Photostream is enabled on three devices. They have a PC. iCloud Control Panel for Windows is installed, and Photostream is enabled.
    Now, since iOS devices use a simple sequential file numbering system (IMG_XXXX.JPG), when you consolidate these images into one folder as is done by Photostream on PC, you will sooner or later encounter two (or more) different photos that have the same file name. Different photos with the same file names can/will happen when you consolidate images taken with different iOS devices into the same folder.
    Which brings me to my question:
    How does Photostream (on PC) handle duplicate file names that are not duplicate images?
    Q: Does it simply overwrite, perhaps keeping the one with the latest date taken? In this case Photostream will not contain all of the photos it should.
    Q: Or, does it do something to create a unique filename when it encounters a duplicate file name? For example: IMG_0001, IMG_0001(1), IMG_0001(2)
    Oddly, I have seen no discussion on this. I hope someone can help me understand how Photostream handles this so we can decide how best to use Photostream, or if it is a feature we want to disable.
    Thank you,
    Lilla

  • [solved] How does Pacman handle config files?

    Hi,
    I've read that Pacman handles config files by comparing their hashes in 3 different statuses.
    (which are in current status, new status, and original status)
    The current config file's hash is easily obtained, and so does the new ones'.
    But how does Pacman get the original one's hash?
    Can someone tell me, please?
    Thank you, and happy new year,
    bsdson
    Last edited by bsdson.tw (2008-12-26 07:37:41)

    It is stored in the pacman database.  e.g. look at /var/lib/pacman/local/pacman-3.2.1-2/files

  • How does iWeb handle packaged files. (Like Keynote files)

    I'm going to be changing this site soon, but I wanted to check here before I did.
    Symbolic Representation
    At the bottom of the page are two .key files for Keynote. When I dropped them onto iWeb, it shows them added as filename.key.zip but in the Domain file and in the file area on my iDisk, it shows as filename.key.
    If you attempt to download them, one of two things happen. The file is downloaded as a .zip file, unarchived, .zip file sent to the trash then opened in Keynote
    OR
    File is a .zip when it downloads, but only filename.key is shown making the user think the file is corrupt. If they add .zip to the end and double click, it will unarchive and you'll be able to open the file properly.
    I was wondering if anyone else had run into this? Does this work consistently OR why wouldn't it work for some people?

    I'm going to zip them soon to see if that solves the problem, but wanted to know how many people using OSX are seeing a problem now. So far, I've only had one person say they downloaded as corrupt .key files, everyone else can see them fine.
    Just curious about the "why" so that if anyone else has this problem, I'll have more info
    Either way I link it, the interface shows filename.key (even the rollover text after I create the page says filename.key), the URL area in the inspector shows filename.key.zip, and the file in the Domain file AND on the iDisk is filename.key.

  • How does OVS handle sparse files?

    I can see that if I create a new virtual machine a spare disk image file is created - fine. But I'm having problem with other type of operations. If I have a sparse System.img in some Virtual machine and I create a template of it - then the System.img copied to the template catalog is not sparse anymore- I guess this holds true also if you clone a virtual machine. Does anyone know if OVS support handling of sparse files when moving/copying the files arround? Or maybe know if this feature is planned?

    I think you should rewrite your code using the following.
    FileWriter fw = new FileWriter(getServletContext().getRealPath("/testfile.txt"));
    FileReader fr = new FileReader(getServletContext().getRealPath("/testfile.txt"));It works for me.

  • How does Oracle handle resource files?

    Good day everyone,
    I have a Java code that opens a text file. When I load this code into Oracle using loadjava, I also load in the text file as a resource file. When I run the code on Oracle (after publishing all necessary Java code), I get a NullPointerException, because it can't find the text file when I try to open it. I get no resolve errors when I user loadjava.
    How can Java inside Oracle open external text files?
    Thanks in advance for your help,
    Gary

    I think you should rewrite your code using the following.
    FileWriter fw = new FileWriter(getServletContext().getRealPath("/testfile.txt"));
    FileReader fr = new FileReader(getServletContext().getRealPath("/testfile.txt"));It works for me.

  • How does RoboHelp handle aspx files?

    Working to convert aspx files to RoboHelp then BACK to aspx without taking in a different tool. Is it possible? If so, how?

    Colum is right. We need more information. Presently, the only way to have RoboHelp generate "native .aspx" files is using a Multiscreen layout and publishing to SharePoint. You will find documentation on this process in the online help topic
    Adobe RoboHelp 11 * Publish native (ASPX) Multiscreen output to Microsoft SharePoint
    Also, you will want to refer to Willam VanWeelden's website where there is more info as well as a recording of a seminar Willam and I conducted last year. Recording of RoboHelp & SharePoint Integration Webinar Now Available | WvanWeelden.eu
    Thanks
    John Daigle
    Adobe Certified RoboHelp and Captivate Instructor
    Evergreen, Colorado
    www.showmethedemo.com

  • How does Aperture handle file structure

    I have been working with iPhoto since its infancy and have one big issue with it, namely that it is such a closed system. I dislike that everything needs to be imported and exported to use it elsewhere, clogging up my computer with all these duplicates. Does Aperture handle that better? I spent 2 hours reading different reviews and discussions and for some reason, nobody seems to discuss exactly that, maybe most people don't mind to have a vault structure? If so, how do you handle sharing files outside of the tools like Facebook export etc that are offered?
    Thanks ~ Barb

    namely that it is such a closed system.
    It's not. It's a Database and this
    everything needs to be imported...
    is a characteristic of databases. This
    and exported to use it elsewhere
    is just not true if you use any of the very many ways that the OS and other applications integrate with iPhoto. I rarely, if ever, exported from iPhoto when it was my primary Photo app.
    The point is not to defend iPhoto, but if the database aspect of it irritates you then run a mile from Aperture. Everything has to be imported and can be accessed only in (pretty much) the same ways as they can be in iPhoto.
    how do you handle sharing files outside of the tools like Facebook export etc that are offered?
    Here's a stock answer I use over on the iPhoto forum. You can pretty much swap the word 'Aperture' for iPhoto:
    There are many, many ways to access your files in iPhoto:
    *For Users of 10.5 and later*
    You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
    Uploaded with plasq's Skitch!
    +*(Note the above illustration is not a Finder Window. It's the dialogue you get when you go File -> Open)+*
    You can access the Library from the New Message Window in Mail:
    Uploaded with plasq's Skitch!
    If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    *If you want to access the files with iPhoto not running*:
    For users of 10.6 and later:
    You can download a free Services component from MacOSXAutomation which will give you access to the iPhoto Library from your Services Menu. Using the Services Preference Pane you can even create a keyboard shortcut for it.
    Other options include:
    1. *Drag and Drop*: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    2. *File -> Export*: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    Regards
    TD

  • If the browser's cookie is disabled, how does Tomcat 4.1.12 handle the sess

    If the browser's cookie is disabled, how does Tomcat 4.1.12 handle the session?

    by URL Rewriting.
    For in deep information have a look at the servlet api docu or get the free pdf tutorial CoreServlets that covers this topic under pdf.coreservlets.com

  • How does iphoto handle files exactly?

    using the program spring cleaning, i found all images outside of my iphoto library and imported them into my library. my question now is, if i run the search again, finding all images not in my iphoto library, can i safely delete those images since they have been copied into iphoto or are they still needed as a reference for the program? how does iphoto work with files exactly? i know there's an "original" and a "data file", but where are each of these stored? when a photo is imported to the iphoto library, does it make a copy of the original and the data file or what?

    ryanfg
    Unless you changed the default setting in the iPhoto preferences, then if a photo is in the iPhoto Window then it's in the iPhoto Library Folder.
    A Note about the iPhoto Library Folder:
    In this folder there are various files, which are the Library itself and some ancillary files. Then you have three folders
    Originals are the photos as they were downloaded from your camera or scanner.
    (ii) Modified contains edited pics, shots that you have cropped, rotated or changed in any way.
    This allows the Photos -> Revert to Original command - very useful if you don't like the changes you've made.
    (iii) Data holds the thumbnails the the app needs to show you the photos in the iPhoto Window.
    Regards
    TD

  • I migrated all data from old PC to new and iTunes successfully transferred to new PC. When I click on a song it says it cannot locate the original. How does one map iTunes file to iMusic to enable play from original files ?

    Subject: Migration
    I migrated all data from old PC to new and iTunes successfully transferred to new PC. When I click on a song it says it cannot locate the original. How does one map iTunes file to iMusic to enable play from original files ?

    Subject: Migration
    I migrated all data from old PC to new and iTunes successfully transferred to new PC. When I click on a song it says it cannot locate the original. How does one map iTunes file to iMusic to enable play from original files ?

  • How does FCP handle 23.98 DV Files?

    Hi All,
    Has anyone Edited using the DV-NTSC 24P (23.98fps) Easy Setup?
    1) How does FCP handle this video connected to a DV Converter Box like the Canopus ADVC-110?
    2) Does it actually play at 23.98fps on a monitor connected to the DV Converter Box?
    3) Does it get converted to 29.97fps somewhere in the process before it gets displayed?
    4) is it displayed at 29.97fps or is it really being displayed at 23.98fps?
    these are things that I am not sure of.
    sorry if I posted this message a couple of times. I didn't know that hitting the "Tab" Button posts the message, I thought it would just function like the Tab in a normal Text editor and indent a line. But here it doesn't.
    thanks
    Kalagan

    Hi,
    Thanks for the feed back. I guess I should fill in the caps a little.
    *DESCRIPTION OF ISSUE:*
    One of our main Clients Disney, is migrating to a Tapeless Workflow based on ProRes HQ 422 @ 23.98fps. From here on out, they will only send us ProRes HQ 422 1920x1080 files @ 23.98fps and they want us to Edit every project we work on for them @ 23.98fps. At the moment, it doesn't sound like they care if we Edit our projects in ProRes HD or some SD format, but the important thing to them is that we edit @ 23.98fps.
    PROBLEM:
    Our facility doesn't have the infrastructure to support 25 machines accessing ProRes HQ 422 files. Our facility was built to support DV NTSC @ 29.97fps and we have been working this way fairly well, for a number of years.
    SOLUTION:
    I am trying to find a way to continue to us our current equipment and satisfy Disney's request to work on all their projects at 23.98fps, starting from 1920x1080 ProRes HQ 422 files @ 23.98fps. So, it was my hope to be able to take the 23.98fps ProRes files and export them to 23.98fps DV NTSC. This way we wouldn't have to reconfigure our entire Facility (which would cost a couple hundred Thousand dollars).
    My approach was to:
    1) Use Media Manager to render a new DV NTSC file at 23.98fps, which it does pretty well for the most part. It keeps the Timecode consistent between the two files (very important), but doesn't allow you to Letterbox the 16x9 video in the 4x3 frame, it just stretches it to fill the entire 4x3 frame (not so good).
    2) Then import the newly created DV NTSC 23.98fps file into a FCP Project based on the DV NTSC 24(p) 23.98fps EASY SETUP. Which works well. No problems there.
    3) Then Play the file in FCP out through a Firewire based Canopus ADVC-110 DV Converter connected to a SD Sony Monitor. This seemed to worked fine also.
    The fact that it plays is great!!!! But, that brings up the question, is it really playing a 23.98fps?
    My understanding of Standard Definition and specifically DV NTSC, is that it can only be displayed at 29.97fps, it doesn't support 23.98fps natively. So the fact that it played when I tested it got me thinking that I may be missing something here and DV NTSC and other SD equipment (like the Sony SD Monitor) can playback/support 23.98fps SD video. But that goes against everything I know up to this point!!!
    Have I been wrong all this time?
    1) Can SD Video and DV NTSC Video be displayed at 23.98fps?
    2) Or is it getting converted to 29.97fps somewhere in the process before it is getting displayed?
    3) If it is getting converted back to 29.97fps, then where is it getting converted, FCP or in the DV Converter Box?
    I am sorry I went a little long on this email, but it is a problem that will have great influence on they way we work for a couple of years to come!!
    Thanks for your input!!
    Kalagan

  • How does DIADEM import TDMS files? How gets every channel his number and groupindex? How can I determine which channel has which groupindex and number?

    I store different channels in a TDMS file.
    I like to have a time channel at the first position with group index 1 and number 1.
    When I read the TDMS file with DIADEM the time channel (Float64) is on a differernt position, and the channels are not sorted alphabetically.
    Here are my questions:
    How does DIADEM import TDMS files?
    How gets every channel his number and groupindex?
    How can I determine which channel has which groupindex and number?
    Best regards
    Joerg

    Hi Jörg,
    i suppose that you´re programme whose create the *.tdms file is writing on false position. Try to create datas with timechannel on first indes in diadem, then save it and then open it again. you see that all is correct. So please tell me what programm in what version do you use and please attache it here.
    Did you use the library for creating *.tdms files like in the link ?
    http://zone.ni.com/devzone/cda/tut/p/id/6471
    Here you find the gtdms_8.x.zip - when you extract it and opened the *.llb you find vi´s for all functions e.g. writing 2d array of strings to *.tdms file
    when you open the subvi´s then you see how created and writing datas/structure to *.tdms files. Because *.tdms is binary you can´t see structure with open it in editor.
    When you don´t have Labview you can use the 30 days test of current version 8.5 under following link
    german version download link
    https://lumen.ni.com/nicif/d/lveval/content.xhtml
    english version download link
    https://lumen.ni.com/nicif/us/lveval/content.xhtml
    Hope it helps
    Best Regards

  • How does Airplay transfer audio file format to an Airport Express?

    Hi, everyone
    How does Airplay transfer audio file format to an Airport Express?
    Many from the Internet claim that iTunes encodes an AIFF file format into an Apple Lossless Audio Codec (ALAC) file format before sending signal to an Airport Express.
    Is that true?
    If so, would it still make sense for me to have AIFF files on my music server
    or should I have ALAC files instead?
    Please advise.
    Thank you.
    BR,
    George Lien

    Many from the Internet claim that iTunes encodes an AIFF file format into an Apple Lossless Audio Codec (ALAC) file format before sending signal to an Airport Express.
    Is that true?
    Yes. The AirPort Express Base Station (AX) works only with iTunes v4.6+ and is limited to music files that iTunes can read; ie, 16-bit data only. These data, though, can be in any file format that iTunes recognizes, from lossy MP3s at the low-quality end of the spectrum to Apple Lossless and lossless AIFF or WAV files at the high end. It is also important to note that the AX functions only at a 44.1kHz sample rate. When you play 32kHz or 48kHz data, iTunes sample-rate-converts the data in real time before sending it to the AX.
    iTunes uses a QuickTime CODEC to convert audio files to Apple Lossless, and then, uses AirPlay to send them to the AX. In turn, the AX uses built-in software that converts the Apple Lossless to an Encoded Digital Audio format. From there, digital audio is sent to a optical transceiver to convert the electrical signal to an optical one before sending it to the innermost part of the audio port. For analog, the AX has a built-in DAC to convert the Encoded Digital Audio to Analog which is sent to the same audio port.
    If so, would it still make sense for me to have AIFF files on my music server
    or should I have ALAC files instead?
    If you have audio files in both formats, I would elect just to keep the ALAC (.m4a) files on the music server.

  • How does Fetch Rx Data works?

    Dear Sir or Madam,
    I have a problem when I am implementing MAC protocols by using LabVIEW and USRP2. Actually there are two problem, I will show them in a simple CSMA protocol.
    The first design is that in CSMA protocol, node 1 sent a data packet to node 2, and node 2 received the packet, analyzed it, and sent back a corresponding ACK. The problem is, node 2 need to switch between receiving mode (to receive the packet) and transmitting mode (to sent ACK back), and the switching time is non-neglectable (around 7 to 10 ms). That delay significantly decreases system performance. Is that any way to reduce the switching time?
    The second problem is rising after the first one. To overcome the time delay, I use two antennas in the system, therefore one can always work in Tx mode and another in Rx mode therefore no switching is needed. The block diagram is simplified as figure (if transmitter mode is set to false, then the receiving VI works by using another antenna).
    The problem is, since we are using if structure, there is noway that transmitting and receiving can work concurrently. However, nodes always receive the signal it sent in the last while loop round. For example, after receiving a DATA packet from another node, this node sends a ACK back, and then the transmitter mode are switching to false then I can receive next packet. However, after sending the ACK, and switching to reception mode, I can receive the ACK I sent myself! That is my question, how does fetch Rx Data VI works?
    Thank you very much!

    Hi HustLiliAn,
    Thank you very much for you quick reply. I have to say sorry that my code is only partially belonging to me so I cannot distribute all of them, beg your understanding
    To overcome the delay, I open both Tx and Rx session at the beginning of the code so I don't need to initial and abort session before and after using respectively. It could save a lot of time (I measure the same delay as you shown). I read from WBX application notes (http://files.ettus.com/uhd_docs/manual/html/dboards.html) that if the system is working in the duplex mode, then antenna TX/RX is using for transmission and RX2 is using for reception. I simply tested it and it seems true.
    Since two antennas are working concurrently, the receiving antenna (RX2) can receive packet even it is sent by TX/RX. My problem is, in software level I have used the if structure to make transmission and reception work successively, RX2 can still receive signal sent by TX/RX. That is the real problem. Probably we can write some compensation VI which we can remove it by using the transmitted signal, but I still want to know is there any official solution for it.
    BTW, I use the modulation toolkit. Its demodulation VI is also quite slow.
    Thank you for your reading. I am not a native English speaker, so if my post make you confuse, please let me know and I would like to elaborate it again.

Maybe you are looking for