From users-return-207665-apmail-tomcat-users-archive=tomcat.apache.org@tomcat.apache.org Mon Feb 01 02:22:45 2010 Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 30582 invoked from network); 1 Feb 2010 02:22:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Feb 2010 02:22:44 -0000 Received: (qmail 86361 invoked by uid 500); 1 Feb 2010 02:22:41 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 86269 invoked by uid 500); 1 Feb 2010 02:22:40 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 86258 invoked by uid 99); 1 Feb 2010 02:22:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Feb 2010 02:22:40 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Feb 2010 02:22:32 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1NblvX-00012D-Er for users@tomcat.apache.org; Sun, 31 Jan 2010 18:22:11 -0800 Message-ID: <27398914.post@talk.nabble.com> Date: Sun, 31 Jan 2010 18:22:11 -0800 (PST) From: hbral To: users@tomcat.apache.org Subject: RE: can't call my servlet on Tomcat 6 (Error 404) In-Reply-To: <99C8B2929B39C24493377AC7A121E21F96C3EADAC9@USEA-EXCH8.na.uis.unisys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: nrolle@web.de References: <27397388.post@talk.nabble.com> <4B660B51.9020508@cornell.edu> <27397698.post@talk.nabble.com> <427155181001311559y517e8161i2244797639c077ad@mail.gmail.com> <27398666.post@talk.nabble.com> <99C8B2929B39C24493377AC7A121E21F96C3EADAC9@USEA-EXCH8.na.uis.unisys.com> n828cl wrote: > >> From: hbral [mailto:nrolle@web.de] >> Subject: Re: can't call my servlet on Tomcat 6 (Error 404) >> >> yes i called it that way. > > You seem reluctant to provide real data. Show us your web.xml, > server.xml, the webapp's element (if any), the location of the > .war file, and the actual URL. > >> it worked perfectly on my local testing environment with >> eclipse and gwt plugin. > > Note that Eclipse has a habit of using its own configurations for things, > rather than the ones you think you've set up. > > - Chuck > > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY > MATERIAL and is thus for use only by the intended recipient. If you > received this in error, please contact the sender and delete the e-mail > and its attachments from all computers. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > > i call: /download/file and i get the 404 error i don't have a server.xml or do you mean the tomcat server.xml? here it is: war file: download.war path: apache-tomcat-6.0.24\webapps\download web.xml: DLServlet com.example.server.FileServlet DLServlet /download/file Download.html my servlet: package com.example.server; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class FileServlet extends HttpServlet { private static final long serialVersionUID = -4356636877078339046L; byte[] bbuf = new byte[1024]; private static final String textFileName = "files/text.txt"; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String filename = textFileName; try { ServletOutputStream out = response.getOutputStream(); ServletContext context = getServletConfig().getServletContext(); File file = new File(context.getRealPath("") + "/" + filename); String mimetype = context.getMimeType(filename); response.setContentType((mimetype != null) ? mimetype : "application/octet-stream"); response.setContentLength((int) file.length()); response.setHeader("Content-Disposition", "attachement; filename=\"" + filename + "\""); DataInputStream in = new DataInputStream(new FileInputStream(file)); int length; while ((in != null) && ((length = in.read(bbuf)) != -1)) { out.write(bbuf, 0, length); } in.close(); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } } } -- View this message in context: http://old.nabble.com/can%27t-call-my-servlet-on-Tomcat-6-%28Error-404%29-tp27397388p27398914.html Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org