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

Allow for manual configuration of Jetty server in ring-adapter-jetty #33

Closed
wants to merge 1 commit into from
Closed

Conversation

lispnik
Copy link

@lispnik lispnik commented Sep 15, 2011

Hello Mark,

Would you consider including this changeset? It allows for manual configuration of the Jetty server and is backwards compatible.

I have a use case where I need to do some extensive customization of the Jetty request handler to accomodate integration with other Java filters and servlets. The existing proxy-handler code in core.clj will not work for me because a proxy-handler is added unconditionally after a configurator runs.

I still need to make use of the other connector options etc. which is why I think merging this change back makes sense.

Matt

@weavejester
Copy link
Collaborator

If I'm reading your commit correctly, you're proposing an option to make the Jetty adapter ignore the handler? This sounds like a work-around rather than a good solution to the problem.

A better solution might be to have a separate Clojure library for running embedded Jetty servers. We could even base Ring's Jetty adapter off this more generic library.

Also, you have some random extensions in the .gitignore file associated with this commit. In general, file patterns you want to ignore in your local repository should go in the .git/info/exclude file. The .gitignore file is only for files generated by Ring or its build tools.

@lispnik
Copy link
Author

lispnik commented Sep 16, 2011

Not quite. It is not meant as a convenience for creating Jetty servers without Ring handlers, instead it is for configuring my own Jetty handler which wraps my Ring handler. Currently ring.adapter.jetty's proxy-handler hardcodes a subclassing of org.mortbay.jetty.handler.AbstractHandler, while I need a sub-class of org.mortbay.jetty.servlet.Context (so that higher level frameworks like Spring Security work with it). Here's an example of how I am using it in production:
to integrate Spring Security with Compojure.

@lispnik lispnik closed this Sep 16, 2011
@lispnik lispnik reopened this Sep 16, 2011
@weavejester
Copy link
Collaborator

Right, but the handler argument is still ignored if this option is set to false, which results in the adapter function not adhering to the adapter specification.

If you want an embedded Jetty server, but Ring adapters are not flexible enough, then we should think about creating a more general-purpose Clojure interface to Jetty. Adding this option is not the right solution to this problem, IMO.

@lispnik
Copy link
Author

lispnik commented Sep 16, 2011

OK, I don't want to create another Clojure interface to Jetty since there's not much value in that. At the same time, I think I can get by by removing the ring-adapter-jetty proxied handler after calling run-jetty (which means I dont have to touch ring-adapter-jetty), e.g. something like this:

(doseq [handler (remove #(= (class %) org.mortbay.jetty.servlet.Context) (seq (.getHandlers server)))]
    (.removeHandler server handler))

@lispnik lispnik closed this Sep 16, 2011
dcmoore referenced this pull request in dcmoore/ring Jan 11, 2013
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

Successfully merging this pull request may close these issues.

None yet

2 participants