@@ -83,7 +83,7 @@ public void redirect(@NotNull String location) {
8383 * @return This Response instance.
8484 */
8585 public Response setCookie (@ NotNull Cookie cookie ) {
86- if (checkIfClosed ()) return this ;
86+ if (isClosed ()) return this ;
8787 this .HEADER .add ("Set-Cookie" , cookie .toString ());
8888 return this ;
8989 }
@@ -103,7 +103,7 @@ public int getStatus() {
103103 * @return This Response instance.
104104 */
105105 public Response setStatus (@ NotNull Status status ) {
106- if (checkIfClosed ()) return this ;
106+ if (isClosed ()) return this ;
107107 this .status = status .getCode ();
108108 return this ;
109109 }
@@ -114,7 +114,7 @@ public Response setStatus(@NotNull Status status) {
114114 * @param status The response status.
115115 */
116116 public void sendStatus (@ NotNull Status status ) {
117- if (checkIfClosed ()) return ;
117+ if (isClosed ()) return ;
118118 this .status = status .getCode ();
119119 send ();
120120 }
@@ -148,7 +148,7 @@ public void setContentType(@NotNull String contentType) {
148148 * Send an empty response (Content-Length = 0)
149149 */
150150 public void send () {
151- if (checkIfClosed ()) return ;
151+ if (isClosed ()) return ;
152152 this .contentLength = 0 ;
153153 sendHeaders ();
154154 close ();
@@ -165,7 +165,7 @@ public void send(String s) {
165165 return ;
166166 }
167167
168- if (checkIfClosed ()) return ;
168+ if (isClosed ()) return ;
169169 byte [] data = s .getBytes ();
170170
171171 this .contentLength = data .length ;
@@ -188,7 +188,7 @@ public void send(String s) {
188188 * @param file The file.
189189 */
190190 public void send (@ NotNull Path file ) {
191- if (checkIfClosed () || !Files .isRegularFile (file ))
191+ if (isClosed () || !Files .isRegularFile (file ))
192192 return ;
193193
194194 try {
@@ -226,13 +226,6 @@ public boolean isClosed() {
226226 return this .isClose ;
227227 }
228228
229- private boolean checkIfClosed () {
230- if (isClose ) {
231- System .err .println ("Response is already closed." );
232- return true ;
233- }
234- return false ;
235- }
236229
237230 private void sendHeaders () {
238231 try {
0 commit comments