[JBoss JIRA] (ISPN-11969) Find a replacement for the Key-Content-Type REST request header
by Dan Berindei (Jira)
Dan Berindei created ISPN-11969:
-----------------------------------
Summary: Find a replacement for the Key-Content-Type REST request header
Key: ISPN-11969
URL: https://issues.redhat.com/browse/ISPN-11969
Project: Infinispan
Issue Type: Task
Reporter: Dan Berindei
A REST URI should uniquely identify a resource.
But in our server, the {{Key-Content-Type}} request header changes the way the URI is mapped to a cache key,
so a single URI could be seen by the server as multiple different cache entries.
The simplest solution would be to extend the URI of cache entries with a query parameter, e.g. {{/rest/v2/caches/<cache>/<key>?key-content-type=<media-type>}}.
I have 2 small concerns with this solution:
1. When doing a POST request, browsers will put all the parameters in the request body instead of the location.
I don't expect us to have browsers acting as clients, and the search request already does this, but something to keep in mind.
2. Although resource URIs can be anything, they are usually thought to include only the path part of the URL.
Everybody knows query parameters affect `GET` requests, but the difference between
`DELETE /rest/v2/caches/<cache>/<key>` and
`DELETE /rest/v2/caches/<cache>/<key>?key-content-type=application/octet-stream`
might be surprising to some.
I would prefer to put the key media type in the path of the URI,
e.g. {{/rest/v2/caches/<cache>/<key-content-type>/<key>}}.
It also has a problem: it makes it look like encodings create separate namespaces,
but they actually overlap, and the same logical "cache entry resource" can be accessed
with multiple key content types.
So perhaps we should instead say the {{/rest/v2/caches/<cache>/<key>}} resources are always {{text/plain;charset=UTF-8}} keys,
and for any other content type the client should use a different resource, {{/rest/v2/caches/<cache>/entry/}}
(the extra {{/}} may or may not be required to avoid clashing with regular keys).
The {{/rest/v2/caches/<cache>/entry/}} resource would have {{key}} and {{key-content-type}} parameters
that could be sent either in a `GET` query string or in a `POST` body.
Note: Some key content types will have additional parameters to tell the server how to decode them, e.g. {{application/x-java-object;type=java.long.Double}}, or {{application/octet-stream;encoding=hex}}.
I have created ISPN-11966 to deprecate the {{application/x-java-object}} handling, and ISPN-11968 to deprecate the {{encoding}} parameter in {{application/octet-stream}}.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
3 years, 11 months
[JBoss JIRA] (ISPN-11968) Deprecate application/octet-stream encoding parameter in REST API
by Dan Berindei (Jira)
Dan Berindei created ISPN-11968:
-----------------------------------
Summary: Deprecate application/octet-stream encoding parameter in REST API
Key: ISPN-11968
URL: https://issues.redhat.com/browse/ISPN-11968
Project: Infinispan
Issue Type: Task
Components: REST
Affects Versions: 11.0.0.CR1
Reporter: Dan Berindei
Fix For: 12.0.0.Final
The REST API allows a client to encode {{application/octet-stream}} keys and values either in BASE64 or in an ad-hoc {{hex}} format, depending on the value of the {{encoding}} parameter.
REST, being based on HTTP, offers a more natural encoding of {{application/octet-stream}}:
* In the URI, the keys should be [percent-encoded|https://en.wikipedia.org/wiki/Percent-encoding]
* Even when listing the keys in the cache, and the keys appear in the body, it might be a good idea to list the keys as relative URIs (therefore percent-encoded)
* The values only appear in the request/response body, so they should not be encoded at all
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
3 years, 11 months
[JBoss JIRA] (ISPN-11966) Deprecate application/x-java-object in the REST API
by Dan Berindei (Jira)
Dan Berindei created ISPN-11966:
-----------------------------------
Summary: Deprecate application/x-java-object in the REST API
Key: ISPN-11966
URL: https://issues.redhat.com/browse/ISPN-11966
Project: Infinispan
Issue Type: Task
Components: REST
Affects Versions: 11.0.0.CR1
Reporter: Dan Berindei
Assignee: Gustavo Fernandes
Fix For: 12.0.0.Final
The REST server supports request header {{Key-Content-Type}}, which changes the meaning of the key in the request URI to be encoded in different media types.
One of the supported media types is {{application/x-java-object}}, which parses Java primitives as if they were Java literals, with special handling for {{String}} and {{byte[]}}. The parsing rules are ad-hoc and undocumented, so I suggest we stop supporting them.
Users who want a readable URI should instead use write the key as JSON and rely on the server to transcode between JSON and the cache storage media type.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
3 years, 11 months
[JBoss JIRA] (ISPN-11964) WARN about unknown cache encoding
by Gustavo Fernandes (Jira)
[ https://issues.redhat.com/browse/ISPN-11964?page=com.atlassian.jira.plugi... ]
Gustavo Fernandes updated ISPN-11964:
-------------------------------------
Description:
A special MediaType ''application/unknown" is used when the cache hasn't an <encoding> configuration and its encoding cannot be guessed.
For 11.0.0.Final, this should result in a WARNING since conversions with unknown format depends on "user marshaller" and can be done only in a best effort basis
was:
A special MediaType ''application/unknown" is used when the cache hasn't an <encoding> configuration and its encoding cannot be guessed.
For 11.0.0.Final, this should result in a WARNING since conversions with unknown format depends on user marshaller and can be done in a best effort basis
> WARN about unknown cache encoding
> ----------------------------------
>
> Key: ISPN-11964
> URL: https://issues.redhat.com/browse/ISPN-11964
> Project: Infinispan
> Issue Type: Bug
> Components: Core, Server
> Affects Versions: 11.0.0.CR1
> Reporter: Gustavo Fernandes
> Assignee: Gustavo Fernandes
> Priority: Major
> Fix For: 11.0.0.Final
>
>
> A special MediaType ''application/unknown" is used when the cache hasn't an <encoding> configuration and its encoding cannot be guessed.
> For 11.0.0.Final, this should result in a WARNING since conversions with unknown format depends on "user marshaller" and can be done only in a best effort basis
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
3 years, 11 months
[JBoss JIRA] (ISPN-11965) Prevent conversions in caches with unknown formats
by Gustavo Fernandes (Jira)
Gustavo Fernandes created ISPN-11965:
----------------------------------------
Summary: Prevent conversions in caches with unknown formats
Key: ISPN-11965
URL: https://issues.redhat.com/browse/ISPN-11965
Project: Infinispan
Issue Type: Bug
Components: Core, Server
Reporter: Gustavo Fernandes
Assignee: Gustavo Fernandes
Fix For: 12.0.0.Final
Usages of filter/converters, remote iterators, listeners, scripts, REST and everything that could involve transcoder should throw an error if the cache doesn't have an encoding.More specifically, APPLICATION_UNKNOW should not be handled by any transcoder
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
3 years, 11 months