88import jooby .BodyReader ;
99import jooby .BodyWriter ;
1010import jooby .MediaType ;
11- import jooby .Response .Body ;
1211import jooby .Viewable ;
1312
1413import com .google .common .collect .ImmutableList ;
@@ -26,8 +25,8 @@ public boolean canWrite(final Class<?> type) {
2625 }
2726
2827 @ Override
29- public void write (final Body body , final BodyWriter writer ) throws Exception {
30- try (InputStream in = (InputStream ) body . content (). get () ) {
28+ public void write (final Object body , final BodyWriter writer ) throws Exception {
29+ try (InputStream in = (InputStream ) body ) {
3130 writer .bytes (out -> ByteStreams .copy (in , out ));
3231 }
3332 }
@@ -41,8 +40,8 @@ public boolean canWrite(final Class<?> type) {
4140 }
4241
4342 @ Override
44- public void write (final Body body , final BodyWriter writer ) throws Exception {
45- try (Reader in = (Reader ) body . content (). get () ) {
43+ public void write (final Object body , final BodyWriter writer ) throws Exception {
44+ try (Reader in = (Reader ) body ) {
4645 writer .text (out -> CharStreams .copy (in , out ));
4746 }
4847 }
@@ -66,7 +65,7 @@ public boolean canWrite(final Class<?> type) {
6665 }
6766
6867 @ Override
69- public void write (final Body body , final BodyWriter writer ) throws Exception {
68+ public void write (final Object body , final BodyWriter writer ) throws Exception {
7069 throw new UnsupportedOperationException ();
7170 }
7271 },
@@ -79,10 +78,9 @@ public boolean canWrite(final Class<?> type) {
7978 }
8079
8180 @ Override
82- public void write (final Body body , final BodyWriter writer ) throws Exception {
83- Object message = body .content ().get ();
84- writer .text (out -> out .write (message instanceof Viewable ? ((Viewable ) message ).model ()
85- .toString () : message .toString ()));
81+ public void write (final Object body , final BodyWriter writer ) throws Exception {
82+ writer .text (out -> out .write (body instanceof Viewable ? ((Viewable ) body ).model ()
83+ .toString () : body .toString ()));
8684 }
8785 };
8886
0 commit comments