Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] IPAccessHandler For Specific Context? (Jetty 7.0.2)

Hi,

I have a Jetty 7 instance running two webapps. One app needs to be restricted such that only local connections are permitted, while the other is public.

I'm trying to configure an IPAccessHandler for the restricted context by placing the following config in $JETTY_HOME/contexts/solr.xml:

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/solr</Set>
  <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/solr.war</Set>
  <Get id="oldHandler" name="handler"/>
    <Set name="handler">
     <New id="IPAccessHandler" class="org.eclipse.jetty.server.handler.IPAccessHandler">
      <Set name="handler"><Ref id="oldhandler"/></Set>
      <Set name="white">
        <Array type="String">
          <Item>127.0.0.1</Item>
        </Array>
      </Set>
     </New>
    </Set>
</Configure>

... however Jetty fails because there is no current handler to wrap (trace below). What's the correct way to do this?

Thanks!

Chris

java.lang.IllegalStateException: No object for id=oldhandler
        at org.eclipse.jetty.xml.XmlConfiguration.refObj(XmlConfiguration.java:676)
        at org.eclipse.jetty.xml.XmlConfiguration.itemValue(XmlConfiguration.java:944)
        at org.eclipse.jetty.xml.XmlConfiguration.value(XmlConfiguration.java:868)
        at org.eclipse.jetty.xml.XmlConfiguration.set(XmlConfiguration.java:292)
        at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:254)
        at org.eclipse.jetty.xml.XmlConfiguration.newObj(XmlConfiguration.java:657)
        at org.eclipse.jetty.xml.XmlConfiguration.itemValue(XmlConfiguration.java:943)
        at org.eclipse.jetty.xml.XmlConfiguration.value(XmlConfiguration.java:868)
        at org.eclipse.jetty.xml.XmlConfiguration.set(XmlConfiguration.java:292)
        at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:254)
        at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:220)
        at org.eclipse.jetty.deploy.providers.ContextProvider.createContextHandler(ContextProvider.java:72)
        at org.eclipse.jetty.deploy.App.getContextHandler(App.java:109)
        at org.eclipse.jetty.deploy.bindings.StandardDeployer.processBinding(StandardDeployer.java:33)
        at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:182)
        at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:498)
        at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:136)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:61)
        at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:437)
        at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:350)
        at org.eclipse.jetty.util.Scanner.scan(Scanner.java:306)
        at org.eclipse.jetty.util.Scanner.start(Scanner.java:242)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:136)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:563)
        at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:213)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.Server.doStart(Server.java:207)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1021)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:986)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:394)
        at org.eclipse.jetty.start.Main.start(Main.java:546)
        at org.eclipse.jetty.start.Main.parseCommandLine(Main.java:208)
        at org.eclipse.jetty.start.Main.main(Main.java:75)

Back to the top