-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'No converter found' for ID in REST endpoint #638
Comments
I'm not sure, but I think there is a problem here: Line 140 in 03bb455
You create a new At least I assume that this is the reason why my converter for the Id is not found... Best regards, |
Thanks for researching. I will take a look at this soonest. The only comment/question I have about the initial report is the format of the URI. Splitting the ID over two segments of the URI looks problematic. I would image you would have to do something like:
Otherwise, I am not sure how we would ever "know" the ID was the last two segments of the URI. Question, is that something that Spring Data REST does support? |
I don't know whether this is supported by Spring Data REST... Maybe it would be possible if you provide an approach how one can easily define the desired controllers/endpoints and the mapping to the content store manually (at the moment I am also missing the possibility to only activate some specific endpoints and HTTP verbs; for example if I just want to activate a GET endpoint for streaming, but PUT, POST, etc. should not be allowed). However, if I could do it with |
Ok. So, for ContentStore's, Spring Content REST leans pretty heavily on Spring Data so I'd first like to figure out if/how Spring Data/REST supports this use case and then figure out if/how Spring Content/REST might support it. Once I get a better understanding we might be able to tease the two apart so that you don't have to use Spring Data REST yourself. To that end I put together this sample project to check that I understand your data model. This uses the second approach above. You should be able to run this and
to create a new entity. Haven't done anything with content yet. Let me know if this is representative, or not. |
Yes, that's representative. (Basically, I just want to be able to use a custom Java object for the entity ID. Currently, this is not possible with Spring Content; as it has to be a String, UUID, or anything else that can be converted with the default converters provided by Spring.) |
Hi @stefan-ka, I figured out how to do this and committed an updated sample app. You should be able to run the test and see it green. It uses Spring Data REST that allows configuration of both Spring Data and REST to know about the embedded id. I am not sure if you are or want to use Spring Data REST. If so, I thought this might be an option for you. |
Hi @paulcwarren Thanks for the suggestion. However, it should be possible to use Spring Content REST without Spring Data REST, or not? I don't really need Spring Data REST; actually the Video Streaming Endpoint (for the videos in my Sprint Content store) is the one and only endpoint I want to have exposed. |
Thought I would try it in case it would work as you could use it now. You are right. I have observed quite a few users who choose not to use Spring Data REST so the aim has been to not require it. Will look into this soonest then. I am OOO Friday/Monday so probably not until next week now though. |
Thanks @paulcwarren. For the moment (as a workaround), I only use Spring Content as the file store and implemented the streaming endoint by myself. |
Hi @paulcwarren
I have a question regarding spring-content-rest...
I'm using spring-content to store media files, for example MP4 files, on a file system. That works perfectly and was really simple to set up!
Now I need an endpoint to stream my MP4 videos in the browser. As I have read that this is already supported by spring-content-rest, I want to use it... I'm however struggling with setting it up; maybe you can help?
The definition of my media store is simple:
The JPA entity as well:
Writing to the file store and reading from it works perfectly fine...
The point where I am struggling with my endpoint setup is my ID, which basically consists of two other IDs:
SupportingMediumId
andMediumFileId
are just value objects that wrap UUID strings.Via the
ContentRestConfigurer
I set the base URI for the endpoint to/contentApi
:Here comes my problem... When I call the endpoint with my two IDs, like
localhost:8080/content/Api/media-file-contents/{supportingMediumId}/{mediumFileId}
, or just with any stringlocalhost:8080/content/Api/media-file-contents/{just-any-string}
, I get the following exception:I already tried to tackle this in two ways...
org.springframework.core.convert.converter.Converter
:FilesystemStoreConfigurer
:Nothing helped so far... Can you help me out here? How do I have to configure spring-content-rest so that I can stream my MP4s under an endoint that takes my two nested IDs as parameters (
localhost:8080/content/Api/media-file-contents/{supportingMediumId}/{mediumFileId}
)?Alternatively I would also be happy if I could call the endpoint with the
contentId
, but that doesn't seem to work as well (because it looks like the framework is always expecting aMediumFileContentJpaId
based on my interface).Thanks in advance!
Stefan
The text was updated successfully, but these errors were encountered: