Removing meta data from the file

2019-09-09 20:28发布

The following is my method signature.

    @POST
    @Path("/upload/{user_id}/{user_type}")
    @Produces("application/json")
    public Response fileUploader(InputStream a_fileInputStream,
                                      @PathParam("user_id") String user_id,
                                      @PathParam("user_type") String logType,
                                      @Context ContainerRequestContext crc)  {

//WRITE INPUTSTREAM TO FILE


}

I am able to write content to my file successfully, but there is some meta data which is written to my file at start of my file the following meta data is written:

------WebKitFormBoundaryvsdfdsffsdrsr
Content-Disposition: form-data; name="fileUpload"; filename="2mb.txt"
Content-Type: text/plain

at end of my file

------WebKitFormBoundaryvsdfdsffsdrsr

I dont want these meta data to be present in my file.

I am using Advance REST Client chrome plugin and using the following parameters:

METHOD : POST
url : http://localhost:8080/api/upload/1/normal
Content-Type: application/octet-stream
added one file to it : 2mb.txt

I want to use this api with curl so the following is my curl command:

curl -XPOST http://localhost:8080/api/upload/1/normal --data-binary @2mb.txt

I just want to remove those lines from my file which I am creating.

Thank you.

1条回答
女痞
2楼-- · 2019-09-09 21:26

Place the @FormDataParam("fileUpload") annotation in front of the InputStream parameter.

查看更多
登录 后发表回答