(This is not at all critical; simply a nice-ty improvement)
Even though it isn't in "samples", the SimpleWebServer class makes a great base / example for how to make a very functional fileserver.
As such, it's reasonable to copy the code into one's own package and then modify it, beyond what would be logical to do with subclassing...
however, the class uses a protected method (construct) of Response, here:
...and this makes copying the class verbatim into another package problematic.
Perhaps instead, just sticking to using public ways of constructing the response?
maybe:
r = newFixedLengthResponse(Response.Status.OK, MIME_PLAINTEXT, null, 0);
(which seems to do the same, though i'll admit i didn't test it)
(This is not at all critical; simply a nice-ty improvement)
Even though it isn't in "samples", the SimpleWebServer class makes a great base / example for how to make a very functional fileserver. As such, it's reasonable to copy the code into one's own package and then modify it, beyond what would be logical to do with subclassing...
however, the class uses a protected method (construct) of Response, here:
https://github.com/NanoHttpd/nanohttpd/blob/efb2ebf85a2b06f7c508aba9eaad5377e3a01e81/webserver/src/main/java/org/nanohttpd/webserver/SimpleWebServer.java#L367
...and this makes copying the class verbatim into another package problematic. Perhaps instead, just sticking to using public ways of constructing the response? maybe: r = newFixedLengthResponse(Response.Status.OK, MIME_PLAINTEXT, null, 0);
(which seems to do the same, though i'll admit i didn't test it)
just a suggestion.