Example usage for com.liferay.portal.kernel.servlet HttpHeaders CONTENT_RANGE

List of usage examples for com.liferay.portal.kernel.servlet HttpHeaders CONTENT_RANGE

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.servlet HttpHeaders CONTENT_RANGE.

Prototype

String CONTENT_RANGE

To view the source code for com.liferay.portal.kernel.servlet HttpHeaders CONTENT_RANGE.

Click Source Link

Usage

From source file:com.liferay.document.library.webserver.test.WebServerRangeTest.java

License:Open Source License

@Test
public void testSingleRangeByte() throws Exception {
    MockHttpServletResponse mockHttpServletResponse = testRange("bytes=10-10");

    Assert.assertEquals("1", mockHttpServletResponse.getHeader(HttpHeaders.CONTENT_LENGTH));
    Assert.assertEquals("bytes 10-10/80", mockHttpServletResponse.getHeader(HttpHeaders.CONTENT_RANGE));
    Assert.assertEquals("B", mockHttpServletResponse.getContentAsString());
}

From source file:com.liferay.document.library.webserver.test.WebServerRangeTest.java

License:Open Source License

@Test
public void testSingleRangeFirst() throws Exception {
    MockHttpServletResponse mockHttpServletResponse = testRange("bytes=0-9");

    Assert.assertEquals("10", mockHttpServletResponse.getHeader(HttpHeaders.CONTENT_LENGTH));
    Assert.assertEquals("bytes 0-9/80", mockHttpServletResponse.getHeader(HttpHeaders.CONTENT_RANGE));
    Assert.assertEquals("A123456789", mockHttpServletResponse.getContentAsString());
}

From source file:com.liferay.document.library.webserver.test.WebServerRangeTest.java

License:Open Source License

@Test
public void testSingleRangeLast() throws Exception {
    MockHttpServletResponse mockHttpServletResponse = testRange("bytes=70-79");

    Assert.assertEquals("10", mockHttpServletResponse.getHeader(HttpHeaders.CONTENT_LENGTH));
    Assert.assertEquals("bytes 70-79/80", mockHttpServletResponse.getHeader(HttpHeaders.CONTENT_RANGE));
    Assert.assertArrayEquals(_UNICODE_DATA.getBytes(), mockHttpServletResponse.getContentAsByteArray());
}