Skip to content

Read large data using InputStreamResource at ResourceHttpMessageConverter [SPR-13443] #18023

Closed

Description

@spring-projects-issues

Kazuki Shimizu opened SPR-13443 and commented

Currently,ResourceMessageConverter is reading as ByteArrayResource from the HTTP body. If large data has been set at http body, there is possibility that occur the OutOfMemoryError.

I want to be able to read as InputStreamResource as follows:

RestTemplate restTemplate = new RestTemplate();
Resource resource = restTemplate.getForObject("http://localhost:8080/myApp/foo.zip", InputStreamResource.class);

How do think ?
I submit a PR at the later.


Affects: 4.2.1

Issue Links:

Referenced from: pull request #871, and commits 1feb757

Activity

  1. spring-projects-issues commented on Sep 7, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Kazuki Shimizu commented

    I've submit a PR.
    Please check it.

  2. spring-projects-issues commented on Sep 8, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Good idea! Added in a slightly revised fashion now, also checking whether we support the specified resource class at all.

    Juergen

  3. spring-projects-issues commented on Sep 8, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Kazuki Shimizu commented

    Hi Juergen,

    Thanks for polishing and merging!! i happy :)

  4. spring-projects-issues commented on Feb 27, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Mauro Molinari commented

    But does this work as expected? Isn't the input stream already closed after the call to getForObject has ended?
    See also #12015 and https://stackoverflow.com/a/48041200/1465635

  5. added
    type: enhancement
    in: web
    on Jan 11, 2019
  6. added this to the 4.2.2 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions