Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1251C9764 for ; Sat, 7 Apr 2012 16:11:26 +0000 (UTC) Received: (qmail 7944 invoked by uid 500); 7 Apr 2012 16:11:22 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 7877 invoked by uid 500); 7 Apr 2012 16:11:22 -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 7867 invoked by uid 99); 7 Apr 2012 16:11:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Apr 2012 16:11:22 +0000 X-ASF-Spam-Status: No, hits=2.8 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URIBL_BLACK X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of knst.kolinko@gmail.com designates 209.85.161.173 as permitted sender) Received: from [209.85.161.173] (HELO mail-gx0-f173.google.com) (209.85.161.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Apr 2012 16:11:15 +0000 Received: by ggnp2 with SMTP id p2so1868618ggn.18 for ; Sat, 07 Apr 2012 09:10:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=/SLZU+O/mkgOqbRnL1yYMxoHr6jImBPE59yRGFf7FVc=; b=QuCcwWSE8dDejb2DmGn1MHZTj2bVczEsCC9AI2dPt9cnTt3bhEYnxpsRJqtXeApoUp mKoBXNO/c1vtNbd2Pzy9o/Rxip+f/RJJVT6JMtX17jTPyXsExE4ocPr7jFgRqE+wA/lF Ja50i9cG+OY+TV5zXE8qhOwiqmW6qmu4on/QlyhYprDy+x7c/1LYlsjA46ml3ernNaur FDifmH43HwSxhCzN8R35g4vMkIfgFWgelFQrkXXcPqT/5pCX4qhKR+XfT/tt9oRWX21A XGeQjEjU3Do14tPwOBMoM56wweYslaXEoaFC+vvJ1HQereWedjMXVgJ98dVfInoSbhXC xmxg== MIME-Version: 1.0 Received: by 10.236.193.41 with SMTP id j29mr1393534yhn.14.1333815054697; Sat, 07 Apr 2012 09:10:54 -0700 (PDT) Received: by 10.146.204.18 with HTTP; Sat, 7 Apr 2012 09:10:54 -0700 (PDT) In-Reply-To: <85DA62F108ABD4439B9B6A3AB2B2880F01F62915@BLR-EC-MBX5.wipro.com> References: <85DA62F108ABD4439B9B6A3AB2B2880F01F613A7@BLR-EC-MBX5.wipro.com> <4F7F0E83.8080601@christopherschultz.net> <85DA62F108ABD4439B9B6A3AB2B2880F01F62915@BLR-EC-MBX5.wipro.com> Date: Sat, 7 Apr 2012 20:10:54 +0400 Message-ID: Subject: Re: Accessing USB drive content from pages served from tomcat6 server From: Konstantin Kolinko To: Tomcat Users List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2012/4/7 : > Hello Chris, > > Thanks a lot for responding to my post. > > [Chris]What do you mean "not able to access its content"? Do you get 404s= ? > 500s? Does the thread hang? Does the JVM crash? > > [Souvik]: When I am trying to access the content of usb_1, I am getting 4= 04 error. > Here are the details: > HTTP Status 404 > message < This is blank> > description The requested resource () is not available. > > [Souvik] > > [Chris]Q:What about starting Tomcat with no USB devices, then trying to a= ccess the resources, then attaching the devices and trying again? > Ans: Only usb_0 works. > > [Chris]Q:What happens when both devices are connected *before* you start = Tomcat? > Ans: Only in this case I could access both the devices. > > [Chris] Honestly, I'm not sure why you'd want to run a web server off a d= evice > which isn't guaranteed to be available. > > [Souvik] Actually I am developing a HTML5 App which would run on an embed= ded target. One of the functionalities of the application is to allow user = to playback and browse the media content available in an USB stick. Since I= am using Webkit browser so some features of HTML5 do not run from file:// = url and therefore the pages need to be served from a local web server. I ha= ve chosen tomcat for that. > > So it seems to achieve my goal, I need to first connect usb sticks to all= the available usb ports on my target and then start tomcat6. As mentioned = by you,is the server keeping this information in the cache so that in futur= e when a USB device is connected to a port, it is able to make that out? > Is this understanding correct? 1. You are (ab)using Tomcat Autodeployment feature. If docbase of a webapp is not readable, it really cannot start. (Just a guess. If you looked at the logs your would see it more clearly). 2. It is possible to control deployment process via JMX. That is to deploy new contexts when needed - the Manager webapp does that. But I think that using contexts to display those USB sticks is not a good thing. One thing to beware is that when application is undeployed all its contents is deleted (so you risk to delete all data from that USB stick). I think it would be better to write a servlet that will serve static files from the stick. It should not be hard. It might be based on Tomcat's DefaultServlet, but actually yours can be more simple: 1. You do not need to use servlet API to get the resources. You have to use direct file access using java.io. 2. Your access is read-only. You do not need to support writing. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org