| CARVIEW |
Select Language
HTTP/2 301
date: Mon, 19 Jan 2026 03:53:02 GMT
content-type: text/html; charset=iso-8859-1
location: https://doc.akkasource.org/rest
server: cloudflare
host-header: 6b7412fb82ca5edfd0917e3957f05d89
x-proxy-cache: MISS
x-proxy-cache-info: 0301 NC:000000 UP:
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=F9AGdjtUhLrbZ%2Bh8Kpba5diLk9CWLR7zgYpmqFEVFYibJ6bbNlEgv%2BMNUe%2BEELrYfm22fM6HkA0GrtxaLgh68OLRDT7feKRarxbm16twP50Mag%3D%3D"}]}
cf-ray: 9c0361f65a4647ea-BOM
alt-svc: h3=":443"; ma=86400
HTTP/1.1 200 OK
Date: Mon, 19 Jan 2026 03:53:02 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: cloudflare
Nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
Vary: Accept-Encoding
X-Httpd: 1
Host-Header: 6b7412fb82ca5edfd0917e3957f05d89
X-Proxy-Cache: MISS
X-Proxy-Cache-Info: 0 NC:000000 UP:
Report-To: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=LWnGF%2FdsbqxCiYV5yJZreDd20KktGiVzlSYyjfdB6dC%2Bff46RKCzNuvVXe5ZJs4tBPk8K1Uf1s8Flwg2AMybUvAXR%2Bqg5mt6a9yjNoJMF%2BrUVA%3D%3D"}]}
cf-cache-status: DYNAMIC
Content-Encoding: gzip
CF-RAY: 9c0361fd4c813a39-BOM
alt-svc: h3=":443"; ma=86400
akka - rest
Home
Download
Getting Started
Build & run Akka
Documentation
Project Info
- Source Code
- Maven Repository
- Team
- Issue Tracking
- Mailing List
- License
- Release Notes
- Developer Guidelines
- Sponsors
- Benchmark
- Commercial Support
Join this Wiki-
Recent Changes
-
Manage Wiki
Protected
Module stability: STABLE
Akka supports the upcoming JSR for REST called JAX-RS (JSR-311). It allows you to annotate your Active Objects and/or Actors with JAX-RS annotation to expose them as REST services through JSON, XML, HTML, Thrift, Protobuf etc.
You can deploy your REST services directly into the Akka kernel. All you have to do is to drop the JAR with your application containing the REST services into the ‘$AKKA_HOME/deploy’ directory and define a “boot class”. WAR deployment is coming soon.
The boot class is needed for Akka to bootstrap the application and should contain the initial supervisor configuration of the REST components. This is needed in order to register them as JAX-RS services.
The boot class should be a regular POJO with a default constructor in which the initial configuration is done. The boot class then needs to be defined in the ‘$AKKA_HOME/config/akka.conf’ config file like this:
If you deploy Akka in another JEE container, don't forget to add Akkas initialization and cleanup hook:
Here are an Active Object and Actor example of a REST service with a boot class.
RESTful Active Object.
Boot class defining the Active Object.
RESTful Actor.
Boot class defining the Actor.
Take the Maven POM file from the akka-samples-scala as an example on how to build and deploy this example.
Pinky has a slick Akka integration. Read more here
| Details |
last edit by |
|
|---|---|---|
| Tags |
REST
Module stability: STABLE
When using Akkas embedded servlet container:
Akka supports the upcoming JSR for REST called JAX-RS (JSR-311). It allows you to annotate your Active Objects and/or Actors with JAX-RS annotation to expose them as REST services through JSON, XML, HTML, Thrift, Protobuf etc.
You can deploy your REST services directly into the Akka kernel. All you have to do is to drop the JAR with your application containing the REST services into the ‘$AKKA_HOME/deploy’ directory and define a “boot class”. WAR deployment is coming soon.
Boot configuration class
The boot class is needed for Akka to bootstrap the application and should contain the initial supervisor configuration of the REST components. This is needed in order to register them as JAX-RS services.
The boot class should be a regular POJO with a default constructor in which the initial configuration is done. The boot class then needs to be defined in the ‘$AKKA_HOME/config/akka.conf’ config file like this:
<akka> boot = ["sample.java.Boot", "sample.scala.Boot"] # FQN to the class doing initial active object/actor # supervisor bootstrap, should be defined in default constructor ... </akka>
When deploying in another servlet container:
If you deploy Akka in another JEE container, don't forget to add Akkas initialization and cleanup hook:
<web-app> ... <listener> <listener-class>se.scalablesolutions.akka.servlet.Initializer</listener-class> </listener> ... </web-app>
Here are an Active Object and Actor example of a REST service with a boot class.
Java API: Active Objects
RESTful Active Object.
@Path("/hello") public class HelloService { @GET @Produces({"application/json"}) public String hello() { return "hello" } }
Boot class defining the Active Object.
public class Boot { public Boot() throws Exception { ActiveObjectManager manager = new ActiveObjectManager(); manager.configure( new RestartStrategy(new OneForOne(), 3, 5000, new Class[]{Exception.class}), new Component[] { new Component( com.biz.HelloService.class, new LifeCycle(new Permanent(), 1000), 1000) }).supervise(); } }
Scala API: Actors
RESTful Actor.
@Path("/hello") class HelloActor extends Actor { private case object Hello @GET @Produces(Array("application/json")) def hello = (this !! Hello).getOrElse("Couldn't say hello") def receive = { case Hello => reply("hello") } }
Boot class defining the Actor.
class Boot { val factory = SupervisorFactory( SupervisorConfig( RestartStrategy(OneForOne, 3, 100, List(classOf[Exception])), Supervise( new HelloActor, LifeCycle(Permanent)) :: Nil)) factory.newInstance.start }
Take the Maven POM file from the akka-samples-scala as an example on how to build and deploy this example.
Using Akka with the Pinky REST/MVC framework
Pinky has a slick Akka integration. Read more here
Copyright 2009-2010 - Scalable Solutions AB

