Re: file uploading
Hi Peter, Thanks! Just wondering what this background process you speak of would be... and how I would run it... would it be a piece of java code and if so, where would I place it within Tomcat for execution? Thanks, Kay - Original Message - From: Peter Johnson [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, April 02, 2004 12:08 AM Subject: Re: file uploading Always the way, you think of something else just as you hit send. The other option would be to have a background process which checks the upload directory and then moves the files as appropriate. PJ On Fri, 2004-04-02 at 15:06, Peter Johnson wrote: Kay, I would have thought that you could use commons-fileupload to do this with a little form preprocessing to determine location. PJ On Fri, 2004-04-02 at 14:49, Kayley Ma wrote: Hi, Is it possible to copy/move uploaded files in Tomcat5 to different directories on the machine outside of the Tomcat folder? ie rather than a static transfer of uploaded file from tomcat to another directory, copy/move file to its proper subdirectory depending on the uploaded file names/type? Where would I place this code or is there an xml file that I would need to configure/modify? Thanks! Kay This mail sent through www.mywaterloo.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file uploading
What's a cron job?? How do I create/execute one? thanks! ~Kayley~ - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, April 02, 2004 10:01 AM Subject: RE: file uploading Hi, Just wondering what this background process you speak of would be... and how I would run it... would it be a piece of java code and if so, where would I place it within Tomcat for execution? Not necessarily within tomcat: you can write a simple java class and execute it as a cron job. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This mail sent through www.mywaterloo.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file uploading
Hi, What's your environment? OS version Windows 2000 Tomcat version Tomcat 5 JVM version j2sdk1.4.2_03 Thanks! - Original Message - From: [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, April 02, 2004 10:07 AM Subject: Re: file uploading What's a cron job?? How do I create/execute one? thanks! ~Kayley~ - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, April 02, 2004 10:01 AM Subject: RE: file uploading Hi, Just wondering what this background process you speak of would be... and how I would run it... would it be a piece of java code and if so, where would I place it within Tomcat for execution? Not necessarily within tomcat: you can write a simple java class and execute it as a cron job. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. This mail sent through www.mywaterloo.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
redirecting uploaded files in tomcat5
Hi, After I get files uploaded into the webapp folder of Tomcat5, how can I redirect them to be located/copied/moved OUTSIDE of the Tomcat folders? (and possibly send them to other machines) Thanks, Kay This mail sent through www.mywaterloo.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirecting uploaded files in tomcat5
Hi Tom, Thanks so much! Which existing file would I insert this code (or would I have to create a new file then place this file in some Tomcat subdirectory??) And are srcDir and dstDir arbitary folder names? Thanks so much - I'm a newbie with this. Kay ~Kayley~ - Original Message - From: Tom K [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Sent: Thursday, April 01, 2004 4:40 PM Subject: RE: redirecting uploaded files in tomcat5 Kay, What you need to do is copy or move the directories (on the same machine) e.g. /** * Copies all files under srcDir to dstDir, if dstDir does not exist, it * will be created. */ public void copyDirectory(File srcDir, File dstDir) throws IOException { if (srcDir.isDirectory()) { if (!dstDir.exists()) { dstDir.mkdir(); } String[] children = srcDir.list(); for (int i=0; ichildren.length; i++) { copyDirectory(new File(srcDir, children[i]), new File(dstDir, children[i])); } } else { copy(srcDir, dstDir); } } // Copies src file to dst file. // If the dst file does not exist, it is created void copy(File src, File dst) throws IOException { InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dst); // Transfer bytes from in to out byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) 0) { out.write(buf, 0, len); } in.close(); out.close(); } Now if you have to copy a file to another computer, take a look at using an ftp client and redirecting it (using a 'put') to another computer. You may even look at using a native method via jni for doing your file transfer. Have a look here: http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html Regards, Tom Kochanowicz Janitor II Nebraska Psychiatric Hospital -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 3:24 PM To: Tomcat Users List Subject: redirecting uploaded files in tomcat5 Hi, After I get files uploaded into the webapp folder of Tomcat5, how can I redirect them to be located/copied/moved OUTSIDE of the Tomcat folders? (and possibly send them to other machines) Thanks, Kay This mail sent through www.mywaterloo.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Deployment with JBuilder
I'm a newbie so I don't know ant at all is there a way i can do in from the automatic generate and build in JBuilder? thanks, ~Kayley~ - Original Message - From: LILES, DAVID (CONTRACTOR) [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Tuesday, March 23, 2004 9:01 AM Subject: RE: Tomcat Deployment with JBuilder Have you tried using Ant? That way you can build your web app the way you like... -Original Message- From: Kayley Ma [mailto:[EMAIL PROTECTED] Sent: Monday, March 22, 2004 10:51 PM To: Tomcat Users List Subject: Tomcat Deployment with JBuilder Hi, Just wondering if there are any tips on using JBuilder to create a WebApplication which generates a WAR that can be deployed into Tomcat5 so that an application can be deployed. I think JBuilder organizes and creates a structure that is different than the specified structure for Tomcat5 deployment... when I try to manually include class files to the WEB-INF/classes folder, I notice that once I rebuild in JBuilder, the classes that I manually add in disappear... how can I modify the Jbuilder autoformat for a WebApplication compatible for Tomcat Deployment use? Thank you, Kayley - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This mail sent through www.mywaterloo.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Deployment Question
Hi Shapira, thanks so much for your help! right now, i've edited my web.xml file but my applet still can't make the connection to the servlet. 3 addition questions: 1. I would need to open an URL connection in my applet to the servlet... what URL would I give it? ie how do i make the connection from my applet to the servlet in my applet code. right now i have: URL servletURL = new URL(this.getDocumentBase(), WEB-INF/classes/webblowwebapp1/BlowDesignServlet); but i'm getting the error: java.io.FileNotFoundException: http://127.0.0.1:8080/WebBlow1/WEB-INF/classes/webblowwebapp1/BlowDesignServlet 2. u mentioned that i should put my servlet class files in the WEB-INF/classes... i built my WebApplication in JBuilder so it actually doesn't have this structure but rather C:\WebBlowWebApp1\classes\webblowwebapp1\servlet.class - is this ok or should i manually change the structure? (but then i notice that once my WAR file generated by JBuilder is put into tomcat/webapp, my class file is in WebBlow1(name of my application to be deployed)/WEB-INF/classes/webblowwebapp1(name of webApplication i built in jbuilder)/servletname. is this correct? 3. does this web.xml file look correct? --- ?xml version=1.0 encoding=UTF-8? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; web-app servlet servlet-nameblowdesignservlet/servlet-name servlet-classwebblowwebapp1.BlowDesignServlet/servlet-class /servlet servlet-mapping servlet-nameblowdesignservlet/servlet-name url-pattern/blowdesignservlet/url-pattern /servlet-mapping /web-app my servlet.java is located C:\WebBlowWebApp1\src\webblowwebapp1. thank you so very very much - i'm very new at this and i really appreciate the help! cheers, ~Kayley~ - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Monday, March 22, 2004 9:24 AM Subject: RE: Tomcat Deployment question Hi, The server doesn't need your .java files, only the compiled class files. You can put them in the WEB-INF/classes (as-is, .class files) or WEB-INF/lib (packaged in a jar file) directory of your webapp. You need to define and map your servlet in your WEB-INF/web.xml file. Yoav Shapira Millennium Research Informatics -Original Message- From: Kayley Ma [mailto:[EMAIL PROTECTED] Sent: Sunday, March 21, 2004 6:33 PM To: [EMAIL PROTECTED] Subject: Tomcat Deployment question Hi all, For a deployed WebApp with a applet and a servlet (I already generated a WAR in JBuilder), where should i put my servlet so that Tomcat knows where to find it? Current this is how my system is set up. Using JBuilder, I created a WebApplication where I direct the defaultroot folder to the location of my applet files. Then within my WebApplication, I created a servlet that the applet should communicate with. Then a WAR is generated when I build in JBuilder. I then deploy this WAR file into Tomcat5 using the TomcatManager. However, when I select the HTML file, I can see that my applet is running but it can't communicate with the servlet and I get a java error that saids filenotfound. So what is it that I'm doing wrong? Where should I put my servlet.java and servlet class so that Tomcat can find it? Thank you! Kay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This mail sent through www.mywaterloo.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Deployment Question
As u said, I changed my URL according to your advice but unfortunately, now there is another exception: java.io.EOFException... does this mean that my servlet file can be found now? Also, i now manually put my servlet class in: C:\WebBlowWebApp1\defaultroot\WEB-INF\classes\webblowwebapp1\BlowDesignServl et but i wonder if the servlet class should fall DIRECTLY into the classes folder rather than be in the webblowwebapp1 sub folder. when i rebuild to generate the WAR in JBuilder, it recognizes my manual changes to the structure, right? It's fine. Why are you using the 2.2 DTD? I donno what 2.2DTD is.. I just copied that off somewhere.. what should i be using instead? Thank you so VERY much! ~Kayley~ This mail sent through www.mywaterloo.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]