Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
Have u tried to use regex to filter URL ,use concurrent hash map and atomic int to count? 在 2012-8-27,13:30,"rathinasamy@snovabits.net" 写道: > Hi everyone, > > Please give me some ideas to achieve maxtry concept. > > I want to destroy the url path after some amount of access. > > For eg., if I give maxtry = 2 for the run time generated url > (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4), After the two times > access of the above url for the third time that url path will not be able to > access for anyone. > > _My environment is:_ > > Apache-tomcat-7.0.25* > *Windows 7 > 32 bit Operating system > > How to achieve this using apache filter? > > Thanks in advance, > Rathinasamy. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
Hi, Many thanks for your reply. I am asking something which should be done in apache tomcat configurations, Since I have not able to control that maxtry concept through my application (it is out of my app control) Through my app just generate a url to access a video file at run time, & may be the user can copy that url and paste it in outside browsers - here I have to control the usage of using my url which I have given to the user. That url is something looks like (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4) & it should accessed via apache tomcat, so I am asking here for anyway to expire the url path in apache tomcat using filters like: ExpiresByType image access plus 2 minutes But it expires image & after 2 minutes, I need to expires some url pattern after 2 access. Thank you again for spending your time in this. Regards, Rathinasamy. On 8/27/2012 12:34 PM, Joseph wrote: > Have u tried to use regex to filter URL ,use concurrent hash map and atomic > int to count? > > 在 2012-8-27,13:30,"rathinasamy@snovabits.net" > 写道: > >> Hi everyone, >> >> Please give me some ideas to achieve maxtry concept. >> >> I want to destroy the url path after some amount of access. >> >> For eg., if I give maxtry = 2 for the run time generated url >> (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4), After the two times >> access of the above url for the third time that url path will not be able to >> access for anyone. >> >> _My environment is:_ >> >> Apache-tomcat-7.0.25* >> *Windows 7 >> 32 bit Operating system >> >> How to achieve this using apache filter? >> >> Thanks in advance, >> Rathinasamy. > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
On 27/08/2012 08:17, rathinasamy@snovabits.net wrote: > Hi, > > Many thanks for your reply. > > I am asking something which should be done in apache tomcat configurations, > Since I have not able to control that maxtry concept through my application > (it is out of my app control) There's no Tomcat or Servlet config to do this. > Through my app just generate a url to access a video file at run time, & may > be the user can copy that url and paste it in outside browsers - here I have > to control > the usage of using my url which I have given to the user. If your app is generating the URL, why can't it also be responsible for removing it? > That url is something looks like > (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4) & it should accessed > via apache tomcat, so I am asking here for anyway to > expire the url path in apache tomcat using filters > > like: > > > ExpiresByType image > access plus 2 minutes > > > > But it expires image & after 2 minutes, I need to expires some url pattern > after 2 access. > > Thank you again for spending your time in this. Write a filter that blocks that URL after 3 accesses or 2 minutes (perhaps using the suggestion by Joseph). p > Regards, > Rathinasamy. > > > On 8/27/2012 12:34 PM, Joseph wrote: >> Have u tried to use regex to filter URL ,use concurrent hash map and atomic >> int to count? >> >> 在 2012-8-27,13:30,"rathinasamy@snovabits.net" >> 写道: >> >>> Hi everyone, >>> >>> Please give me some ideas to achieve maxtry concept. >>> >>> I want to destroy the url path after some amount of access. >>> >>> For eg., if I give maxtry = 2 for the run time generated url >>> (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4), After the two >>> times access of the above url for the third time that url path will not be >>> able to access for anyone. >>> >>> _My environment is:_ >>> >>> Apache-tomcat-7.0.25* >>> *Windows 7 >>> 32 bit Operating system >>> >>> How to achieve this using apache filter? >>> >>> Thanks in advance, >>> Rathinasamy. >> - >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > -- [key:62590808] signature.asc Description: OpenPGP digital signature
RE: How-to-achieve-url-maxtry-filter-in-apache-tomcat
what is the amount of time the request connection will be alive for the first try? what is the mechanism used to uniquely identify the browser client maybe From? http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-Request-Headers.html In any case if the HTTP_FROM is the same as previous requests AND this is the second request what is amount of time the connection will be alive for second try why not set a timer on second access which notifies you after USER_CONFIGURABLE_TIMEFRAME set as PARAM_VALUE from your init_param? Martin __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Mon, 27 Aug 2012 12:47:26 +0530 > From: rathinasamy@snovabits.net > To: users@tomcat.apache.org > Subject: Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat > > Hi, > > Many thanks for your reply. > > I am asking something which should be done in apache tomcat configurations, > Since I have not able to control that maxtry concept through my application > (it is out of my app control) > > Through my app just generate a url to access a video file at run time, & may > be the user can copy that url and paste it in outside browsers - here I have > to control > the usage of using my url which I have given to the user. > > That url is something looks like > (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4) & it should accessed > via apache tomcat, so I am asking here for anyway to > expire the url path in apache tomcat using filters > > like: > > > ExpiresByType image > access plus 2 minutes > > > > But it expires image & after 2 minutes, I need to expires some url pattern > after 2 access. > > Thank you again for spending your time in this. > > Regards, > Rathinasamy. > > > On 8/27/2012 12:34 PM, Joseph wrote: > > Have u tried to use regex to filter URL ,use concurrent hash map and atomic > > int to count? > > > > 在 2012-8-27,13:30,"rathinasamy@snovabits.net" > > 写道: > > > >> Hi everyone, > >> > >> Please give me some ideas to achieve maxtry concept. > >> > >> I want to destroy the url path after some amount of access. > >> > >> For eg., if I give maxtry = 2 for the run time generated url > >> (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4), After the two > >> times access of the above url for the third time that url path will not be > >> able to access for anyone. > >> > >> _My environment is:_ > >> > >> Apache-tomcat-7.0.25* > >> *Windows 7 > >> 32 bit Operating system > >> > >> How to achieve this using apache filter? > >> > >> Thanks in advance, > >> Rathinasamy. > > - > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org >
Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
On 8/27/2012 2:17 AM, rathinasamy@snovabits.net wrote: Hi, Many thanks for your reply. I am asking something which should be done in apache tomcat configurations, Since I have not able to control that maxtry concept through my application (it is out of my app control) Through my app just generate a url to access a video file at run time, & may be the user can copy that url and paste it in outside browsers - here I have to control the usage of using my url which I have given to the user. That url is something looks like (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4) & it should accessed via apache tomcat, so I am asking here for anyway to expire the url path in apache tomcat using filters like: ExpiresByType image access plus 2 minutes But it expires image & after 2 minutes, I need to expires some url pattern after 2 access. Thank you again for spending your time in this. Regards, Rathinasamy. What happens if the download is interrupted? -Terence Bandoian - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
No It can't be responsible for removing the url, since the url path will not come through my application it is directly hitting the tomcat port. I deployed my application as a war file in server & through that app created a folder in: tomcat_server_home/webapps/root/club/dely/ios/.. So how can I control it through app, My app's work is to generate a folder like structure in tomcat home path & build the url & return the url to user. On 8/27/2012 6:38 PM, Pid wrote: On 27/08/2012 08:17, rathinasamy@snovabits.net wrote: Hi, Many thanks for your reply. I am asking something which should be done in apache tomcat configurations, Since I have not able to control that maxtry concept through my application (it is out of my app control) There's no Tomcat or Servlet config to do this. Through my app just generate a url to access a video file at run time, & may be the user can copy that url and paste it in outside browsers - here I have to control the usage of using my url which I have given to the user. If your app is generating the URL, why can't it also be responsible for removing it? That url is something looks like (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4) & it should accessed via apache tomcat, so I am asking here for anyway to expire the url path in apache tomcat using filters like: ExpiresByType image access plus 2 minutes But it expires image & after 2 minutes, I need to expires some url pattern after 2 access. Thank you again for spending your time in this. Write a filter that blocks that URL after 3 accesses or 2 minutes (perhaps using the suggestion by Joseph). p Regards, Rathinasamy. On 8/27/2012 12:34 PM, Joseph wrote: Have u tried to use regex to filter URL ,use concurrent hash map and atomic int to count? 在 2012-8-27,13:30,"rathinasamy@snovabits.net" 写道: Hi everyone, Please give me some ideas to achieve maxtry concept. I want to destroy the url path after some amount of access. For eg., if I give maxtry = 2 for the run time generated url (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4), After the two times access of the above url for the third time that url path will not be able to access for anyone. _My environment is:_ Apache-tomcat-7.0.25* *Windows 7 32 bit Operating system How to achieve this using apache filter? Thanks in advance, Rathinasamy. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
No, not bothering about the interuption. As of now if an order comes generate an url and return back with a maximum try for 2 times and time to live for 15 minutes. On 8/27/2012 11:04 PM, Terence M. Bandoian wrote: On 8/27/2012 2:17 AM, rathinasamy@snovabits.net wrote: Hi, Many thanks for your reply. I am asking something which should be done in apache tomcat configurations, Since I have not able to control that maxtry concept through my application (it is out of my app control) Through my app just generate a url to access a video file at run time, & may be the user can copy that url and paste it in outside browsers - here I have to control the usage of using my url which I have given to the user. That url is something looks like (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4) & it should accessed via apache tomcat, so I am asking here for anyway to expire the url path in apache tomcat using filters like: ExpiresByType image access plus 2 minutes But it expires image & after 2 minutes, I need to expires some url pattern after 2 access. Thank you again for spending your time in this. Regards, Rathinasamy. What happens if the download is interrupted? -Terence Bandoian - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
rathinasamy@snovabits.net wrote: No, not bothering about the interuption. As of now if an order comes generate an url and return back with a maximum try for 2 times and time to live for 15 minutes. Let`s restart this from the beginning. 1) Unless you have a specific webapp and a specific servlet configured to serve these URLs, Tomcat is going to serve them with its default webapp and default servlet, whose purpose is to serve static files stored in the filesystem. This default webapp/servlet does not count the number of times the file has been served, nor take into account the age of the file etc.. 2) if you want a different behaviour for those static files, you can either a) add a filter to the default webapp, so that before letting the default servlet return a static file, it will take into account some kind of counter or timer, and take some action based on that (return a "not found" response, delete the file, whatever), before the default servlet runs and returns the file or b) create your own webapp/servlet that will return these files (or not) depending on your criteria. And then map this webapp/servlet to the appropriate URL sub-space (where your files are created to be downloaded). Either way, there is no standard (Tomcat-included) servlet or servlet filter that does this, so you will have to write your own code. Is that part clear ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
Thank you very much André Warnier for your time. Here I would like to use default webapp/servlet. - add a filter to the default webapp, so that before letting the default servlet return a static file, it will take into account some kind of counter Can you give me some examples for how to add a filter in default webapp so that the default servlet will take a count every time when a click for the url? On 8/28/2012 12:37 PM, André Warnier wrote: rathinasamy@snovabits.net wrote: No, not bothering about the interuption. As of now if an order comes generate an url and return back with a maximum try for 2 times and time to live for 15 minutes. Let`s restart this from the beginning. 1) Unless you have a specific webapp and a specific servlet configured to serve these URLs, Tomcat is going to serve them with its default webapp and default servlet, whose purpose is to serve static files stored in the filesystem. This default webapp/servlet does not count the number of times the file has been served, nor take into account the age of the file etc.. 2) if you want a different behaviour for those static files, you can either a) add a filter to the default webapp, so that before letting the default servlet return a static file, it will take into account some kind of counter or timer, and take some action based on that (return a "not found" response, delete the file, whatever), before the default servlet runs and returns the file or b) create your own webapp/servlet that will return these files (or not) depending on your criteria. And then map this webapp/servlet to the appropriate URL sub-space (where your files are created to be downloaded). Either way, there is no standard (Tomcat-included) servlet or servlet filter that does this, so you will have to write your own code. Is that part clear ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
Really sorry, missed the last line... On 8/28/2012 12:48 PM, rathinasamy@snovabits.net wrote: Thank you very much André Warnier for your time. Here I would like to use default webapp/servlet. - add a filter to the default webapp, so that before letting the default servlet return a static file, it will take into account some kind of counter Can you give me some examples for how to add a filter in default webapp so that the default servlet will take a count every time when a click for the url? On 8/28/2012 12:37 PM, André Warnier wrote: rathinasamy@snovabits.net wrote: No, not bothering about the interuption. As of now if an order comes generate an url and return back with a maximum try for 2 times and time to live for 15 minutes. Let`s restart this from the beginning. 1) Unless you have a specific webapp and a specific servlet configured to serve these URLs, Tomcat is going to serve them with its default webapp and default servlet, whose purpose is to serve static files stored in the filesystem. This default webapp/servlet does not count the number of times the file has been served, nor take into account the age of the file etc.. 2) if you want a different behaviour for those static files, you can either a) add a filter to the default webapp, so that before letting the default servlet return a static file, it will take into account some kind of counter or timer, and take some action based on that (return a "not found" response, delete the file, whatever), before the default servlet runs and returns the file or b) create your own webapp/servlet that will return these files (or not) depending on your criteria. And then map this webapp/servlet to the appropriate URL sub-space (where your files are created to be downloaded). Either way, there is no standard (Tomcat-included) servlet or servlet filter that does this, so you will have to write your own code. Is that part clear ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
On 28 Aug 2012, at 05:00, "rathinasamy@snovabits.net" wrote: > No It can't be responsible for removing the url, since the url path will > not come through my application it is directly hitting the tomcat port. That makes no sense. If it's your app then you can intercept it and do as you please. > I deployed my application as a war file in server & through that app > created a folder in: > > tomcat_server_home/webapps/root/club/dely/ios/.. Do you mean root or ROOT? > So how can I control it through app, My app's work is to generate a > folder like structure in tomcat home path & build the url & return the > url to user. By adding a Servlet Filter with a path that maps to the same URL space as the resource URLs. If the Filter has access to the URL and counter, again as previously described, then it can pass requests through transparently, increment the counter and then refuse access by returning a 404 instead of a response after the expiry time or counter is exceeded. Look at the Tomcat examples and read the Servlet Spec - don't just rely on Google and people on the list doing your work for you if you want to understand this. p > On 8/27/2012 6:38 PM, Pid wrote: >> On 27/08/2012 08:17, rathinasamy@snovabits.net wrote: >>> Hi, >>> >>> Many thanks for your reply. >>> >>> I am asking something which should be done in apache tomcat configurations, >>> Since I have not able to control that maxtry concept through my application >>> (it is out of my app control) >> There's no Tomcat or Servlet config to do this. >> >>> Through my app just generate a url to access a video file at run time, & >>> may be the user can copy that url and paste it in outside browsers - here I >>> have to control >>> the usage of using my url which I have given to the user. >> If your app is generating the URL, why can't it also be responsible for >> removing it? >> >>> That url is something looks like >>> (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4) & it should >>> accessed via apache tomcat, so I am asking here for anyway to >>> expire the url path in apache tomcat using filters >>> >>> like: >>> >>> >>> ExpiresByType image >>> access plus 2 minutes >>> >>> >>> >>> But it expires image & after 2 minutes, I need to expires some url pattern >>> after 2 access. >>> >>> Thank you again for spending your time in this. >> Write a filter that blocks that URL after 3 accesses or 2 minutes >> (perhaps using the suggestion by Joseph). >> >> >> p >> >> >>> Regards, >>> Rathinasamy. >>> >>> >>> On 8/27/2012 12:34 PM, Joseph wrote: Have u tried to use regex to filter URL ,use concurrent hash map and atomic int to count? 在 2012-8-27,13:30,"rathinasamy@snovabits.net" 写道: > Hi everyone, > > Please give me some ideas to achieve maxtry concept. > > I want to destroy the url path after some amount of access. > > For eg., if I give maxtry = 2 for the run time generated url > (http://localhost:8080/Club/dely/ios/item/42/23/cc.mp4), After the two > times access of the above url for the third time that url path will not > be able to access for anyone. > > _My environment is:_ > > Apache-tomcat-7.0.25* > *Windows 7 > 32 bit Operating system > > How to achieve this using apache filter? > > Thanks in advance, > Rathinasamy. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>> For additional commands, e-mail: users-h...@tomcat.apache.org >>> >> > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How-to-achieve-url-maxtry-filter-in-apache-tomcat
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/28/12 3:18 AM, rathinasamy@snovabits.net wrote: > Thank you very much André Warnier for your time. > > Here I would like to use default webapp/servlet. - From reading many many posts to this list, modifying the file system out from under the DefaultServlet tends to cause all kinds of chaos. You are going to be creating new files (which may lead to 404s if the DefaultServlet thinks they don't exist) and removing files (which may invalidate DefaultServlet's cache). I would highly recommend that you write your own servlet that does everything, here. > - add a filter to the default webapp, so that before letting the > default servlet return a static file, it will take into account > some kind of counter Can you give me some examples for how to add a > filter in default webapp so that the default servlet will take a > count every time when a click for the url? You can't count clicks: you can only count requests for a particular resource. You will have to write your own code. Attaching a filter to a URL pattern is trivial: Google for it if you want to know how to configure it. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlA9IykACgkQ9CaO5/Lv0PBnJgCfUzJmtJT+dsA1Oj2p8O5i3MgX KdkAoMIXu0eoZy18DU6Y53RkUPYIZlZI =fzkW -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org