1717import org .apache .hc .core5 .http .HeaderElement ;
1818import org .apache .hc .core5 .http .message .BasicHeader ;
1919import org .apache .hc .core5 .http .message .MessageSupport ;
20+ import org .expath .httpclient .BomAction ;
2021import org .expath .httpclient .ContentType ;
2122import org .expath .httpclient .HeaderSet ;
2223import org .expath .httpclient .HttpClientError ;
@@ -64,7 +65,7 @@ public static HttpRequestBody makeRequestBody(final Element elem, final Sequence
6465 }
6566 }
6667
67- public static HttpResponseBody makeResponseBody (final Result result , final ContentType type , final HttpConnection conn )
68+ public static HttpResponseBody makeResponseBody (final Result result , final ContentType type , final BomAction bomAction , final HttpConnection conn )
6869 throws HttpClientException {
6970 if (type == null ) {
7071 // it is legitimate to not have a body in a response; for instance
@@ -80,26 +81,26 @@ public static HttpResponseBody makeResponseBody(final Result result, final Conte
8081 return null ;
8182 }
8283 if (t .startsWith ("multipart/" )) {
83- return new MultipartResponseBody (result , in , type );
84+ return new MultipartResponseBody (result , in , type , bomAction );
8485 } else {
85- return makeResponsePart (result , null , in , type );
86+ return makeResponsePart (result , null , in , type , bomAction );
8687 }
8788 }
8889
8990 // package-level to be used within MultipartResponseBody ctor
9091 // TODO: Take new methods into account (XHTML, BASE64 and HEX).
91- static HttpResponseBody makeResponsePart (final Result result , final HeaderSet headers , final InputStream in , final ContentType ctype )
92+ static HttpResponseBody makeResponsePart (final Result result , final HeaderSet headers , final InputStream in , final ContentType ctype , final BomAction bomAction )
9293 throws HttpClientException {
9394 switch (parseType (ctype )) {
9495 case XML :
9596 // TODO: 'content_type' is the header Content-Type without any param
9697 // (i.e. "text/xml".) Should we keep this, or put the whole header
9798 // (i.e. "text/xml; charset=utf-8")? (and for other types as well...)
98- return new XmlResponseBody (result , in , ctype , headers , false );
99+ return new XmlResponseBody (result , in , ctype , bomAction , headers , false );
99100 case HTML :
100- return new XmlResponseBody (result , in , ctype , headers , true );
101+ return new XmlResponseBody (result , in , ctype , bomAction , headers , true );
101102 case TEXT :
102- return new TextResponseBody (result , in , ctype , headers );
103+ return new TextResponseBody (result , in , ctype , bomAction , headers );
103104 case BINARY :
104105 return new BinaryResponseBody (result , in , ctype , headers );
105106 default :
@@ -278,5 +279,5 @@ else if ("base64".equals(m)) {
278279/* */
279280/* The Initial Developer of the Original Code is Florent Georges. */
280281/* */
281- /* Contributor(s): none . */
282+ /* Contributor(s): Evolved Binary Ltd . */
282283/* ------------------------------------------------------------------------ */
0 commit comments