1
votes

Just wondering if this setup is possible:

  1. Java application running and monitoring embedded jetty server
  2. Restlet application deployed in embedded jetty exposing RESTful API
  3. Java based webapp (Spring, Play, whatever) deployed in embedded jetty and talking to the RESTful API via Ajax

I know that Restlet can serve a role of HTTP server via jetty connector, but this is not really what I need. What I want is servlet container (embedded jetty) run from java application and exposing two web applications: RESTful API and webapp client.

1
Ok, and hooooow? ;) Do I compile my Restlet app to be a *.war and then deploy it along the way with webapp? Or perhaps somehow instruct Jetty to run entry point of Restlet app to register all routers? - ŁukaszBachman
I would go for two war's, or just combine everything in a single war. I don't see the point in separating the functionality - Mark Bakker
One application is already ready. I just need to supplement it with user interface and embed the two into one server instance. - ŁukaszBachman

1 Answers

0
votes

Ok, so for my case it turned out that it's even easier than I thought. It will suffice to instruct Restlet to serve some static content via this sample code:

Directory directory = new Directory(getContext(), "file:///user/data/files/");
Router router = new Router(getContext());
router.attach("/static/", directory);

This not exactly answers my question, but it solves my problem. As there were no more answers, I'm closing this issue.