Update test file on web server

I have a web server that I need to update every so often. It's just a text file, and I'd like to be able to do it from a browser.
Each line in the file contains one word. I want to be able to add/delete/modify words(lines).
My questions are:
-Do I need to write a servlet to do this?
-I'm sure I can read the file and display it, but when I want to save it do I erase it and rewrite the whole thing, or is there a way to do an update?
Any suggestions are very appreciated.
Thanks,
James

consider maybe using a JMS and send the log entries as messages. JMS can be set to persists and handles updating from multiple sources (if this applies). something like MQSeries is very robust and reliable. You can of course also use JSD and javaspaces too and save on paying for MQ although the book by Asbury shows how to implement a JMS in pure java.

Similar Messages

  • How to delete a file on web server without using FTP

    Hi All
    I hv given a facility to a site user to upload some files..
    And an interface to web administrator to view all the files..
    I want to know how can i write a code in JSP which allow the web administrator to delete any of that file which is not of his/her interest through provided interface only.
    OR
    Is it possible to delete a particular file from web server without getting login into FTP account
    Thanx

    new File(strFileName).remove;
    Simply as this.
    Don't forget to import java.io.FileInputStream.

  • Help Setting Up File and Web Server in OS 8.6

    I have an OS 8.6 400mhz G3 B&W with 512mb RAM and an 80GB HD. It has the OEM operating system which is 8 on it. First I can't access the computer via afp from a Leopard Machine (Yes appletalk is enabled.). It gives me the error -36. Which is "The Finder can not complete the operation because some data in _____________ could not be read or written. I need this computer for a File and Web server. How could I make it accessible via AFP and FTP? I thought about linux but it requires a terminal like interface and I don't like that.

    To begin with, have a look at the IV. Troubleshooting section of KB article 106461:
    "Mac OS X 10.4 and later don't support Personal File Sharing (or other AFP) over Appletalk, though by initiating the connection from the opposite direction you could still achieve an IP connection from a Mac OS 8 computer to a sharing Mac OS X computer."
    Regarding servers: There is a built-in web server in Mac OS 8.6 (see the help system for details). Alternatively, the (now) free NetPresenz could perhaps be of interest.
    Jan

  • Error: java.lang.OutOfMemoryError when uploading CSV files to web server

    Hi experts,
    I have made a JSP page from which clients load csv files to web server. I am using Tomca 4.1 as my web server and JDK 1.3.1_09.
    The system works fine when uploadiing small csv files, but it crashes when uploading large CSV files.
    It gives me the following error:
    java.lang.OutOfMemoryError
         <<no stack trace available>>
    This is the code that I used to load files....
    <%
    String saveFile = "";
    String contentType = request.getContentType();
    if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0))
         DataInputStream in = new DataInputStream(request.getInputStream());
         int formDataLength = request.getContentLength();
         byte dataBytes[] = new byte[formDataLength];
         int byteRead = 0;
         int totalBytesRead = 0;
         while (totalBytesRead < formDataLength)
              byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
              totalBytesRead += byteRead;
         String file = new String(dataBytes);
         saveFile = file.substring(file.indexOf("filename=\"") + 10);
         saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
         saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1,saveFile.indexOf("\""));
         int lastIndex = contentType.lastIndexOf("=");
         String boundary = contentType.substring(lastIndex + 1,contentType.length());
         int pos;
         pos = file.indexOf("filename=\"");
         pos = file.indexOf("\n", pos) + 1;
         pos = file.indexOf("\n", pos) + 1;
         pos = file.indexOf("\n", pos) + 1;
         int boundaryLocation = file.indexOf(boundary, pos) - 4;
         int startPos = ((file.substring(0, pos)).getBytes()).length;
         int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
         String folder = "f:/Program Files/Apache Group/Tomcat 4.1/webapps/broadcast/file/";
         //String folder = "10.28.12.58/bulksms/";
         FileOutputStream fileOut = new FileOutputStream(folder + saveFile);
         //out.print("Saved here: " + saveFile);
         //fileOut.write(dataBytes);
         fileOut.write(dataBytes, startPos, (endPos - startPos));
         fileOut.flush();
         fileOut.close();
         out.println("File loaded successfully");
    //f:/Program Files/Apache Group/Tomcat 4.1/webapps/sms/file/
    %>
    Please can anyone help me solve this problem for me...
    Thanx...
    Deepak

    I know it may be hard to throw away all this code, but consider using the jakarta fileupload component.
    I think it would simplify your code down to
    // Create a factory for disk-based file items
    FileItemFactory factory = new DiskFileItemFactory();
    // Create a new file upload handler
    ServletFileUpload upload = new ServletFileUpload(factory);
    // Parse the request
    List /* FileItem */ items = upload.parseRequest(request);
    // Process the uploaded items
    Iterator iter = items.iterator();
    while (iter.hasNext()) {
        FileItem item = (FileItem) iter.next();
        if (item.isFormField()) {
            processFormField(item);
        } else {
            // item is a file.  write it
            File saveFolder = application.getRealPath("/file");          
            File uploadedFile = new File(saveFolder, item.getName());
            item.write(uploadedFile);
    }Most of this code was hijacked from http://jakarta.apache.org/commons/fileupload/using.html
    Check it out. It will solve your memory problem by writing the file to disk temporarily if necessary.
    Cheers,
    evnafets

  • Applet can't read local file on web server, security issue!

    There is any way to read/write files of web server through the applet except the Signed Applet.
    If any idea the reply me soon.
    Thanks in advance

    Applets are downloaded from web servers and execute on the client machine.
    Therefore they have no access to the web server file system, signed or not.
    They could have access to the client file system (the machine where they run),
    but for security reasons only signed applets have this privilege.
    So to answer your question, you sign if you want to access client files.
    To access web server files, you don't need to sign the applet, but you need
    to provide some method of accessing files remotely, for instance:
    - Files published for the web can be read using HTTP
    - Files can be read or writen with the help of an FTP server on the same machine as the web server
    - A servlet running on the HTTP server can collaborate with your applet to exchange files

  • Help on using servlets to write files to web server

    Hi,
    I am chetan from India, I have developed the WebSite www.bhavishya.net. I am encountering a serious problem in writing into a text file. I am unable to configure the path of the text file. While on Linux i got it (path - "/home/bhavishya/ErrorLog.txt"). But now i am using Windows Environment. The code is as follows.
    public String ewrite(String str)
    String err = "File updated";
    try
    Date d = new Date();
    BufferedWriter bwout = null;
    // for Web Server
    try
    //BufferedWriter out = new BufferedWriter(new FileWriter("/home/bhavishya/ErrorLog.txt", true)); // For Linux
    bwout = new BufferedWriter(new FileWriter("./bhavishya/logs/ErrorLog.txt", true));
    bwout.write(d.toLocaleString()+" : "+str+"\n");
    catch (RuntimeException e1) {err = e1.toString(); e1.printStackTrace();}
    System.out.println("ErrorLog - 21");
    bwout.close();
    catch (IOException e) { System.out.println(e); }
    return err;
    The file is neither created or written into even if i am creating it.
    Regards,

    Does the path to the file exist? Otherwise you should try adding a File.mkdirs() call in there to create the directory where you want to write the logfile to. Otherwise writing the file will fail.

  • How to Download a file from web server using servlets

    how do we download a file from Java Web Server connecting to oracle database
    it should start as soon a i click a button in my html browser
    please reply as it is needed to complete my project to submited to the collage

    With SQLJ you can do it.
    When you look at:
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/basic/basic.htm
    or
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.htm
    There are samples for reading LONGRAW / BLOB from Database. If you want use it in servlet you have to pass the result to the responce object, set the correct mime-type and set the response.setContentLength( xx). This is for some PlugIns nessessary (pdf).
    regards Dietmar

  • Publishing .shtml files to web server

    Hi,
    I am evaluating CQ5 to manage my web application having .html and .shtml pages (pages with SSIs, server side includes). I want to manage the web content - htmls, .shtmls, images etc using CQ5.
    I have following questions -
    1. Does CQ5 have any restrictions in publishing pages with extension .shtml?
    2. What are the best ways to manage these .shtml in CQ5?
    3. How do I publish these .shtmls to web server?
    Regards,
    vkp

    As a general rule anything you manage in CQ gets published to the web server via the Dispatcher plugin. Dispatcher functions as a reverse proxy sending request back to the publish servers and caching the result.
    As far as managing the .shtml items I am assuming that you want them to be generated and managed as pages in CQ with traditional component authoring interfaces. You will have two big challenges in this scenario:
    Sling request handling - Sling uses the extension to map a request to script. By default sling would consider .shtml to be different than .html and you'd need to name your JSPs appropariately. This could be problematic if you are reusing components across both page types. I have never tried this, but you could consider using the Sling Default Get servlet's alias configuration to map .shtml to .html which might work, but I have never actually done that.
    Link rewriting - you are going to have to write a layer of code that you use in your components to properly set the right extensions on the URLs when linking to these .shtml pages. By default CQ is just going to add .html. You will need to make sure you have some sort of way to tell in the page's meta-data whether or not it's an .shtml - perhaps based on template and then make sure you take that into account when writing out links. The rich text editor will be a challenge because adds the .html in JavaScript and stores it in the repository. You will have to override this in someway if you want to link to these .shtml pages in a rich text editor.
    In the past when I have needed to leverage SSIs through CQ I have just configured Apache to do do the SSI processing on .html to avoid these challenges. It means a heavier load on the web tier and it has some potential issues but generally is a better option than trying to get CQ to handle the .shtml extension.
    Also the other thing to consider is whether or not you really need .shtml files since CQ is pretty dynamic - usually you can figure out how to handle the dynamic assembly in CQ and not at the web tier (or using AJAX).
    Or did I misunderstand your plan - are you managing these as files in the DAM. If you are managing them as files in the DAM then you just have to make sure that you have a rendering servlet that will set the right mimetype.

  • Accessing JNDI fscontext provider .bindings file via Web Server

    The filesystem context provider produces a .bindings file. I've been referencing this over a web server with a URL of the form "file://<host><path>/.bindings".
    This works find with IIS. With Netscape Enterprise Web Server it won't show files with a name starting with a period (.).
    How can I make the fscontext .bindings file visible over a web server?

    Look for a configuration option regarding "hidden files". On UNIX, files beginning with a '.' are considered 'hidden', so I would guess they use that terminology.
    Good luck,
    -Derek

  • Displaying AVI Files through web server

    I am using Labview & Vision assistant to analyze an avi file
    The file is compressed and is 207KB and 5 secs long
    When using web publishing wizard and running the web server i cannot see the video footage on a remote machine over the internet, other data such as a graph however displays fine on the remote machine.
    I am using the university internet connection which should be easily fast enough for the data, the connection is at least a T3.

    The remote computer may need to have the IMAQ drivers installed on it.
    Prakash K

  • Settings for jnlp files in Web Server 6.0

    What it should be in the classpath to make IPlanet Web Server 6.0 work with jnlp files? MIME type for jnlp has been set, but IPlanet just displays jnlp as an xml file on the client machine. Client machine has WebStart installed, and everything works with Tomcat web server.

    Hello, I am having the same problem, a lot later. Did you ever solve this issue? I set the mime.types file, but when I add a path to the web-apps.xml file, it no longer will load jnlp files in the browser, it just displays the text.
    I tried setting mime-mapping in the web.xml, but it has not effect in iPlanet, but works in Tomcat. Any one have ideas?

  • Dynamic update of pdf files on web server with xml

    Hi forum
    Is it possible, to make a pdf form quiz, on a web site, there are updating it contents every day just bye replacing a xml file there have the text for the questions.?
    I just need some guindes or ide how to make this. ( i am new in xml/ dynamic pdf files)
    And do i need a LiveCycle form server to to this ?
    Regards
    Th

    Hi there
    I will like to get a mail (xml is fine ) but with the selections the user select in my pdf file.  ( They can select 1 to 3 inside the drop down list )
    Now when i try i only get the source xml, there is used to create the questions.
    I can't see the selection from the user of the form
    like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <Quizes Name="Game1" Id="1000">
    - <Quiz QuestionNumber="1">
    <Question>Will you use this forum ?</Question>
    - <Values NoOfValues="5">
    <Value>1</Value>
    <Value>2</Value>
    <Value>3</Value>
    <Value>4</Value>
    <Value>5</Value>
    </Values>
    </Quiz>
    - <Quiz QuestionNumber="2">
    <Question>Are you a designer ?</Question>
    - <Values NoOfValues="2">
    <Value>Yes</Value>
    <Value>No</Value>
    </Values>
    </Quiz>
    - <Quiz QuestionNumber="3">
    <Question>Dette er en test ?</Question>
    - <Values NoOfValues="2">
    <Value>Ja</Value>
    <Value>Nej</Value>
    </Values>
    </Quiz>
    </Quizes>
    I have try to set the databinding but it will not work for me.
    So if you can guide me where change or set the parameters in the Quiz pdf i hope i can see the way it has to be done.
    Regards
    TH

  • How to update image files in web pages generated by servlet without redeploying

    HI,
    I have a servlet which generates html pages with images. Those images changes
    as they are graph generated regularly. They are placed in s directory where the
    application is deployed. It is necessary because I have made some security constraints
    for the location of those files. However it seems that when I deploy my application
    on WLS all files contained in the application directory are cached, and when for
    ex. I delete some of them they are still appear in generated html pages. only
    Redeployment of application updates the state of those files.
    Is there a way to make the application to be aware of any changes in images files
    and to load updated ones??
    i would be interested in a situatioin like with default WLS servelt (DefaultWeb
    Application) where any new files are seen as soon as they are placed in Default
    WebApplication directory.
    Is there a way to periodically redeploy application from CLI?
    thx in advance
    Michal

    889096 wrote:
    Hello!
    In SQL Developer when we run htp package then we see the generated code in OWA Output, But how to invoke or show the webpage by Oracle tools/plsql program.
    and
    Without copying the code and save it to textfile.html and open it with browser.
    I heard it is possible by configuring Apache server.
    Please give me brief details, as i am beginner with ORACLE 10g
    And
    If you are using the htp package, you are presumably developing for an application server? Can the people who set that up not help you with your development environment?
    Setup is too complicated to cover here. Check out the Oracle HTTP Server documentation on oracle's documentation pages.
    Briefly, you need to install Oracle HTTP Server and then configure a data access desciptor to connect to your database.
    How to see the generated code in "QUEST TOAD"? I am not able to see OWA output in TOADYou will have to ask this question in a Toad forum.

  • Trying to access the java script files via jar file in WEB SERVER

    hi all,
    I am trying to access the java script files via jar file ,which is present in Apache webserver in order to minimise the number of hits to app server.some thing like cache ...
    in jsp the code goes like this...
         <script type="text/javascript"  archive="http://localhost:14000/dojo.jar!" src="dojo.jar/parser.js" " ></script>{code}
    But i am not able to access the js file which is put in jar file present in the  webserver.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi,
    You can use DWR (Direct Web remoting) for that. It is easy AJAX for java. ou can directly call the java script function from java class and also java class from javaScripts..
    Regards,
    Hardik

  • By default where does report write output files on web server

    I am running forms and reports over web. I am running a form which on the click of a button runs a report. Using the
    Orarrp utility (I already have) I want to print this report.
    In my form trigger I am using the run_report_object and I set report parameters DESTYPE to File, and I set
    DESNAME giving it a file name. When report finishes, I use Show_Document('http://server:domain/filename.ext','_blank'),
    it returns the 404 error, The requested URL /receipt.rrpa was not found on this server.
    Can anyone tell me, by default where the server writes the file output? I have checked under
    $ORACLE_HOME/reports60/server/cache but did not find my output file.
    Is there a way to specifically direct the output file to a directory, and have the reports server recognize the path?
    Perhaps using some sort of 'Virtual Path' in the server configuration, but where?
    Any help is appreciated?
    Regards
    Mark

    Hi,
    destype file writes the file to wherever you send it to.
    destype=file desname = c:\temp\myRep.html
    creates the file myRep.html in the temp directory on the server. Destype 'cache' only writes to the Cache directory you mention. normally, if not giving any directory information, it's the working directory that the file gets created in. Do a seacrh for your file and I am sure that you'll find it.
    regards Frank

Maybe you are looking for

  • Internet Sharing with my Xbox 360

    Hey guys, I was just wondering how to get an open NAT with my PowerBook and xbox 360 setup. Right now my NAT is "strict". I've searched on the board and no one has a solution. I have a D-Link DI-524 wireless router and when I connect the xbox directl

  • Xen Xtra not being recognized. Mtp device keeps popping

    I just got a Zen Xtra 40gb from my friend cause he said it was having major problems connecting to the pc after he upgraded it to the new firmware. he had it for years. but he gave it to me after getting an iPod last week,?When i connect it to the pc

  • Imported SWF with custom mouse

    Hello all, I imported a swf animation ( Game), this swf uses a custom mouse. I guess they did a 'mouse.hide' in AS3. Is there any way i can reclame my original mouse after i leave the animation slide? Now when i leave the slide, my mouse stays hidden

  • Data import: MVAL or MKEY?

    Hi, I have the following data file: ENTITY;TIME;ACCOUNT;FLOW;DATASRC;INTCO;LC;TC;TRNCURR E.2000;2010.DEC;IC_SALES;F_CLO;INPUT;I.3000;100;150;T_USD E.2000 is a EUR entity, the intercompany transaction in question is denominated in USD. In my currency

  • A confusing query

    Hi All, will this query result give an info about why my profit period is different in the report between balance sheet and profit and loss: SELECT distinct case when T0.transtype = 60 then 'Goods Issue' when T0.transtype = 59 then 'Goods Receipt' wh