tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Filtering URL via tomcat
Date Mon, 27 Apr 2009 17:57:21 GMT

Ravi,

First :
 > so basically if i try to access any thing with
 > http://www.mysite.com/app/audio, it should be served from audio  dir in
 > webapps which in turn audio dir from appache httpd.
 >
 > But its not working. :(
 >
"its not working" is not something that allows anyone to help you.
HOW is it not working ? What do you do, what do you expect, and what are 
you getting as an error ?
That means :
- tell us what URL you are using in the browser
- what error do you see in the browser ?
- what error do you see in the Apache logfile ?
- and what error do you see in the Tomcat logfile ?

Then (old African proverb) : if you want to eat an elephant, you should 
do it a little bit at a time.

In other words, simplify the problem if you can.

Assuming that your Tomcat listens on port 8080 for example (you can see 
that in the conf/server.xml, <Connector> tags), try the following :
- turn off Apache httpd
- in the browser, enter the URL
http://www.mysiste.com:8080/app/audio/download/abc.html
(that goes to Tomcat directly, without going through Apache).
What happens then ?
Don't be afraid to add some details.



Ravi Sharma wrote:
> Hi All,
> Please help me for this problem, i am not able to get to the root of the
> problem.
> 
> My site have few open/free pages which can be accessed by anyone/guests and
> few only for registered users. So you can access those pages only by login
> to the site
> 
> http://www.mysiste.com/audio/abc.html (anyone/guests can see this page)
> http://www.mysiste.com/audio/app/download/abc.html (only logged in user can
> see this page)
> 
> I am using tomcat 5.5 and appache httpd server 2.2.
> 
> the root of my site reside in appache httpd server
> so i have folder structure like
> mysite/public_html/audio
> mysite/public_html/app/audio/download
> 
> in my httpd conf i have something like this
> JkMount /app/audio/download/* ajp13w
> ..
> ..
> ..
> and mysite.com is poiniting to mysite/public_html
> 
> 
> *app* is my tomcat application context
> 
> and in tomcat web.xml one Filter is listning to url
> <filter>
>         <filter-name>DownLoadSecurityFilter</filter-name>
>         <filter-class>com.app.security.SecurityFilter</filter-class>
>     </filter>
>     <filter-mapping>
>         <filter-name>DownLoadSecurityFilter</filter-name>
>         <url-pattern>/audio/download/*</url-pattern>
>     </filter-mapping>
> 
> So all the pages will be served by apache httpd except the pages which are
> like app/audio/download.
> 
> So now when somone try to access app/audio/download/some.html the request
> passed to tomcat, in turns filter check this url and if user is not logged
> in then login screen comes up.
> User login and proceed and login screen automcatically forward the request
> to the page which was requested app/audio/download/some.html, but here i get
> this tomcat error
> 
> *Type* Status report
> 
> *message* */app/audio/download/some.html*
> 
> *description* *The requested resource (/app/audio/download/some.html) is not
> available.*
> 
> these html pages are static pages and exists in apache http home dir of
> websites
> public_html/app/audio/download/some.html
> 
> but then i thought may be it need to exists in tomcat web apps too., so
> under web-apps/app dir i created audio link to audio directory under
> public_html
> 
> so now webapps dir has following link
> webapps/app/audio -> /home/mysite/public_html/audio
> 
> so basically if i try to access any thing with
> http://www.mysite.com/app/audio, it should be served from audio  dir in
> webapps which in turn audio dir from appache httpd.
> 
> But its not working. :(
> 
> I dont know whats wrong.
> 
> following is my java filter class
> 
>     public void doFilter(ServletRequest request, ServletResponse response,
>                          FilterChain chain)
>     throws IOException, ServletException {
>         try
>         {
>             checkSecurity(request);
>         }
>         catch(UserNotLoggedIn ex)
>         {
>             httpResponse.sendRedirect(httpRequest.getContextPath() +
> LOGINURL +"?URL=" + targetUrl);
>             return;
>         }
>         catch(OperationNotAllowedForUser ex)
>         {
>             httpResponse.sendRedirect(httpRequest.getContextPath() +
> DENIENDURL );
>             return;
>         }
>         chain.doFilter(request, response);
> 
>     doAfterProcessing(request, response);
> 
> }
> 
> 
>     private void doAfterProcessing(ServletRequest request, ServletResponse
> response)
>     throws IOException, ServletException {
>     }
> 
> Thanks in advance
> Ravi
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message