You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2007/05/09 01:17:41 UTC

Re: svn commit: r536048 - /lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java

A few questions aboutthis...

: SOLR-214 -- override getReader() explicitly.  subclass called instance
: variables, not getContentType()

1) wouldn't it make sense to make ContentStreamBase use getContentType()
instead of contentType so that it can be subclassed in this case, instead
of duplicating hte getReader in every subclass?

2) ...

: +      }
: +      public Reader getReader() throws IOException {
: +        String charset = ContentStreamBase.getCharsetFromContentType( req.getContentType() );
: +        return charset == null
: +          ? new InputStreamReader( getStream() )
: +          : new InputStreamReader( getStream(), charset );

...do we really want to use the single arg constructure if the request has
no charset, or should we assume UTF-8 ?  ... i seem to i recall we talked
about this once before and i argued in favor of using the defualt and letting
the servlet container "do the right thing", but i thought the consesus was
to assume UTF-8 if the request itself didn't contain any explicit charset?

these are the two (semi-jumbled) threads i'm thinking of...

http://www.nabble.com/resin-and-UTF-8-in-URLs-tf3152910.html
http://www.nabble.com/charset-in-POST-from-browser-tf3153057.html



-Hoss


Re: svn commit: r536048 - /lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java

Posted by Ryan McKinley <ry...@gmail.com>.
Chris Hostetter wrote:
> A few questions aboutthis...
> 
> : SOLR-214 -- override getReader() explicitly.  subclass called instance
> : variables, not getContentType()
> 
> 1) wouldn't it make sense to make ContentStreamBase use getContentType()
> instead of contentType so that it can be subclassed in this case, instead
> of duplicating hte getReader in every subclass?
> 

agree.


> 2) ...
> 
> : +      }
> : +      public Reader getReader() throws IOException {
> : +        String charset = ContentStreamBase.getCharsetFromContentType( req.getContentType() );
> : +        return charset == null
> : +          ? new InputStreamReader( getStream() )
> : +          : new InputStreamReader( getStream(), charset );
> 
> ...do we really want to use the single arg constructure if the request has
> no charset, or should we assume UTF-8 ? 

I like the suggestion to defaul to 'utf-8' -- this way the behavior is 
well defined.  Otherwise it depends on the platform configuration and 
how the container may (or may not) deal with charset encodings.


ryan