@@ -70,7 +70,7 @@ public List<String> getHeader(String key) {
70
70
*
71
71
* @param location The location.
72
72
*/
73
- public void redirect (String location ) {
73
+ public void redirect (@ NotNull String location ) {
74
74
HEADER .add ("Location" , location );
75
75
setStatus (Status ._302 );
76
76
send ();
@@ -82,7 +82,7 @@ public void redirect(String location) {
82
82
* @param cookie The cookie.
83
83
* @return This Response instance.
84
84
*/
85
- public Response setCookie (Cookie cookie ) {
85
+ public Response setCookie (@ NotNull Cookie cookie ) {
86
86
if (checkIfClosed ()) return this ;
87
87
this .HEADER .add ("Set-Cookie" , cookie .toString ());
88
88
return this ;
@@ -131,7 +131,7 @@ public String getContentType() {
131
131
*
132
132
* @param contentType - The contentType
133
133
*/
134
- public void setContentType (MediaType contentType ) {
134
+ public void setContentType (@ NotNull MediaType contentType ) {
135
135
this .contentType = contentType .getMIME ();
136
136
}
137
137
@@ -140,7 +140,7 @@ public void setContentType(MediaType contentType) {
140
140
*
141
141
* @param contentType - The contentType
142
142
*/
143
- public void setContentType (String contentType ) {
143
+ public void setContentType (@ NotNull String contentType ) {
144
144
this .contentType = contentType ;
145
145
}
146
146
@@ -160,6 +160,11 @@ public void send() {
160
160
* @param s The string.
161
161
*/
162
162
public void send (String s ) {
163
+ if (s == null ) {
164
+ send ();
165
+ return ;
166
+ }
167
+
163
168
if (checkIfClosed ()) return ;
164
169
byte [] data = s .getBytes ();
165
170
@@ -183,7 +188,7 @@ public void send(String s) {
183
188
* @param file The file.
184
189
*/
185
190
public void send (@ NotNull Path file ) {
186
- if (checkIfClosed ())
191
+ if (checkIfClosed () || ! Files . isRegularFile ( file ) )
187
192
return ;
188
193
189
194
try {
0 commit comments