Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to copy SimpleWebServer as an example #549

Closed
harvv opened this issue Jul 9, 2019 · 1 comment
Closed

Make it easier to copy SimpleWebServer as an example #549

harvv opened this issue Jul 9, 2019 · 1 comment

Comments

@harvv
Copy link

harvv commented Jul 9, 2019

(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:

r = Response.newFixedLengthResponse(Status.OK, MIME_PLAINTEXT, null, 0);

...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.

@harvv
Copy link
Author

harvv commented Jul 9, 2019

oh never mind, i just noticed this is fixed in the new code
(my version had the line as: new Response(Response.Status.OK, MIME_PLAINTEXT, null, 0);)

@harvv harvv closed this as completed Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant