Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/j256/simple-web-framework
Simple web framework for providing annotation based web request handling
https://github.com/j256/simple-web-framework
annotations java web-framework
Last synced: 3 months ago
JSON representation
Simple web framework for providing annotation based web request handling
- Host: GitHub
- URL: https://github.com/j256/simple-web-framework
- Owner: j256
- Created: 2014-01-12T19:12:54.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-06-13T22:46:57.000Z (over 1 year ago)
- Last Synced: 2024-05-01T23:46:10.942Z (8 months ago)
- Topics: annotations, java, web-framework
- Language: Java
- Homepage:
- Size: 184 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Simple Web Framework
====================Java Jetty web framework which uses the JSR annotations.
Right now the docs on this package are very minimal. My apologies. Drop me a line if you are interested in
using this and I'll get some docs, tests, and sample programs going.Enjoy, Gray Watson
## Working Sample
Here's a little sample web program using this framework. Working sample in
SampleWebProgram.java down in src/test/java/.../example:public class SimpleWebProgram {
public static void main(String[] args) throws Exception {
// start jetty server on port 8080
Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(8080);
connector.setReuseAddress(true);
server.addConnector(connector);
// register our service with a service-handler
ServiceHandler serviceHandler = new ServiceHandler();
serviceHandler.registerWebService(new OurService());
serviceHandler.registerResultDisplayer(new StringResultDisplayer());
// set the handler on the server, this could be a HandlerList...
server.setHandler(serviceHandler);
server.start();
// you'll have to kill the jvm because of the jetty threads
}
@WebService @Produces({ "text/html" })
protected static class OurService {
@WebMethod @Path("/") @GET
public String root(@QueryParam("value") String value) {
// build a little stupid html page
StringBuilder sb = new StringBuilder();
sb.append("\n");
sb.append("OurService Web Server
\n");
if (value != null) {
sb.append("value is '" + value + "'
\n");
}
sb.append("\n");
sb.append("Please enter value: ");
sb.append("");
sb.append("\n");
sb.append("\n");
sb.append("\n");
return sb.toString();
}
}
}# ChangeLog Release Notes
See the [ChangeLog.txt file](src/main/javadoc/doc-files/changelog.txt).