You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ry...@apache.org on 2012/04/09 23:36:31 UTC

svn commit: r1311471 - /lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java

Author: ryan
Date: Mon Apr  9 21:36:31 2012
New Revision: 1311471

URL: http://svn.apache.org/viewvc?rev=1311471&view=rev
Log:
SOLR-3202: now that we are not using JSP, no need for the static getFileContents hack

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java?rev=1311471&r1=1311470&r2=1311471&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java Mon Apr  9 21:36:31 2012
@@ -17,7 +17,6 @@
 
 package org.apache.solr.handler.admin;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.solr.cloud.ZkSolrResourceLoader;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
@@ -38,7 +37,6 @@ import org.apache.zookeeper.KeeperExcept
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URISyntaxException;
 import java.util.Date;
@@ -88,11 +86,9 @@ public class ShowFileRequestHandler exte
   
   protected Set<String> hiddenFiles;
   
-  private static ShowFileRequestHandler instance;
   public ShowFileRequestHandler()
   {
     super();
-    instance = this; // used so that getFileContents can access hiddenFiles
   }
 
   @Override
@@ -281,30 +277,7 @@ public class ShowFileRequestHandler exte
     rsp.setHttpCaching(false);
   }
   
-  /**
-   * This is a utility function that lets you get the contents of an admin file
-   * 
-   * It is only used so that we can get rid of "/admin/get-file.jsp" and include
-   * "admin-extra.html" in "/admin/index.html" using jsp scriptlets
-   */
-  public static String getFileContents(SolrCore core, String path )
-  {
-    if( instance != null && instance.hiddenFiles != null ) {
-      if( instance.hiddenFiles.contains( path ) ) {
-        return ""; // ignore it...
-      }
-    }
-    InputStream input = null;
-    try {
-      input = core.getResourceLoader().openResource(path);
-      return IOUtils.toString( input, "UTF-8" );
-    } catch( Exception ex ) {
-    } finally {
-      IOUtils.closeQuietly(input);
-    }
-    return "";
-  }
-
+  
   //////////////////////// SolrInfoMBeans methods //////////////////////
 
   @Override