A Tiny Java Restful Services Framework

View project on GitHub


Batsy is a tiny open-source restful framework. Batsy has a embedded Tomcat Container and you don't have to deploy a web server container. For now you must add to project Batsy as a jar file. In the future it will be in Maven Repository.

Getting Started

First you have to download latest Batsy jar file and add your project build path. Then your add your main method below lines.

public class YourApplication {
	public static void main(String... args) throws BatsyException {;

Then you need to add your resource folder In you can give context path and port as you see.

batsy.server.contextPath = /BatsyTest
batsy.server.port = 8080
That's it!. Now you can run your program.

Create Your First Service

First, create a class and annotated with @RestController. This means your service methods will be in this class.

public class YourService {


After that write your methods. Then annotated them @RequestMapping and give them paths and request methods.

Then in method parameters use @QueryParam (for query string parameters) or @PathParam. Like this.

public class YourService {
	@RequestMapping(path = "/path/{name}", method = RequestMethod.GET)
    public String greeting(@QueryParam(paramName = "yourName") String yourName, 
	 @PathParam(paramName = "name") String name) {
        return "Hello " + yourName + " I am " + name;
Request your browser the path, localhost:8080/BatsyTest/path/batsy?yourName=ufuk
Then result is, Hello ufuk I am batsy

That's it, you created your first service. Easy to use.

Also you can use BatsyResponse in your method return type. Like this.

Note : I recommend that way in your service response.
public class YourService {
	@RequestMapping(path = "/path", method = RequestMethod.GET)
    public BatsyResponse greeting(@QueryParam(paramName = "name") String name) {
        new BatsyResponse(new YourDTO().setName(name), HttpStatusCode.OK);

Authors and Contributors

Batsy developed by @ufukhalis, in 2016

Support or Contact

Use Batsy, give feedback, contact me or support me, Thanks for everything. Mail :