OnoSendai
OnoSendai

Reputation: 3970

JBoss equivalent to HTTPModule

Preamble: .NET developer, dipping into Java/JBoss waters.

First of all, I'm sorry if this question was made here before; but so far I've only been able to pick some fragmentary information around. I'd really appreciate some consolidated info.

I have an ongoing SSO project written in .NET that intercepts all HTTP requests (or a specific set, based on MIME type), matches against some pre-loaded, cached configuration (Application) and state (session/signed-in user) data and decides what to do with that request - allow, deny or ask for credentials. (Unfortunately due to requirements we couldn't pick an off-the-shelf solution.)

Under IIS/.NET, This functionality is handled by a HTTP Module that inserts itself into the request processing pipeline and derives the necessary actions even before the application itself is called. It's working fine, but just for ASP and ASP.NET applications; our next assignment is to make it available for Java applications, with a focus for JBoss.

That wall of text said, here's the actual question:

Is there a JBoss equivalent for the HTTP Module functionality we currently use - executes before the application but have access to session/application state, and can read some sort of XML configuration file stored together with the application itself? Is there another, better way to implement this that we're not looking into?

Thank you so much for your time.

Upvotes: 1

Views: 393

Answers (1)

CoolBeans
CoolBeans

Reputation: 20810

I think you are after HTTP Servlet Filters in Java/Java EE. You can google HttpServlet Filter for hundreds of example implementations and one such example is provided in this article. You mainly have to write a class that implements the Filter interface and then add the necessary configuration (ie. the type of requests the filter will catch and the definition of the filter itself) in the WEB-INF\web.xml file.

Also HttpServletFilters is not limited to JBoss only, it's part of the Java Servlet Spec and hence available to any containers that implements the spec (Weblogic, Websphere, Tomcat, etc).

Upvotes: 1

Related Questions