SOLR-506 -- Emitting HTTP Cache headers can be enabled or disabled through configuration on a per-handler basis

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@683121 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2008-08-06 06:00:49 +00:00
parent 8d7282df1d
commit 98ff4a03b9
7 changed files with 19 additions and 9 deletions

View File

@ -343,6 +343,9 @@ New Features
68. SOLR-554: Hierarchical JDK log level selector for SOLR Admin replaces logging.jsp (Sean Timm via shalin)
69. SOLR-506: Emitting HTTP Cache headers can be enabled or disabled through configuration
on a per-handler basis (shalin)
Changes in runtime behavior
1. SOLR-559: use Lucene updateDocument, deleteDocuments methods. This
removes the maxBufferedDeletes parameter added by SOLR-310 as Lucene

View File

@ -82,7 +82,6 @@ public class MoreLikeThisHandler extends RequestHandlerBase
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception
{
RequestHandlerUtils.addExperimentalFormatWarning( rsp );
rsp.setHttpCaching(true);
SolrParams params = req.getParams();
SolrIndexSearcher searcher = req.getSearcher();

View File

@ -50,6 +50,7 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
protected SolrParams invariants;
volatile long totalTime = 0;
long handlerStart = System.currentTimeMillis();
protected boolean httpCaching = true;
/** shorten the class references for utilities */
private static class U extends SolrPluginUtils {
@ -113,6 +114,11 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
invariants = SolrParams.toSolrParams((NamedList)o);
}
}
if (initArgs != null) {
Object caching = initArgs.get("httpCaching");
httpCaching = caching != null ? Boolean.parseBoolean(caching.toString()) : true;
}
}
public NamedList getInitArgs() {
@ -125,6 +131,7 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
numRequests++;
try {
U.setDefaults(req,defaults,appends,invariants);
rsp.setHttpCaching(httpCaching);
handleRequestBody( req, rsp );
// count timeouts
boolean timedOut = (Boolean)rsp.getResponseHeader().get("partialResults") == null ? false : (Boolean)rsp.getResponseHeader().get("partialResults");

View File

@ -263,7 +263,6 @@ public class SpellCheckerRequestHandler extends RequestHandlerBase implements So
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)
throws Exception {
rsp.setHttpCaching(true);
SolrParams p = req.getParams();
String words = p.get("q");
String cmd = p.get("cmd");

View File

@ -140,8 +140,6 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware
final RTimer timer = rb.isDebug() ? new RTimer() : null;
rsp.setHttpCaching(true);
if (timer == null) {
// non-debugging prepare phase
for( SearchComponent c : components ) {

View File

@ -75,7 +75,7 @@ public class SolrQueryResponse {
/**
* Should this response be tagged with HTTP caching headers?
*/
protected boolean httpCaching=false;
protected boolean httpCaching=true;
/***
// another way of returning an error

View File

@ -229,7 +229,9 @@
The "standard" request handler is the default and will be used if qt
is not specified in the request.
-->
<requestHandler name="standard" class="solr.StandardRequestHandler"/>
<requestHandler name="standard" class="solr.StandardRequestHandler">
<bool name="httpCaching">true</bool>
</requestHandler>
<requestHandler name="dismaxOldStyleDefaults"
class="solr.DisMaxRequestHandler" >
<!-- for historic reasons, DisMaxRequestHandler will use all of
@ -302,7 +304,9 @@
</requestHandler>
<requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
<requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />
<requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy">
<bool name="httpCaching">false</bool>
</requestHandler>
<!-- test elevation -->
<searchComponent name="elevate" class="org.apache.solr.handler.component.QueryElevationComponent" >