Skip to content

Commit

Permalink
Some annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwep committed Feb 23, 2018
1 parent 9e69eae commit f7863d8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/express/http/response/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public List<String> getHeader(String key) {
*
* @param location The location.
*/
public void redirect(String location) {
public void redirect(@NotNull String location) {
HEADER.add("Location", location);
setStatus(Status._302);
send();
Expand All @@ -82,7 +82,7 @@ public void redirect(String location) {
* @param cookie The cookie.
* @return This Response instance.
*/
public Response setCookie(Cookie cookie) {
public Response setCookie(@NotNull Cookie cookie) {
if (checkIfClosed()) return this;
this.HEADER.add("Set-Cookie", cookie.toString());
return this;
Expand Down Expand Up @@ -131,7 +131,7 @@ public String getContentType() {
*
* @param contentType - The contentType
*/
public void setContentType(MediaType contentType) {
public void setContentType(@NotNull MediaType contentType) {
this.contentType = contentType.getMIME();
}

Expand All @@ -140,7 +140,7 @@ public void setContentType(MediaType contentType) {
*
* @param contentType - The contentType
*/
public void setContentType(String contentType) {
public void setContentType(@NotNull String contentType) {
this.contentType = contentType;
}

Expand All @@ -160,6 +160,11 @@ public void send() {
* @param s The string.
*/
public void send(String s) {
if (s == null) {
send();
return;
}

if (checkIfClosed()) return;
byte[] data = s.getBytes();

Expand All @@ -183,7 +188,7 @@ public void send(String s) {
* @param file The file.
*/
public void send(@NotNull Path file) {
if (checkIfClosed())
if (checkIfClosed() || !Files.isRegularFile(file))
return;

try {
Expand Down

0 comments on commit f7863d8

Please sign in to comment.