Coder Social home page Coder Social logo

happor's Introduction

happor

A netty-spring-based web controller framework.

I consider that Netty bound with SpringMVC could be a very nice web MVC framework instead of Tomcat + Servlet + SpringMVC.

However, SpringMVC is based on Servlet and, it's hard to dettach Servlet from SpringMVC. In some implements, we may only focus on controller usage, such as RESTful API develop.

Things can be simplification. By using Spring IoC to make a controller framework based on Netty without Servlet, I setup this project.

#A hello-world demo

@Controller(method="GET", uriPattern="^/test/(\\w+)")
public class Test extends HttpNormalHandler {
	
	@UriSection(1)
	private String name;

	@Override
	protected void handle(FullHttpRequest request, FullHttpResponse response) {
		// TODO Auto-generated method stub
		String words = "hello " + name;
		response.content().writeBytes(words.getBytes());
		response.headers().set("Content-Type", "text/plain");
		response.headers().set("Content-Length", response.content().readableBytes());
	}

	@Override
	protected void atlast() {
		// TODO Auto-generated method stub
		
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		HapporAutomaticContext context = new HapporAutomaticContext();
		context.runServer();
	}

}

Run and visit http://localhost/test/someone, the browser will show hello someone.

happor's People

Contributors

xphh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

happor's Issues

how to run this project?

hi , first download this project ,after run ServerMain.class main function;
but has Exceptioned:

java.io.FileNotFoundException: C:\Users\Administrator\Desktop\ht.jar (系统找不到指定的路径。) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:225) at java.util.zip.ZipFile.<init>(ZipFile.java:155) at java.util.jar.JarFile.<init>(JarFile.java:166) at java.util.jar.JarFile.<init>(JarFile.java:103) at cn.lechange.happor.utils.PackageUtil.getClassNameByJar(PackageUtil.java:108) at cn.lechange.happor.utils.PackageUtil.getClassNameByJars(PackageUtil.java:166) at cn.lechange.happor.utils.PackageUtil.getClassName(PackageUtil.java:61) at cn.lechange.happor.utils.PackageUtil.getClassName(PackageUtil.java:38) at cn.lechange.happor.container.JarImporter.load(JarImporter.java:48) at cn.lechange.happor.container.JarContainerServer.load(JarContainerServer.java:109) at cn.lechange.happor.container.JarContainerServer$1.run(JarContainerServer.java:155) at java.util.TimerThread.mainLoop(Timer.java:555)

can you help me to run this project ,thanks !
and "conf/containerServer.xml" this file not in this project ...
and fix this project some problem by the way !

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.