Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jersey-dev] [External] : Jersey within Existing Jetty Servlet Filter
  • From: Jan Supol <jan.supol@xxxxxxxxxx>
  • Date: Thu, 11 Aug 2022 11:49:20 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T0cenH9+jhlP0QAaOhtCKNY7v3lpjZTIRebmKVx8934=; b=VbIneG02kMX6NLXLyRSiqIKqrCo9BLiE9jyKEVjoTWR0V1nE6yy0yw38lx2Xny9FuRUnwrH7q7edG9lFOQ2WT32rECqd/hZ7MIhInLa/1gfEv4MVf1gJE1Io0lTBQCoiz7cpkwMUfADTBrlmEFCcv93CYtx6/U2tbYd8UmdBq88rD1oJWvIw2zbdSl5LR9W1JzuAqeAwwJn1kVh+lSOMk2ilRAJzAEggCQ5t6/0ylRZJ4tkVTt7RkcfX0g4oIKZ3dVY2Ts+xCVUhfxWeLaQN3CUPGCxz/ve4A+bbo9peMrTkDbYHvYkAxV1WHFTVXrv0btObviNaL71q5L0UJvOozw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jEl3pf9nQ+VokYEjSHTD5o4QnerUO1G7txPz5Asf2DWZId3ptMCpfV/zpmdX5pZcTSNC+D29YGc+eDCPYdWddneIUn6YaG4bt3t0ZsgeKSExCyxbQPZu6i8E3SYevi1HXYYZkNm6e9XLNTqJ1S7ye8PjwRxGZ3vejDQH694dZz8ad5Yj6Lti19y3sDqiGBjq/ErEyINONh8/BsOOkEr4siA7KWuX+TKlWdn78vGo8vpl8UIueWRk8T8s0y24a28+cEvqyLO2XF2qEPX6bSk93YtsTU2uC/bymNlr6G24/EJ+PsQToYVPHbjXXTh1P8ooKt8L5KJZAZafF62MlGUsvQ==
  • Delivered-to: jersey-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/jersey-dev/>
  • List-help: <mailto:jersey-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jersey-dev>, <mailto:jersey-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jersey-dev>, <mailto:jersey-dev-request@eclipse.org?subject=unsubscribe>
  • Msip_labels:
  • Thread-index: AQHYrLsZFOlaDdGGcUeBpwYhZkyT6a2pkY/V
  • Thread-topic: [External] : [jersey-dev] Jersey within Existing Jetty Servlet Filter

Hello Apache Solr,
Discussing it here is fine, or it can be discussed as a regular issue on the Jersey issue tracker [1].

You are right with the ApplicationHandler, this is the main "entry point" to the Jersey framework.
I can recommend looking at the integration with the Servlet container, which supports Jersey both as a filter and a servlet[2].

In case of any issues with the integration, feel free to file an issue on the issue tracker [1].

Thanks
-- Jan



From: jersey-dev <jersey-dev-bounces@xxxxxxxxxxx> on behalf of Jason Gerlowski <gerlowskija@xxxxxxxxx>
Sent: Wednesday, August 10, 2022 3:13 PM
To: jersey-dev@xxxxxxxxxxx <jersey-dev@xxxxxxxxxxx>
Subject: [External] : [jersey-dev] Jersey within Existing Jetty Servlet Filter
 
Hi all,

Greetings from the Apache Solr community! [1]  We're a large
Jetty-based open source project, and have some interest in adopting
Jersey.  Had a quick "usage" question to run by you guys.

(Btw, sorry if this is the wrong place; please let me know if there's
a separate list or forum for "usage"-type questions that I should use
instead. "jersey-dev" was the only mailing list mentioned on the
project site. [2])

We'd like to start moving our API code over to Jersey a few APIs at a
time.  But, for historical reasons that are hard to reverse, our code
runs almost entirely within a single Jetty servlet filter
("SolrDispatchFIlter").  This filter has all sorts of auth, tracing,
etc. logic mixed in with the "actual" API invocation, which makes it
hard to send some subset of APIs to a different Jersey servlet (which
I gather is the "standard" way of running Jersey.) [2]

So instead I've been looking for a way to instantiate and use Jersey
from within our existing servlet-filter.  Are there any patterns for
doing this?

My initial (wrongheaded) attempt here involved using
"jersey-container-jetty-http" to instantiate a "Server" to send
requests to, but (1) I don't want or need a full-blown Server since
I'm already running within Jetty, and (2) I couldn't figure out how to
convert the HttpServletRequest I receive from Jetty into the 'Request'
object needed by server.handle()

Instantiating a "ApplicationHandler" looks a bit more promising since
(I think) it sheds a lot of the extra functionality in the Server
class, but I still have trouble figuring out how to call into
AppHandler (or other Jersey code) with the HttpServletRequest and
HttpServletResponse that Jetty gives me to work with.

Thanks in advance for any advice or pointers!

Best,

Jason

[1] https://urldefense.com/v3/__https://solr.apache.org/__;!!ACWV5N9M2RV99hQ!IcEnW60WYqQw6MM2kGSIhTpPdPAOBIvw7jt9-eVTGt7AJ50bDXeWNfaJfx5BrYTGnBUSXKtuHsziBsROm_Sn$
[2] https://urldefense.com/v3/__https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/deployment.html*deployment.servlet__;Iw!!ACWV5N9M2RV99hQ!IcEnW60WYqQw6MM2kGSIhTpPdPAOBIvw7jt9-eVTGt7AJ50bDXeWNfaJfx5BrYTGnBUSXKtuHsziBqAltFGv$
_______________________________________________
jersey-dev mailing list
jersey-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://urldefense.com/v3/__https://www.eclipse.org/mailman/listinfo/jersey-dev__;!!ACWV5N9M2RV99hQ!IcEnW60WYqQw6MM2kGSIhTpPdPAOBIvw7jt9-eVTGt7AJ50bDXeWNfaJfx5BrYTGnBUSXKtuHsziBlclfu0s$

Back to the top