You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by bd...@apache.org on 2011/02/21 18:06:05 UTC
svn commit: r1073068 -
/incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
Author: bdelacretaz
Date: Mon Feb 21 17:06:04 2011
New Revision: 1073068
URL: http://svn.apache.org/viewvc?rev=1073068&view=rev
Log:
STANBOL-19 - ignore whatever follows semicolon in assertContentType
Modified:
incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
Modified: incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java?rev=1073068&r1=1073067&r2=1073068&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java (original)
+++ incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java Mon Feb 21 17:06:04 2011
@@ -155,7 +155,15 @@ public class RequestExecutor {
if(entity == null) {
fail(this + ": no entity in response, cannot check content type");
}
- assertEquals(this + ": expecting content type " + expected, expected, entity.getContentType().getValue());
+
+ // Remove whatever follows semicolon in content-type
+ String contentType = entity.getContentType().getValue();
+ if(contentType != null) {
+ contentType = contentType.split(";")[0].trim();
+ }
+
+ // And check for match
+ assertEquals(this + ": expecting content type " + expected, expected, contentType);
return this;
}
Re: svn commit: r1073068 - /incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
Posted by Rupert Westenthaler <ru...@gmail.com>.
Hi
I think we should generally switch to something like
http://jersey.java.net/nonav/apidocs/1.5/jersey/javax/ws/rs/core/MediaType.html.
Forcing engine implementations to deal directly with the string
representation of media types is an unnecessary source of bugs.
best
Rupert Westenthaler
On Mon, Feb 21, 2011 at 7:00 PM, Olivier Grisel
<ol...@ensta.org> wrote:
> I think we should keep the charset info as a complement to the
> mediatype field in the content item to be able to decode the byte
> stream with the right charset if this is text stream.
>
> 2011/2/21 <bd...@apache.org>:
>> Author: bdelacretaz
>> Date: Mon Feb 21 17:06:04 2011
>> New Revision: 1073068
>>
>> URL: http://svn.apache.org/viewvc?rev=1073068&view=rev
>> Log:
>> STANBOL-19 - ignore whatever follows semicolon in assertContentType
>>
>> Modified:
>> incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
>>
>> Modified: incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
>> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java?rev=1073068&r1=1073067&r2=1073068&view=diff
>> ==============================================================================
>> --- incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java (original)
>> +++ incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java Mon Feb 21 17:06:04 2011
>> @@ -155,7 +155,15 @@ public class RequestExecutor {
>> if(entity == null) {
>> fail(this + ": no entity in response, cannot check content type");
>> }
>> - assertEquals(this + ": expecting content type " + expected, expected, entity.getContentType().getValue());
>> +
>> + // Remove whatever follows semicolon in content-type
>> + String contentType = entity.getContentType().getValue();
>> + if(contentType != null) {
>> + contentType = contentType.split(";")[0].trim();
>> + }
>> +
>> + // And check for match
>> + assertEquals(this + ": expecting content type " + expected, expected, contentType);
>> return this;
>> }
>>
>>
>>
>>
>
>
>
> --
> Olivier
> http://twitter.com/ogrisel - http://github.com/ogrisel
>
--
| Rupert Westenthaler rupert.westenthaler@gmail.com
| Bodenlehenstraße 11 ++43-699-11108907
| A-5500 Bischofshofen
Re: svn commit: r1073068 - /incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
On Mon, Feb 21, 2011 at 7:00 PM, Olivier Grisel
<ol...@ensta.org> wrote:
> I think we should keep the charset info as a complement to the
> mediatype field in the content item to be able to decode the byte
> stream with the right charset if this is text stream....
Revision 1073068 is only about the RequestExecutor class that's used
for tests, it's not about the content item.
If we want to check the response encoding in that RequestExecutor
class, we should do it in a separate assert... method, not in
assertContentType.
-Bertrand
>
> 2011/2/21 <bd...@apache.org>:
>> Author: bdelacretaz
>> Date: Mon Feb 21 17:06:04 2011
>> New Revision: 1073068
>>
>> URL: http://svn.apache.org/viewvc?rev=1073068&view=rev
>> Log:
>> STANBOL-19 - ignore whatever follows semicolon in assertContentType
>>
>> Modified:
>> incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
>>
>> Modified: incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
>> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java?rev=1073068&r1=1073067&r2=1073068&view=diff
>> ==============================================================================
>> --- incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java (original)
>> +++ incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java Mon Feb 21 17:06:04 2011
>> @@ -155,7 +155,15 @@ public class RequestExecutor {
>> if(entity == null) {
>> fail(this + ": no entity in response, cannot check content type");
>> }
>> - assertEquals(this + ": expecting content type " + expected, expected, entity.getContentType().getValue());
>> +
>> + // Remove whatever follows semicolon in content-type
>> + String contentType = entity.getContentType().getValue();
>> + if(contentType != null) {
>> + contentType = contentType.split(";")[0].trim();
>> + }
>> +
>> + // And check for match
>> + assertEquals(this + ": expecting content type " + expected, expected, contentType);
>> return this;
>> }
>>
>>
>>
>>
>
>
>
> --
> Olivier
> http://twitter.com/ogrisel - http://github.com/ogrisel
>
Re: svn commit: r1073068 - /incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
Posted by Olivier Grisel <ol...@ensta.org>.
I think we should keep the charset info as a complement to the
mediatype field in the content item to be able to decode the byte
stream with the right charset if this is text stream.
2011/2/21 <bd...@apache.org>:
> Author: bdelacretaz
> Date: Mon Feb 21 17:06:04 2011
> New Revision: 1073068
>
> URL: http://svn.apache.org/viewvc?rev=1073068&view=rev
> Log:
> STANBOL-19 - ignore whatever follows semicolon in assertContentType
>
> Modified:
> incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
>
> Modified: incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java?rev=1073068&r1=1073067&r2=1073068&view=diff
> ==============================================================================
> --- incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java (original)
> +++ incubator/stanbol/trunk/commons/testing/http/src/main/java/org/apache/stanbol/commons/testing/http/RequestExecutor.java Mon Feb 21 17:06:04 2011
> @@ -155,7 +155,15 @@ public class RequestExecutor {
> if(entity == null) {
> fail(this + ": no entity in response, cannot check content type");
> }
> - assertEquals(this + ": expecting content type " + expected, expected, entity.getContentType().getValue());
> +
> + // Remove whatever follows semicolon in content-type
> + String contentType = entity.getContentType().getValue();
> + if(contentType != null) {
> + contentType = contentType.split(";")[0].trim();
> + }
> +
> + // And check for match
> + assertEquals(this + ": expecting content type " + expected, expected, contentType);
> return this;
> }
>
>
>
>
--
Olivier
http://twitter.com/ogrisel - http://github.com/ogrisel