Class ShowFileRequestHandler

  • All Implemented Interfaces:
    AutoCloseable, ApiSupport, SolrInfoBean, NestedRequestHandler, SolrMetricProducer, SolrRequestHandler

    public class ShowFileRequestHandler
    extends RequestHandlerBase
    This handler uses the RawResponseWriter to give client access to files inside ${solr.home}/conf

    If you want to selectively restrict access some configuration files, you can list these files in the HIDDEN invariants. For example to hide synonyms.txt and anotherfile.txt, you would register:

     <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
       <lst name="defaults">
        <str name="echoParams">explicit</str>
       </lst>
       <lst name="invariants">
        <str name="hidden">synonyms.txt</str> 
        <str name="hidden">anotherfile.txt</str>
        <str name="hidden">*</str>
       </lst>
     </requestHandler>
     
    At present, there is only explicit file names (including path) or the glob '*' are supported. Variants like '*.xml' are NOT supported.ere

    The ShowFileRequestHandler uses the RawResponseWriter (wt=raw) to return file contents. If you need to use a different writer, you will need to change the registered invariant param for wt.

    If you want to override the contentType header returned for a given file, you can set it directly using: USE_CONTENT_TYPE. For example, to get a plain text version of schema.xml, try:

       http://localhost:8983/solr/admin/file?file=schema.xml&contentType=text/plain
     
    Since:
    solr 1.3