Merged revision(s) 1683024 from lucene/dev/branches/branch_5x:

SOLR-7484: make it possible to override sendError and execute
........


git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1683025 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2015-06-02 00:36:41 +00:00
parent 99e54ab044
commit 8c5b480e71
2 changed files with 10 additions and 2 deletions

View File

@ -618,7 +618,7 @@ public class HttpSolrCall {
}
}
void sendError(int code, String message) throws IOException {
protected void sendError(int code, String message) throws IOException {
try {
response.sendError(code, message);
} catch (EOFException e) {

View File

@ -222,7 +222,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
}
}
HttpSolrCall call = new HttpSolrCall(this, cores, (HttpServletRequest) request, (HttpServletResponse) response, retry);
HttpSolrCall call = getHttpSolrCall((HttpServletRequest) request, (HttpServletResponse) response, retry);
try {
Action result = call.call();
switch (result) {
@ -241,6 +241,14 @@ public class SolrDispatchFilter extends BaseSolrFilter {
}
}
/**
* Allow a subclass to modify the HttpSolrCall. In particular, subclasses may
* want to add attributes to the request and send errors differently
*/
protected HttpSolrCall getHttpSolrCall(HttpServletRequest request, HttpServletResponse response, boolean retry) {
return new HttpSolrCall(this, cores, request, response, retry);
}
private boolean authenticateRequest(ServletRequest request, ServletResponse response, final AtomicReference<ServletRequest> wrappedRequest) throws IOException {
final AtomicBoolean isAuthenticated = new AtomicBoolean(false);
AuthenticationPlugin authenticationPlugin = cores.getAuthenticationPlugin();