Skip to content

response is corrupted by app.java when converting byte[] to and from string in specific use case #182

Open
@przemeqq

Description

@przemeqq

Expected Behaviour

Ability to provide byte[] as response body in handler

Current Behaviour

In java12 template, you can't provide byte[] as response. You need to convert it to string in handler and in app.java it is again converted to byte[]. In result it gets corrupted. In our use case (generating pdf using JasperReports) we received blank PDFs

Possible Solution

Another template "Java12Byte" or changes to Java12
As workaround
(1) did custom template
(2 alternative ) encoded byte[] with base64 and decoded in client (unnecessary step)

Context

Some software eg JasperReports provides byte[] or outputstreams and they cannot be converted to String because they are getting corrupted (lost 2 workdays trying to understand cause).
I tried to use different encoding but it is not working. According to response in: https://community.jaspersoft.com/questions/976061/pdf-byte-array-encoding
it will not work.

Your Environment

  • Docker version docker version (e.g. Docker 17.0.05 ):
    19.03.4
  • Are you using Docker Swarm or Kubernetes (FaaS-netes)?
    Swarm
  • Operating System and version (e.g. Linux, Windows, MacOS):
    Windows, Linux, tried on both

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions