From 7ae4a26c56661916714ab1bb8dc21ce6d984870a Mon Sep 17 00:00:00 2001 From: William Au Date: Tue, 2 May 2006 17:40:14 +0000 Subject: [PATCH] added query arg optional for getting optional content git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@398977 13f79535-47bb-0310-9956-ffa450edef68 --- src/webapp/resources/admin/get-file.jsp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/webapp/resources/admin/get-file.jsp b/src/webapp/resources/admin/get-file.jsp index 64af33848a3..86d8b63bfb4 100644 --- a/src/webapp/resources/admin/get-file.jsp +++ b/src/webapp/resources/admin/get-file.jsp @@ -7,17 +7,23 @@ <%@ page contentType="text/plain;charset=UTF-8" language="java" %> <% String fname = request.getParameter("file"); + String optional = request.getParameter("optional"); String gettableFiles = SolrConfig.config.get("admin/gettableFiles",""); StringTokenizer st = new StringTokenizer(gettableFiles); InputStream is; boolean isValid = false; + boolean isOptional = false; if (fname != null) { // Validate fname while(st.hasMoreTokens()) { if (st.nextToken().compareTo(fname) == 0) isValid = true; } } + if (optional!=null && optional.equalsIgnoreCase("y")) { + isOptional=true; + } if (isValid) { + try { is= Config.openResource(fname); Reader input = new InputStreamReader(is); char[] buf = new char[4096]; @@ -26,6 +32,12 @@ if (len<=0) break; out.write(buf,0,len); } + } + catch (RuntimeException re) { + if (!isOptional) { + throw re; + } + } } else { out.println(""); out.println("Permission denied for file "+ fname);