I have a small spring boot application for handling multipart/mixed requests.
The multipart/mixed request can contain a list of requests my service handles. So how do I call my endpoints from within the multipart/mixed endpoint ? Also, I need to preserve the context while calling the endpoints as I dont want to redo certain things ?
Is this possible ?
Also, how do I handle such multipart/mixed request types ?
Reading and parsing requests myself is definitely error-prone and not neat.
Here is a sample code -=
@Path("/api")
public class Demo {
@GET
public String test() {
return "hello";
}
// Echo back the multipart that was sent
@Path("twelve")
@PUT
@Consumes("multipart/mixed")
@Produces("multipart/mixed")
public MultiPart twelve( MultiPart multiPart) throws IOException {
List<BodyPart> bodyParts = multiPart.getBodyParts();
// The list of bodyParts will contain list of requests which my service is handling like
// GET on /api in this case. I want to invoke test() from here within the same context.
return multiPart;
}