Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Programmatically generating HTTP requests from within Jetty process

Ok, I acknowledge this may come across as an odd question.

 

In an embedded Jetty process, is there a way to programmatically generate an HTTP request and receive a response without resorting opening a socket e.g. HTTPUrlConnection?

 

Why on earth would I want to do such a thing?

 

I have a RESTful web service implemented with Jersey and server up by embedded Jetty.  In the same embedded Jetty process I’ll also be serving WebSocket connections, likely speaking my own subprotocol.

 

As part of the subprotocol I’d like for WebSocket clients to have the ability to perform CRUD operations on my web service resources.  I’m considering different ways to skin this cat, one of which being to push an appropriate HTTP request for the web service to Jetty and return the results to the WebSocket client.  Since both the WebSocket and web service are running in the same process, on the surface it seems that there would be performance advantages to accomplishing this though a method call rather than hitting the network.

 

Better ideas are certainly welcome.

 

Thanks!

 


Back to the top