java - How to use Jetty IPAccessHandler to whitelist IPv6 addresses? -


i want jetty server handle requests coming localhost. attempting by:

   servletcontexthandler context = new servletcontexthandler(servletcontexthandler.sessions);    context.setcontextpath("/webapi");    ipaccesshandler ipblockinghandler = new ipaccesshandler();    ipblockinghandler.addwhite("127.0.0.1|/*");    ipblockinghandler.sethandler(context);    final org.eclipse.jetty.server.server jettyserver = new org.eclipse.jetty.server.server(8080);    jettyserver.sethandler(ipblockinghandler); 

though, works ipv4 , if add ipblockinghandler.addwhite("127.0.0.1|/*"); not work.

this doable overriding ipaccesshandler , manually parsing adddresses:

ipaccesshandler ipblockinghandler = new ipaccesshandler(){       @override       protected boolean isaddruriallowed(string addr,                                string path){           return addr.equals("127.0.0.1") || addr.equals("0:0:0:0:0:0:0:1");       }     }; 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -