Did you try doing it like this?

    Option(request.getParameter("byteLength")).map(_.toInt).getOrElse(defaultBytes)

I think that should work and its a bit nicer. There is other code in this file that uses flatMap, but it should be changed to use map.