Search in sources :

Example 21 with MediaType

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

the class MediaTypeTest method applicationXml.

@Test
public void applicationXml() {
    MediaType mt = MediaType.parse("application/xml");
    errors.checkThat(mt.getType(), is("application"));
    errors.checkThat(mt.getSubtype(), is("xml"));
    errors.checkThat(mt.isWildcard(), is(false));
    errors.checkThat(mt.isWildcardType(), is(false));
    errors.checkThat(mt.isWildcardSubtype(), is(false));
    errors.checkThat(mt.getParameters().size(), is(0));
}
Also used : MediaType(org.n52.janmayen.http.MediaType) Test(org.junit.Test)

Example 22 with MediaType

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

the class MediaTypeTest method applicationXmlWithQAndSpace.

@Test
public void applicationXmlWithQAndSpace() {
    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 23 with MediaType

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

the class MediaTypeTest method testSlashEscape.

@Test
public void testSlashEscape() {
    MediaType mt = MediaType.parse("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 24 with MediaType

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

the class MediaTypeTest method applicationXmlWithQuotedParameterAndQuotesWithin.

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

Example 25 with MediaType

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

the class MediaTypeTest method applicationXmlWithQAndThreeSpace.

@Test
public void applicationXmlWithQAndThreeSpace() {
    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)

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