Skip to content

Commit

Permalink
refactor : PrintWriter 를 이용해 response 응답
Browse files Browse the repository at this point in the history
  • Loading branch information
kpeel5839 committed Sep 26, 2023
1 parent 9f4c31d commit e402442
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.util.Map;
import web.org.springframework.http.MediaType;
import webmvc.org.springframework.web.servlet.View;
Expand All @@ -20,8 +19,7 @@ public void render(
) throws Exception {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
String responseBody = objectMapper.writeValueAsString(model);
PrintWriter printWriter = new PrintWriter(response.getOutputStream());
printWriter.write(responseBody);
response.getWriter().write(responseBody);
}

}

0 comments on commit e402442

Please sign in to comment.