lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1423121 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/java/org/apache/solr/response/PHPResponseWriter.java core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java
Date Mon, 17 Dec 2012 20:26:40 GMT
Author: markrmiller
Date: Mon Dec 17 20:26:39 2012
New Revision: 1423121

URL: http://svn.apache.org/viewvc?rev=1423121&view=rev
Log:
SOLR-4110: Configurable Content-Type headers for PHPResponseWriters and PHPSerializedResponseWriter.

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/PHPResponseWriter.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1423121&r1=1423120&r2=1423121&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Mon Dec 17 20:26:39 2012
@@ -34,7 +34,7 @@ Velocity 1.6.4 and Velocity Tools 2.0
 Apache UIMA 2.3.1
 Apache ZooKeeper 3.4.5
 
-Upgrading from Solr 4.0.0-BETA
+Upgrading from Solr 4.0.0
 ----------------------
 
 Custom java parsing plugins need to migrade from throwing the internal
@@ -154,6 +154,9 @@ New Features
 * SOLR-4120: Collection API: Support for specifying a list of Solr addresses to
   spread a new collection across. (Per Steffensen via Mark Miller)
 
+* SOLR-4110: Configurable Content-Type headers for PHPResponseWriters and 
+  PHPSerializedResponseWriter. (Dominik Siebel via Mark Miller)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/PHPResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/PHPResponseWriter.java?rev=1423121&r1=1423120&r2=1423121&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/PHPResponseWriter.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/PHPResponseWriter.java Mon
Dec 17 20:26:39 2012
@@ -26,13 +26,18 @@ import org.apache.solr.request.SolrQuery
 public class PHPResponseWriter implements QueryResponseWriter {
   static String CONTENT_TYPE_PHP_UTF8="text/x-php;charset=UTF-8";
 
+  private String contentType = CONTENT_TYPE_PHP_UTF8;
+
   @Override
-  public void init(NamedList n) {
-    /* NOOP */
+  public void init(NamedList namedList) {
+    String contentType = (String) namedList.get("content-type");
+    if (contentType != null) {
+      this.contentType = contentType;
+    }
   }
-  
- @Override
-public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException
{
+
+  @Override
+  public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException
{
     PHPWriter w = new PHPWriter(writer, req, rsp);
     try {
       w.writeResponse();
@@ -43,7 +48,7 @@ public void write(Writer writer, SolrQue
 
   @Override
   public String getContentType(SolrQueryRequest request, SolrQueryResponse response) {
-    return CONTENT_TYPE_TEXT_UTF8;
+    return contentType;
   }
 }
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java?rev=1423121&r1=1423120&r2=1423121&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/PHPSerializedResponseWriter.java
Mon Dec 17 20:26:39 2012
@@ -41,12 +41,18 @@ import org.apache.solr.search.ReturnFiel
 public class PHPSerializedResponseWriter implements QueryResponseWriter {
   static String CONTENT_TYPE_PHP_UTF8="text/x-php-serialized;charset=UTF-8";
 
+  private String contentType = CONTENT_TYPE_PHP_UTF8;
+
   @Override
-  public void init(NamedList n) {
+  public void init(NamedList namedList) {
+    String contentType = (String) namedList.get("content-type");
+    if (contentType != null) {
+      this.contentType = contentType;
+    }
   }
   
- @Override
-public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException
{
+  @Override
+  public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException
{
     PHPSerializedWriter w = new PHPSerializedWriter(writer, req, rsp);
     try {
       w.writeResponse();
@@ -57,7 +63,7 @@ public void write(Writer writer, SolrQue
 
   @Override
   public String getContentType(SolrQueryRequest request, SolrQueryResponse response) {
-    return CONTENT_TYPE_TEXT_UTF8;
+    return contentType;
   }
 }
 



Mime
View raw message