Disabling all but the production context

2004-12-30 Thread Jonck van der Kogel
Hi,
This must get asked all the time, but I've searched very intently and 
have not been able to find how to do this.

What I would like, is that the only reachable context on my server is 
the production context. So let's say my domain is www.example.com, 
and my web-app can be reached at www.example.com/business/servlet1, I 
would like the latter to be the only thing reachable. So if someone 
goes to www.example.com they should not get anything returned. 
However, I would like these to be reachable for anyone on localhost.

Now the documentation tells me the way to do this is by adding a 
Valve element to a Context. The help I could find on the Internet is 
mostly for Tomcat 4.0 and there they refer to the contexts being 
located in server.xml. I'm using 5.0.28 however, and in the server.xml 
file there are no Context elements. I know the Contexts for the Manager 
and Admin app can be found at $CATALINA_HOME/conf/Catalina/localhost/ , 
so there I've added appropriate Valve elements to the manager and admin 
xml files. But I can't find the Contexts for the Welcome Page or the 
Examples.
Could someone please tell me how I restrict access the Welcome Page and 
the Examples?

Thanks very much, Jonck
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Disabling all but the production context

2004-12-30 Thread Tim Funk
The easiest thing to do is to create/add a filter for the webapps which 
perform the ACL controls you need.

For example: I have some utilities called servlet utils here:
http://funkman.home.comcast.net/servletutils-0.2/
The following example returns 403 for any request where the remoteaddress != 
127.0.0.1

filter
  filter-nameGoAwayFilter/filter-name
  filter-classnet.funkman.servletutil.filter.ErrorFilter/filter-class
init-param
  param-nameerrorMessage/param-name
  param-valueGo away!/param-value
/init-param
init-param
  param-nameerrorCode/param-name
  param-value403/param-value
/init-param
  init-param
param-namecondition/param-name
param-value${request.remoteAddress ne '127.0.0.1'}/param-value
  /init-param
/filter
filter-mapping
filter-nameGoAwayFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping
Just inject the snippet above into your web.xml.
-Tim
Jonck van der Kogel wrote:
Hi,
This must get asked all the time, but I've searched very intently and 
have not been able to find how to do this.

What I would like, is that the only reachable context on my server is 
the production context. So let's say my domain is www.example.com, and 
my web-app can be reached at www.example.com/business/servlet1, I 
would like the latter to be the only thing reachable. So if someone goes 
to www.example.com they should not get anything returned. However, I 
would like these to be reachable for anyone on localhost.

Now the documentation tells me the way to do this is by adding a Valve 
element to a Context. The help I could find on the Internet is mostly 
for Tomcat 4.0 and there they refer to the contexts being located in 
server.xml. I'm using 5.0.28 however, and in the server.xml file there 
are no Context elements. I know the Contexts for the Manager and Admin 
app can be found at $CATALINA_HOME/conf/Catalina/localhost/ , so there 
I've added appropriate Valve elements to the manager and admin xml 
files. But I can't find the Contexts for the Welcome Page or the Examples.
Could someone please tell me how I restrict access the Welcome Page and 
the Examples?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Disabling all but the production context

2004-12-30 Thread Jonck van der Kogel
Hi Tim,
Thanks for your reply, I did what you said, however, when I try to load  
the page now it gives the following error:

description The server encountered an internal error () that prevented  
it from fulfilling this request.

exception
javax.servlet.ServletException: Could not evaluate condition:  
${request.remoteAddress ne '127.0.0.1'}
 
net.funkman.servletutil.filter.ConditionFilter.canDoFilter(ConditionFilt 
er.java:127)
 
net.funkman.servletutil.filter.ConditionFilter.doFilter(ConditionFilter. 
java:79)

root cause
javax.servlet.jsp.el.ELException: Unable to find a value for  
remoteAddress in object of class  
org.apache.coyote.tomcat5.CoyoteRequestFacade using operator .
org.apache.commons.el.Logger.logError(Logger.java:481)
org.apache.commons.el.Logger.logError(Logger.java:498)
org.apache.commons.el.Logger.logError(Logger.java:611)
org.apache.commons.el.ArraySuffix.evaluate(ArraySuffix.java:340)
 
org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
 
org.apache.commons.el.BinaryOperatorExpression.evaluate(BinaryOperatorEx 
pression.java:154)
 
org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluat 
orImpl.java:263)
 
org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluat 
orImpl.java:190)
 
net.funkman.servletutil.el.ElEvaluator.evaluate(ElEvaluator.java:62)
 
net.funkman.servletutil.el.ElEvaluator.evaluateBoolean(ElEvaluator.java: 
47)
 
net.funkman.servletutil.filter.ConditionFilter.canDoFilter(ConditionFilt 
er.java:121)
 
net.funkman.servletutil.filter.ConditionFilter.doFilter(ConditionFilter. 
java:79)

Any idea what I could do? I read the JavaDocs on your site, but I  
couldn't find the answer there.
Thanks, Jonck

On Dec 30, 2004, at 8:06 PM, Tim Funk wrote:
The easiest thing to do is to create/add a filter for the webapps  
which perform the ACL controls you need.

For example: I have some utilities called servlet utils here:
http://funkman.home.comcast.net/servletutils-0.2/
The following example returns 403 for any request where the  
remoteaddress != 127.0.0.1

filter
  filter-nameGoAwayFilter/filter-name
   
filter-classnet.funkman.servletutil.filter.ErrorFilter/filter- 
class
init-param
  param-nameerrorMessage/param-name
  param-valueGo away!/param-value
/init-param
init-param
  param-nameerrorCode/param-name
  param-value403/param-value
/init-param
  init-param
param-namecondition/param-name
param-value${request.remoteAddress ne '127.0.0.1'}/param-value
  /init-param
/filter

filter-mapping
filter-nameGoAwayFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping
Just inject the snippet above into your web.xml.
-Tim
Jonck van der Kogel wrote:
Hi,
This must get asked all the time, but I've searched very intently and  
have not been able to find how to do this.
What I would like, is that the only reachable context on my server is  
the production context. So let's say my domain is www.example.com,  
and my web-app can be reached at www.example.com/business/servlet1,  
I would like the latter to be the only thing reachable. So if someone  
goes to www.example.com they should not get anything returned.  
However, I would like these to be reachable for anyone on localhost.
Now the documentation tells me the way to do this is by adding a  
Valve element to a Context. The help I could find on the Internet  
is mostly for Tomcat 4.0 and there they refer to the contexts being  
located in server.xml. I'm using 5.0.28 however, and in the  
server.xml file there are no Context elements. I know the Contexts  
for the Manager and Admin app can be found at  
$CATALINA_HOME/conf/Catalina/localhost/ , so there I've added  
appropriate Valve elements to the manager and admin xml files. But I  
can't find the Contexts for the Welcome Page or the Examples.
Could someone please tell me how I restrict access the Welcome Page  
and the Examples?
-
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]