isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian K <harvestmoon...@gmail.com>
Subject REST viewer returning a file
Date Wed, 06 Mar 2019 19:10:16 GMT
Hi,

I want to return a file from a REST operation.  I have an action that
returns a pdf as a Blob.  In the wicket viewer that causes the browser to
download a file.  The REST operation returns an object with content like
this:

```
{
  "links" : [ ],
  "resulttype" : "scalarvalue",
  "result" : {
    "value" : "My file name:application/pdf:[the binary content
base64-encoded]",
    "links" : [ {
      "rel" : "urn:org.restfulobjects:rels/return-type",
      "href" : "
http://localhost:8080/project/restful/domain-types/org.apache.isis.applib.value.Blob
",
      "method" : "GET",
      "type" :
"application/json;profile=\"urn:org.restfulobjects:repr-types/domain-type\""
    } ],
    "extensions" : { }
  }
}
```

The swagger spec that is generated lists this operation as returning a data
type of "object".  Is there another data type that I can use here that
would generate something a little more intuitive? Maybe a swagger 2.0
"file" data type, or a type described with the following yaml:
```
type: object
            properties:
              name :
                 type : string
              mimeType :
                 type : string
              data :
                 type : string
                 format : byte
```

Would an implementation of a ContentMappingService in my project would
allow me to dictate how to represent the Blob data type to the REST
viewer?

Thanks!
Brian

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message