0

I am having trouble seeing how i can read form the stream when its being read up in the chain somewhere.

here is my function

@POST
        @Consumes(["application/json"])
        public Response addGift(@Context HttpServletRequest request,@QueryParam("from") int from,
                @ApiParam(value = "Indiviual Gift object to be inserted", required = true)  posiba.api.v1.IndividualGift gift) {
        return Response.ok().entity("{\"Submit\": \"Success\"}").build();

    }

I have a json data POST (payload , body) and a queryparam(for testing)

the request variable can access the params but when i try and read from the stream

stream.available() returns 0 and if i try and get anything out of the stream it closes it.

is there a way to inline override the input stream reader so whatever is up the chain does not read from it and i can use it locally.

TPEACHES
  • 319
  • 3
  • 7
  • The question is tagged with Grails. Is that code really in a Grails app? – Jeff Scott Brown Jun 14 '14 at 11:33
  • yeah why? Should it not be <-- also is more of a representation of what is actually there I know it doesn't make sense but my boss is insisting on using grails.. – TPEACHES Jun 14 '14 at 17:48

1 Answers1

0

solved it myself -- a bit of a hack way tho ----

the goal was to use swagger UI in my grails app so i have one method( as seen above) to tell swagger about the parameters and required etc...and then i made a separate function that accepts the request and does my custom handling of it

@POST
    @Consumes(["application/json"])
    public Response addGiftt(@Context HttpServletRequest request, InputStream requestBody){
//stuff...
    }
TPEACHES
  • 319
  • 3
  • 7