org.apache.solr.client.solrj.embedded

## Class JettySolrRunner

- java.lang.Object
- - org.apache.solr.client.solrj.embedded.JettySolrRunner

-     public class JettySolrRunner
      extends Object

  Run solr using jetty
  Since:
    solr 1.3

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JettySolrRunner.DebugFilter`
    `static class` | `JettySolrRunner.Servlet404` This is a stupid hack to give jetty something to attach to

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JettySolrRunner(String solrHome, JettyConfig config)` Construct a JettySolrRunner After construction, you must start the jetty with `start()`
    `JettySolrRunner(String solrHome, Properties nodeProperties, JettyConfig config)` Construct a JettySolrRunner After construction, you must start the jetty with `start()`
    `JettySolrRunner(String solrHome, String context, int port)` Create a new JettySolrRunner.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `URL` | `getBaseUrl()` Returns a base URL consisting of the protocol, host, and port for a Connector in use by the Jetty Server contained in this runner.
    `CoreContainer` | `getCoreContainer()`
    `JettySolrRunner.DebugFilter` | `getDebugFilter()`
    `int` | `getLocalPort()` Returns the Local Port of the jetty Server.
    `Properties` | `getNodeProperties()`
    `SolrDispatchFilter` | `getSolrDispatchFilter()`
    `String` | `getSolrHome()`
    `boolean` | `isRunning()`
    `boolean` | `isStopped()`
    `static void` | `main(String[] args)` A main class that starts jetty+solr This is useful for debugging
    `void` | `setProxyPort(int proxyPort)` Sets the port of a local socket proxy that sits infront of this server; if set then all client traffic will flow through the proxy, giving us the ability to simulate network partitions very easily.
    `void` | `start()` Start the Jetty server If the server has been started before, it will restart using the same port
    `void` | `start(boolean reusePort)` Start the Jetty server
    `void` | `stop()` Stop the Jetty server

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JettySolrRunner

          public JettySolrRunner(String solrHome,
                                 String context,
                                 int port)

      Create a new JettySolrRunner. After construction, you must start the jetty with `start()`
      Parameters:
        `solrHome` - the solr home directory to use
        `context` - the context to run in
        `port` - the port to run on

    - #### JettySolrRunner

          public JettySolrRunner(String solrHome,
                                 JettyConfig config)

      Construct a JettySolrRunner After construction, you must start the jetty with `start()`
      Parameters:
        `solrHome` - the base path to run from
        `config` - the configuration

    - #### JettySolrRunner

          public JettySolrRunner(String solrHome,
                                 Properties nodeProperties,
                                 JettyConfig config)

      Construct a JettySolrRunner After construction, you must start the jetty with `start()`
      Parameters:
        `solrHome` - the solrHome to use
        `nodeProperties` - the container properties
        `config` - the configuration

  - ### Method Detail

    - #### getSolrDispatchFilter

          public SolrDispatchFilter getSolrDispatchFilter()

      Returns:
        the `SolrDispatchFilter` for this node

    - #### getCoreContainer

          public CoreContainer getCoreContainer()

      Returns:
        the `CoreContainer` for this node

    - #### isRunning

          public boolean isRunning()

    - #### isStopped

          public boolean isStopped()

    - #### start

          public void start()
                     throws Exception

      Start the Jetty server If the server has been started before, it will restart using the same port
      Throws:
        `Exception` - if an error occurs on startup

    - #### start

          public void start(boolean reusePort)
                     throws Exception

      Start the Jetty server
      Parameters:
        `reusePort` - when true, will start up on the same port as used by any previous runs of this JettySolrRunner. If false, will use the port specified by the server's JettyConfig.
      Throws:
        `Exception` - if an error occurs on startup

    - #### stop

          public void stop()
                    throws Exception

      Stop the Jetty server
      Throws:
        `Exception` - if an error occurs on shutdown

    - #### getLocalPort

          public int getLocalPort()

      Returns the Local Port of the jetty Server.
      Throws:
        `RuntimeException` - if there is no Connector

    - #### setProxyPort

          public void setProxyPort(int proxyPort)

      Sets the port of a local socket proxy that sits infront of this server; if set then all client traffic will flow through the proxy, giving us the ability to simulate network partitions very easily.

    - #### getBaseUrl

          public URL getBaseUrl()

      Returns a base URL consisting of the protocol, host, and port for a Connector in use by the Jetty Server contained in this runner.

    - #### getDebugFilter

          public JettySolrRunner.DebugFilter getDebugFilter()

    - #### main

          public static void main(String[] args)

      A main class that starts jetty+solr This is useful for debugging

    - #### getSolrHome

          public String getSolrHome()

      Returns:
        the Solr home directory of this JettySolrRunner

    - #### getNodeProperties

          public Properties getNodeProperties()

      Returns:
        this node's properties

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.