On 1/15/07, Chris Hostetter <[EMAIL PROTECTED]> wrote:

: The most important issue is to nail down the external HTTP interface.

I'm not sure if i agree with that statement .. i would think that figuring
out the "model" or how updates should be handled in a generic way, what
all of the "Plugin" types are, and what their APIs should be is the most
important issue -- once we have those issues settled we could allways
write a new "SolrServlet2" that made the URL structure work anyway we
want.



-Hoss


I hate to inundate you with more code, but it seems like the best way
to describe a possible interface.

//-----------------------------------------------

interface ContentStream
{
 String getName();
 String getContentType();
 InputStream getStream();
}

interface SolrParams
{
 String getParam( String name );
 String[] getParams( String name );
}

//-----------------------------

interface SolrRequest
{
 SolrParams getParams();
 ContentStream[] getContentStreams(); // Iterator?
 long getStartTime();
}

interface SolrResponse
{
 int getStatus(); // ???
 NamedList getProps(); // ???
}

//-----------------------------

interface SolrRequestProcessor
{
 SolrResponse process( SolrRequest req );
 SolrResponseWriter getWriter( SolrRequest req ); // default
}

interface SolrResponseWriter
{
 void write(Writer writer, SolrRequest request, SolrResponse response);
 String getContentType(SolrRequest request, SolrResponse response);
}

//-----------------------------

Then a servlet (or filter) could be in charge of parsing URL/params
into a request.  It would pick a Processor and send the output to a
writer.  If someone wanted a custom URL scheme, they would overide the
servlet/filter.

Perhaps SolrRequest should have an object for solrCore.  It would be
better if it does not need to go to the static
SolrCore.getUpdateHandler().

I am proposing ContentStream[] getContentStreams() because it would be
simpler then an iterator.  In the case of multipart upload, if you
offered an API closer to:
http://jakarta.apache.org/commons/fileupload/streaming.html
You would not have any parameters until after you read each Item and
convert the form fields to parameters.

Thoughts?

Reply via email to