Code Monkey home page Code Monkey logo

aradon's Introduction

<h1>Aradon - Lightweight Application Service Platform</h1>


<h2>Quick start</h2>

<p>Start a web server on port 9000 and serve that you want:</p>

package net.ion.radon;
...

public class TestFirst {
	
	private Aradon aradon ;
	@Before
	public void setUp() throws Exception {
		this.aradon = AradonTester.create().mergeSection("sname").addLet("/hello/, /hello/{name}", "hello", HelloLet.class).getAradon() ;
	}
	
	@After
	public void tearDown() {
		aradon.stop() ;
	}
	
	@Test
	public void hello() throws Exception {
		AradonClient ac = AradonClientFactory.create(aradon) ;
		Response response = ac.createRequest("/sname/hello/bleujin").handle(Method.GET) ;
		Assert.assertEquals(200, response.getStatus().getCode()) ;
		Assert.assertEquals("Hello bleujin", response.getEntity().getText()) ;
	}
	
	@Test
	public void http() throws Exception {
		aradon.startServer(9000) ;
		
		AradonClient ac = AradonClientFactory.create("http://localhost:9000") ;
		Response response = ac.createRequest("/sname/hello/bleujin").handle(Method.GET) ;
		Assert.assertEquals(200, response.getStatus().getCode()) ;
		Assert.assertEquals("Hello bleujin", response.getEntity().getText()) ;
	}

	
	@Test
	public void post() throws Exception {
		AradonClient ac = AradonClientFactory.create(aradon) ;
		Response response = ac.createRequest("/sname/hello/").addParameter("p1", "bleujin") .handle(Method.POST) ;
		Assert.assertEquals(200, response.getStatus().getCode()) ;
		Assert.assertEquals("Hi bleujin", response.getEntity().getText()) ;
	}
	
	
}

class HelloLet extends AbstractServerResource{
	
	@Get
	public String hello(){
		return "Hello " + getInnerRequest().getAttribute("name") ; 
	}

	@Post
	public String postHello(){
		return "Hi " + getInnerRequest().getParameter("p1") ; 
	}

}

	
</code></pre>


Project DOC : https://github.com/bleujin/aradon/blob/master/resource/docs/
Html Pt : http://htmlpreview.github.com/?https://github.com/bleujin/aradon/master/resource/docs/html/index.htm#/2

aradon's People

Contributors

bleujin avatar korgeek avatar muheun avatar novision avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.