Skip to content

Commit

Permalink
Added logging for not existing resource url.
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoOfTwelve committed Dec 5, 2023
1 parent 71d094c commit a207694
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cli/src/main/java/de/jplag/cli/server/ResponseData.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

import java.io.InputStream;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Data for a http response
* @param stream The stream containing the binary data
* @param contentType The type of data
* @param size The total size of the data
*/
public record ResponseData(InputStream stream, ContentType contentType, int size) {

private static final Logger logger = LoggerFactory.getLogger(ResponseData.class);

/**
* Constructor with unknown type and size. Type will be set to PLAIN.
* @param data The binary data to respond with
Expand Down Expand Up @@ -41,6 +47,9 @@ public static ResponseData fromResourceUrl(String url) {
if (inputStream != null) {
return new ResponseData(inputStream, ContentType.fromPath(url));
} else {
logger.info(
"No response data available for resource url {}. This is probably normal behaviour and the data will be pulled from a different source.",
url);
return null;
}
}
Expand Down

0 comments on commit a207694

Please sign in to comment.