Search in sources :

Example 11 with MediaType

use of org.n52.janmayen.http.MediaType in project arctic-sea by 52North.

the class MediaTypeTest method applicationXmlWithQ.

@Test
public void applicationXmlWithQ() {
    MediaType mt = MediaType.parse("application/xml;q=1");
    errors.checkThat(mt.getType(), is("application"));
    errors.checkThat(mt.getSubtype(), is("xml"));
    errors.checkThat(mt.getParameters().size(), is(1));
    errors.checkThat(mt.getParameter("q").iterator().next(), is("1"));
}
Also used : MediaType(org.n52.janmayen.http.MediaType) Test(org.junit.Test)

Example 12 with MediaType

use of org.n52.janmayen.http.MediaType in project arctic-sea by 52North.

the class MediaTypeTest method applicationXmlWithQAndTwoSpace.

@Test
public void applicationXmlWithQAndTwoSpace() {
    MediaType mt = MediaType.parse("application/xml; q=1");
    errors.checkThat(mt.getType(), is("application"));
    errors.checkThat(mt.getSubtype(), is("xml"));
    errors.checkThat(mt.getParameters().size(), is(1));
    errors.checkThat(mt.getParameter("q").iterator().next(), is("1"));
}
Also used : MediaType(org.n52.janmayen.http.MediaType) Test(org.junit.Test)

Example 13 with MediaType

use of org.n52.janmayen.http.MediaType in project arctic-sea by 52North.

the class MediaTypeTest method applicationXmlWithQAndFiveSpace.

@Test
public void applicationXmlWithQAndFiveSpace() {
    MediaType mt = MediaType.parse("application/xml; q=1 ");
    errors.checkThat(mt.getType(), is("application"));
    errors.checkThat(mt.getSubtype(), is("xml"));
    errors.checkThat(mt.getParameters().size(), is(1));
    errors.checkThat(mt.getParameter("q").iterator().next(), is("1"));
}
Also used : MediaType(org.n52.janmayen.http.MediaType) Test(org.junit.Test)

Example 14 with MediaType

use of org.n52.janmayen.http.MediaType in project arctic-sea by 52North.

the class MediaTypeTest method testSlashEscape3.

@Test
public void testSlashEscape3() {
    MediaType mt = new MediaType("a", "b", "x", "a/1");
    errors.checkThat(mt.toString(), is("a/b; x=\"a/1\""));
}
Also used : MediaType(org.n52.janmayen.http.MediaType) Test(org.junit.Test)

Example 15 with MediaType

use of org.n52.janmayen.http.MediaType in project arctic-sea by 52North.

the class UVFEncoder method createEncoderKeys.

private Set<EncoderKey> createEncoderKeys() {
    Set<EncoderKey> keys = Sets.newHashSet();
    for (String s : MEDIA_TYPES) {
        MediaType mediaType = MediaType.parse(s);
        keys.add((EncoderKey) new OperationResponseEncoderKey(SosConstants.SOS, Sos1Constants.SERVICEVERSION, SosConstants.Operations.GetObservation, mediaType));
        keys.add((EncoderKey) new OperationResponseEncoderKey(SosConstants.SOS, Sos2Constants.SERVICEVERSION, SosConstants.Operations.GetObservation, mediaType));
        keys.add((EncoderKey) new OperationResponseEncoderKey(SosConstants.SOS, Sos1Constants.SERVICEVERSION, SosConstants.Operations.GetObservationById, mediaType));
        keys.add((EncoderKey) new OperationResponseEncoderKey(SosConstants.SOS, Sos2Constants.SERVICEVERSION, SosConstants.Operations.GetObservationById, mediaType));
    }
    return keys;
}
Also used : MediaType(org.n52.janmayen.http.MediaType)

Aggregations

MediaType (org.n52.janmayen.http.MediaType)28 Test (org.junit.Test)21 HTTPException (org.n52.iceland.exception.HTTPException)4 EncodingException (org.n52.svalbard.encode.exception.EncodingException)3 OwsEncodingException (org.n52.iceland.coding.encode.OwsEncodingException)2 ExceptionEvent (org.n52.iceland.event.events.ExceptionEvent)2 NoApplicableCodeException (org.n52.shetland.ogc.ows.exception.NoApplicableCodeException)2 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)2 CountingOutputStream (com.google.common.io.CountingOutputStream)1 UncheckedTimeoutException (com.google.common.util.concurrent.UncheckedTimeoutException)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1 GZIPOutputStream (java.util.zip.GZIPOutputStream)1 DescribeSensor (net.opengis.sos.x10.DescribeSensorDocument.DescribeSensor)1 Binding (org.n52.iceland.binding.Binding)1 ResponseProxy (org.n52.iceland.coding.encode.ResponseProxy)1