-
Notifications
You must be signed in to change notification settings - Fork 520
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
Add a way to get a Jetty Server instance without starting it #73
base: master
Are you sure you want to change the base?
Add a way to get a Jetty Server instance without starting it #73
Conversation
Since the function is called Perhaps a better solution is just to have a function that creates a Jetty server, maybe named |
There is an existing (private) function Another, less important thought: would it make sense to unify and clean up the naming of these related functions? |
@dcj Indeed, since @weavejester I don't understand what you mean by "break[ing] the contract of being an adapter" (:confused:), but your solution sounds good. |
The
An adapter is defined by the Ring specification as being a function of two arguments, a handler and a map of options, that starts a HTTP server. If we break this specification, we break compatibility. So |
@weavejester How about this solution? I'm not sure what tests I could add for this, since |
I think I'd prefer |
Well, the idea behind that was that sometimes I won't have a handler until everything starts up. So I'll run some functions that build a handler based on other systems starting up, and only then start the server with the new handler. Do you think it complicates the API too much? |
If you need to wait for the server to start before creating your handler, it might be a better idea to use a placeholder using a var or wrapper function. A server without any handler doesn't make any conceptual sense. |
I'm not waiting for the server to start before setting a handler, but I am creating and instance of the (stopped) server before setting the final handler. I have been using a placeholder handler with the current API, then calling the private |
Could you explain your use-case in a little more detail? |
0d7f29a
to
0103527
Compare
À la creating an instance of your application without starting it, I'd like to be able to call
run-jetty
to get an instance of the server, but without the side effect of actually starting it.