mirror of https://github.com/apache/lucene.git
SOLR-5083: Move JDK-1.0-style hidden classes into inner classes of SolrRequestParsers (to prevent uptodate javac bugs)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1507742 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
70344afbfc
commit
2902c40cfd
|
@ -361,40 +361,39 @@ public class SolrRequestParsers
|
|||
public void setAddRequestHeadersToContext(boolean addRequestHeadersToContext) {
|
||||
this.addHttpRequestToContext = addRequestHeadersToContext;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
//-----------------------------------------------------------------
|
||||
//-----------------------------------------------------------------
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
// I guess we don't really even need the interface, but i'll keep it here just for kicks
|
||||
interface SolrRequestParser
|
||||
{
|
||||
// I guess we don't really even need the interface, but i'll keep it here just for kicks
|
||||
interface SolrRequestParser
|
||||
{
|
||||
public SolrParams parseParamsAndFillStreams(
|
||||
final HttpServletRequest req, ArrayList<ContentStream> streams ) throws Exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
//-----------------------------------------------------------------
|
||||
//-----------------------------------------------------------------
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/**
|
||||
* The simple parser just uses the params directly, does not support POST URL-encoded forms
|
||||
*/
|
||||
class SimpleRequestParser implements SolrRequestParser
|
||||
{
|
||||
static class SimpleRequestParser implements SolrRequestParser
|
||||
{
|
||||
@Override
|
||||
public SolrParams parseParamsAndFillStreams(
|
||||
final HttpServletRequest req, ArrayList<ContentStream> streams ) throws Exception
|
||||
{
|
||||
return SolrRequestParsers.parseQueryString(req.getQueryString());
|
||||
return parseQueryString(req.getQueryString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Wrap an HttpServletRequest as a ContentStream
|
||||
*/
|
||||
class HttpRequestContentStream extends ContentStreamBase
|
||||
{
|
||||
static class HttpRequestContentStream extends ContentStreamBase
|
||||
{
|
||||
private final HttpServletRequest req;
|
||||
|
||||
public HttpRequestContentStream( HttpServletRequest req ) {
|
||||
|
@ -414,14 +413,14 @@ class HttpRequestContentStream extends ContentStreamBase
|
|||
public InputStream getStream() throws IOException {
|
||||
return req.getInputStream();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Wrap a FileItem as a ContentStream
|
||||
*/
|
||||
class FileItemContentStream extends ContentStreamBase
|
||||
{
|
||||
static class FileItemContentStream extends ContentStreamBase
|
||||
{
|
||||
private final FileItem item;
|
||||
|
||||
public FileItemContentStream( FileItem f )
|
||||
|
@ -437,29 +436,29 @@ class FileItemContentStream extends ContentStreamBase
|
|||
public InputStream getStream() throws IOException {
|
||||
return item.getInputStream();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* The raw parser just uses the params directly
|
||||
*/
|
||||
class RawRequestParser implements SolrRequestParser
|
||||
{
|
||||
static class RawRequestParser implements SolrRequestParser
|
||||
{
|
||||
@Override
|
||||
public SolrParams parseParamsAndFillStreams(
|
||||
final HttpServletRequest req, ArrayList<ContentStream> streams ) throws Exception
|
||||
{
|
||||
streams.add( new HttpRequestContentStream( req ) );
|
||||
return SolrRequestParsers.parseQueryString( req.getQueryString() );
|
||||
return parseQueryString( req.getQueryString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Extract Multipart streams
|
||||
*/
|
||||
class MultipartRequestParser implements SolrRequestParser
|
||||
{
|
||||
static class MultipartRequestParser implements SolrRequestParser
|
||||
{
|
||||
private final int uploadLimitKB;
|
||||
|
||||
public MultipartRequestParser( int limit )
|
||||
|
@ -475,7 +474,7 @@ class MultipartRequestParser implements SolrRequestParser
|
|||
throw new SolrException( ErrorCode.BAD_REQUEST, "Not multipart content! "+req.getContentType() );
|
||||
}
|
||||
|
||||
MultiMapSolrParams params = SolrRequestParsers.parseQueryString( req.getQueryString() );
|
||||
MultiMapSolrParams params = parseQueryString( req.getQueryString() );
|
||||
|
||||
// Create a factory for disk-based file items
|
||||
DiskFileItemFactory factory = new DiskFileItemFactory();
|
||||
|
@ -507,14 +506,14 @@ class MultipartRequestParser implements SolrRequestParser
|
|||
}
|
||||
return params;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Extract application/x-www-form-urlencoded form data for POST requests
|
||||
*/
|
||||
class FormDataRequestParser implements SolrRequestParser
|
||||
{
|
||||
static class FormDataRequestParser implements SolrRequestParser
|
||||
{
|
||||
private final int uploadLimitKB;
|
||||
|
||||
public FormDataRequestParser( int limit )
|
||||
|
@ -535,7 +534,7 @@ class FormDataRequestParser implements SolrRequestParser
|
|||
// also add possible URL parameters and include into the map (parsed using UTF-8):
|
||||
final String qs = req.getQueryString();
|
||||
if (qs != null) {
|
||||
SolrRequestParsers.parseQueryString(qs, map);
|
||||
parseQueryString(qs, map);
|
||||
}
|
||||
|
||||
// may be -1, so we check again later. But if its already greater we can stop processing!
|
||||
|
@ -552,7 +551,7 @@ class FormDataRequestParser implements SolrRequestParser
|
|||
InputStream in = null;
|
||||
try {
|
||||
in = req.getInputStream();
|
||||
final long bytesRead = SolrRequestParsers.parseFormDataContent(FastInputStream.wrap(in), maxLength, charset, map);
|
||||
final long bytesRead = parseFormDataContent(FastInputStream.wrap(in), maxLength, charset, map);
|
||||
if (bytesRead == 0L && totalLength > 0L) {
|
||||
throw getParameterIncompatibilityException();
|
||||
}
|
||||
|
@ -590,14 +589,14 @@ class FormDataRequestParser implements SolrRequestParser
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* The default Logic
|
||||
*/
|
||||
class StandardRequestParser implements SolrRequestParser
|
||||
{
|
||||
static class StandardRequestParser implements SolrRequestParser
|
||||
{
|
||||
MultipartRequestParser multipart;
|
||||
RawRequestParser raw;
|
||||
FormDataRequestParser formdata;
|
||||
|
@ -616,7 +615,7 @@ class StandardRequestParser implements SolrRequestParser
|
|||
String method = req.getMethod().toUpperCase(Locale.ROOT);
|
||||
if ("GET".equals(method) || "HEAD".equals(method)
|
||||
|| ("PUT".equals(method) && req.getRequestURI().contains("/schema"))) {
|
||||
return SolrRequestParsers.parseQueryString(req.getQueryString());
|
||||
return parseQueryString(req.getQueryString());
|
||||
}
|
||||
if ("POST".equals( method ) ) {
|
||||
if (formdata.isFormData(req)) {
|
||||
|
@ -629,13 +628,5 @@ class StandardRequestParser implements SolrRequestParser
|
|||
}
|
||||
throw new SolrException(ErrorCode.BAD_REQUEST, "Unsupported method: " + method + " for request " + req);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -44,6 +44,10 @@ import org.apache.solr.common.params.SolrParams;
|
|||
import org.apache.solr.common.util.ContentStream;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.servlet.SolrRequestParsers.MultipartRequestParser;
|
||||
import org.apache.solr.servlet.SolrRequestParsers.FormDataRequestParser;
|
||||
import org.apache.solr.servlet.SolrRequestParsers.RawRequestParser;
|
||||
import org.apache.solr.servlet.SolrRequestParsers.StandardRequestParser;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
|
Loading…
Reference in New Issue