[ 
https://issues.apache.org/jira/browse/SOLR-14404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Noble Paul updated SOLR-14404:
------------------------------
    Description: 
caveats:
 * The class should be annotated with  {{org.apache.solr.api.EndPoint}}. Which 
means only V2 APIs are supported
 * The path should have prefix {{/api/plugin}}

add a plugin
{code:java}
curl -X POST -H 'Content-type:application/json' --data-binary '
{
  "add": {
  "name":"myplugin", "class": "full.ClassName"    
  }
}' http://localhost:8983/api/cluster/plugins
{code}

add a plugin from a package
{code:java}
curl -X POST -H 'Content-type:application/json' --data-binary '
{
  "add": {
  "name":"myplugin", "class": "pkgName:full.ClassName" ,
  "version: "1.0"   
  }
}' http://localhost:8983/api/cluster/plugins
{code}


remove a plugin
{code:java}
curl -X POST -H 'Content-type:application/json' --data-binary '
{
  "remove": "myplugin"
}' http://localhost:8983/api/cluster/plugins
{code}
The configuration will be stored in the {{clusterprops.json}}
 as
{code:java}
{
"plugins" : {
"myplugin" : {"class": "full.ClassName" }
}
}
{code}

example plugin

{code:java}
@EndPoint(path = "/plugin/my/path",
    method = METHOD.GET,
    permission = READ)
public class MyPlugin {

  private final CoreContainer coreContainer;

  public MyPlugin(CoreContainer coreContainer) {
    this.coreContainer = coreContainer;
  }

  @Command
  public void call(SolrQueryRequest req, SolrQueryResponse rsp){
    rsp.add("myplugin.version", "2.0");
  }
}
{code}

This  plugin will be accessible on all nodes at {{/api/plugin/my/path}}

  was:
caveats:
 * The class should be annotated with  {{org.apache.solr.api.EndPoint}}. Which 
means only V2 APIs are supported
 * The path should have prefix {{/api/plugin}}

add a plugin
{code:java}
curl -X POST -H 'Content-type:application/json' --data-binary '
{
  "add": {
  "name":"myplugin", "class": "full.ClassName"    
  }
}' http://localhost:8983/api/cluster/plugins
{code}

add a plugin from a package
{code:java}
curl -X POST -H 'Content-type:application/json' --data-binary '
{
  "add": {
  "name":"myplugin", "class": "pkgName:full.ClassName" ,
  "version: "1.0"   
  }
}' http://localhost:8983/api/cluster/plugins
{code}


remove a plugin
{code:java}
curl -X POST -H 'Content-type:application/json' --data-binary '
{
  "remove": "myplugin"
}' http://localhost:8983/api/cluster/plugins
{code}
The configuration will be stored in the {{clusterprops.json}}
 as
{code:java}
{
"plugins" : {
"myplugin" : {"class": "full.ClassName" }
}
}
{code}


> CoreContainer level custom requesthandlers
> ------------------------------------------
>
>                 Key: SOLR-14404
>                 URL: https://issues.apache.org/jira/browse/SOLR-14404
>             Project: Solr
>          Issue Type: New Feature
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Noble Paul
>            Assignee: Noble Paul
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> caveats:
>  * The class should be annotated with  {{org.apache.solr.api.EndPoint}}. 
> Which means only V2 APIs are supported
>  * The path should have prefix {{/api/plugin}}
> add a plugin
> {code:java}
> curl -X POST -H 'Content-type:application/json' --data-binary '
> {
>   "add": {
>   "name":"myplugin", "class": "full.ClassName"    
>   }
> }' http://localhost:8983/api/cluster/plugins
> {code}
> add a plugin from a package
> {code:java}
> curl -X POST -H 'Content-type:application/json' --data-binary '
> {
>   "add": {
>   "name":"myplugin", "class": "pkgName:full.ClassName" ,
>   "version: "1.0"   
>   }
> }' http://localhost:8983/api/cluster/plugins
> {code}
> remove a plugin
> {code:java}
> curl -X POST -H 'Content-type:application/json' --data-binary '
> {
>   "remove": "myplugin"
> }' http://localhost:8983/api/cluster/plugins
> {code}
> The configuration will be stored in the {{clusterprops.json}}
>  as
> {code:java}
> {
> "plugins" : {
> "myplugin" : {"class": "full.ClassName" }
> }
> }
> {code}
> example plugin
> {code:java}
> @EndPoint(path = "/plugin/my/path",
>     method = METHOD.GET,
>     permission = READ)
> public class MyPlugin {
>   private final CoreContainer coreContainer;
>   public MyPlugin(CoreContainer coreContainer) {
>     this.coreContainer = coreContainer;
>   }
>   @Command
>   public void call(SolrQueryRequest req, SolrQueryResponse rsp){
>     rsp.add("myplugin.version", "2.0");
>   }
> }
> {code}
> This  plugin will be accessible on all nodes at {{/api/plugin/my/path}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to