Skip to content

Commit

Permalink
LPS-27677 Source formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchandotcom committed Jun 4, 2012
1 parent 6abceaf commit f2d580e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion portal-impl/src/portal.properties
Expand Up @@ -7289,7 +7289,7 @@
##

#
# Set this to a comma-delimited list of MIME types to send an Accept-Ranges
# Set this to a comma delimited list of MIME types to send an Accept-Ranges
# header.
#
web.server.servlet.accept.ranges.mime.types=audio/basic,audio/mid,audio/midi,audio/mod,audio/mp3,audio/mpeg,audio/mpeg3,audio/ogg,audio/vorbis,audio/wav,audio/x-mid,audio/x-midi,audio/x-mod,audio/x-mpeg,audio/x-pn-realaudio,audio/x-realaudio,audio/x-wav,video/avi,video/mp4,video/mpeg,video/ogg,video/quicktime,video/x-flv,video/x-m4v,video/x-ms-wmv,video/x-msvideo
Expand Down
Expand Up @@ -53,7 +53,7 @@ public void testBasic() throws Exception {

@Test
public void testMultipartRange() throws Exception {
String[] ranges = { "0-9", "25-25", "30-49", "70-79" };
String[] ranges = {"0-9", "25-25", "30-49", "70-79"};

String rangeHeader = "bytes=";

Expand Down Expand Up @@ -82,7 +82,6 @@ public void testMultipartRange() throws Exception {
String[] responseBodies = StringUtil.split(responseBody, boundary);

Assert.assertEquals(ranges.length + 2, responseBodies.length);

Assert.assertEquals(StringPool.DOUBLE_DASH, responseBodies[0]);
Assert.assertEquals(
StringPool.DOUBLE_DASH, responseBodies[ranges.length + 1]);
Expand Down Expand Up @@ -146,7 +145,6 @@ public void testSingleRangeLast() throws Exception {
protected HttpServlet getServlet() {
return new WebServerServlet() {

@Override
protected boolean isSupportsRangeHeader(String contentType) {
return true;
}
Expand Down
Expand Up @@ -27,6 +27,7 @@
import com.liferay.portal.kernel.util.RandomAccessInputStream;
import com.liferay.portal.kernel.util.ServerDetector;
import com.liferay.portal.kernel.util.StreamUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
Expand Down Expand Up @@ -79,10 +80,16 @@ public static List<Range> getRanges(
String[] rangeFields = StringUtil.split(rangeString.substring(6));

if (rangeFields.length > _MAX_RANGE_FIELDS) {
throw new IOException(
"Request of " + rangeFields.length + " range fields has " +
"exceeded maximum allowance as specified by " +
PropsKeys.WEB_SERVER_SERVLET_MAX_RANGE_FIELDS);
StringBundler sb = new StringBundler();

sb.append("Request of ");
sb.append(rangeFields.length);
sb.append(" range fields has exceeded maximum allowance as ");
sb.append("specified by the property \"");
sb.append(PropsKeys.WEB_SERVER_SERVLET_MAX_RANGE_FIELDS);
sb.append("\"");

throw new IOException(sb.toString());
}

for (String rangeField : rangeFields) {
Expand Down Expand Up @@ -671,9 +678,8 @@ protected static void setHeaders(
private static final String _CLIENT_ABORT_EXCEPTION =
"org.apache.catalina.connector.ClientAbortException";

private static final int _MAX_RANGE_FIELDS =
GetterUtil.getInteger(PropsUtil.get(
PropsKeys.WEB_SERVER_SERVLET_MAX_RANGE_FIELDS));
private static final int _MAX_RANGE_FIELDS = GetterUtil.getInteger(
PropsUtil.get(PropsKeys.WEB_SERVER_SERVLET_MAX_RANGE_FIELDS));

private static final String _RANGE_REGEX =
"^bytes=\\d*-\\d*(,\\s?\\d*-\\d*)*$";
Expand Down

0 comments on commit f2d580e

Please sign in to comment.