Jax-RS Multipart response - jax-rs

I want to deliver a multipart response from my web application. I'd like to fullfil this requirement by using Jax-RS. Is it possible to provide a Multipart HTTP-Response with Jax-RS? Do I have to use MessageBodyWriter for this purpose and implement this on my own, or is there any class I can use for multipart responses.
thanks a lot.

In Jersey you can use jersey-media-multipart module to make your life easier. Follow the documentation on this topic: Multipart section in Jersey User Guide or take a look at the available example multipart-webapp.

Related

What are headers used for in RAML?

Working with RAML headers, can anyone help me in learning it.I am unable to find online that what actually headers are in RAML, why they are used for.
I think RAML spec is better place to learn about RAML than the tutorials. https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/#headers
headers:
Zencoder-Api-Key:
description: The API key needed to create a new job
Headers refer to HTTP headers. They can be used to define authorization token, e.g. Authorization or Zencoder-Api-Key. HTTP headers can be send with you API request.

Sonos Soap Envelope example that includes SessionId

Trying to implement a Soap header handler I need a specific example of a Soap request that the Sonos client will make which includes the SessiondId.
Thanks
We are deprecating support for sessionid-based authentication. It will continue to work, but future integrations should be built using app linking.
In the meantime, a sessionid-container header would contain this credentials object:
<ns:credentials>
<ns:deviceId>00:00:00:00:00</ns:deviceId>
<ns:deviceProvider>Sonos</ns:deviceProvider>
<ns:sessionId>[sessionIdentifier]</ns:sessionId>
</ns:credentials>

OpenAPI or swagger.json auto discovery

Is there any spec or convention on URL where one should place swagger.json (or whatever name it is agreed) so that public API of my site can be automatically discovered?
Updated 19 April 2017: The OpenAPI Wiki answer I gave previously is "for a very very very old version of the spec". The same source states that for 2.0 the standard is swagger.json, for 3.0 it changes to openapi.json.
Original answer:
The OpenAPI Wiki recommends using an /api-docs endpoint, at
least for server APIs. I've seen several sites in the wild that use
that, and it's our shop standard.
Hope that helps.
How about serving the Swagger JSON in an HTTP response body, in response to an OPTIONS request for the URL / ?
This is specifically permitted by the relevant RFC.
Further, consider implementing HATEOAS, as strongly advocated by Roy Fielding.
Okay. OpenAPI 3.0 still lacking auto-discovery mechanism, I try to propose a scheme based on some things that were already working:
https://example.com/.well-known/schema-discovery is a JSON document pointing to array of available schemas:
[
{
"schema_url": "/openapi.json",
"schema_type": "openapi-3.0"
},
{
"schema_url": "/v2/openapi.json",
"schema_type": "openapi-3.0"
}
]
If there is only one version of API, then https://example.com/openapi.json should be enough.
HTTP Headers. I remember somebody from Google proposed HTTP header for pointing to API. If you can find or remember it, please tell me.

twisted.web.client HTTP logging

How can I log the HTTP requests and responses when using twisted.web.client? I've checked the docs and sources and didn't find anything but maybe it's possible using some custom agents or some such?
There is no built-in support for this, but you can implement your own IAgent, that does logging and delegates to another IAgent, perhaps using proxyForInterface.

Yodlee Rest API (coblogin) doesn't work with simple Rest Client

I'm trying to implement the Rest API for Yodlee using Spring RestTemplate.
For starter I'm trying to use the simple chrome extenuation to test the API but it doesn't seem to work.
(see image url here)
https://www.evernote.com/shard/s3/sh/3c42d3fb-e69f-49c4-ab80-e4b607aca13e/03aea0e891c1f2c40414fcc992f2c307
The content type needs to be application/x-www-form-urlencoded and the request needs to be properly formatted.For example:
cobrandLogin=yourCobrandLogin&cobrandPassword=yourCobrandPassword
I've noticed that the error messages for the rest api are extremely unhelpful.