|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.http.handler.AbstractHttpHandler | +--org.mortbay.http.handler.IPAccessHandler
Handler to authenticate access from certain IP-addresses.
A server configuration-XML-file can look something like this:
<Configure class="org.mortbay.jetty.Server">
...
<Call name="addContext">
...
<Call name="addHandler">
<Arg>
<New class="IPAccessHandler">
<Set name="Standard">deny</Set>
<Set name="AllowIP">192.168.0.103</Set>
<Set name="AllowIP">192.168.0.100</Set>
</New>
</Arg>
</Call>
...
This would deny access for everyone except the requests from the IPs
192.168.0.100 and 192.168.0.103.
Constructor Summary | |
IPAccessHandler()
Constructor for the class |
Method Summary | |
boolean |
checkIP(java.lang.String ipstring)
Checks if the given ipstring (x.x.x.x) is authorized or not |
void |
handle(java.lang.String pathInContext,
java.lang.String pathParams,
HttpRequest request,
HttpResponse response)
Handles the incoming request |
void |
setAllowIP(java.lang.String ipstring)
Allow the given ip-address access |
void |
setDenyIP(java.lang.String ipstring)
Deny the given ip-address access |
void |
setStandard(java.lang.String s)
Set the standard action beeing taken when not registred IPs wants access |
Methods inherited from class org.mortbay.http.handler.AbstractHttpHandler |
getHttpContext, getName, handleTrace, initialize, isStarted, setName, start, stop, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public IPAccessHandler()
Method Detail |
public boolean checkIP(java.lang.String ipstring)
ipstring
- The ip-address as a String
public void handle(java.lang.String pathInContext, java.lang.String pathParams, HttpRequest request, HttpResponse response) throws HttpException, java.io.IOException
pathInContext
- pathParams
- request
- The incoming HTTP-requestresponse
- The outgoing HTTP-response
HttpException
java.io.IOException
public void setAllowIP(java.lang.String ipstring)
ipstring
- The ip-address as a String on the format "x.x.x.x"public void setDenyIP(java.lang.String ipstring)
ipstring
- The ip-address as a String on the format "x.x.x.x"public void setStandard(java.lang.String s)
s
- The standard-string (either 'allow' or 'deny')
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |