GithubHelp home page GithubHelp logo

eajee's Introduction

EaJEE : JEE made easy

Temporary README

This repo will contain a set of specialized, easy to extend Servlets, filters, etc.

The goal is to make it extremely easy to write complex applications without the need for huge frameworks.

Example

Here's an example of the ActionServlet, which maps urls of the form /action/p1/p2/... to calls for public methods of the form doAction(String p1, String p2, ...)

import eajee.http.ActionResponse;
import eajee.http.ActionServlet;
import eajee.http.action.FileResponse;
import eajee.http.action.TextResponse;

public class PhotoServlet extends ActionServlet {
  private static final long serialVersionUID = -219881991336474131L;

	private String IMAGE_FOLDER = "...";

	private String getPictureTitle(String pictureId) {
		...
	}

	private String getPictureDescription(String pictureId) {
		...
	}

	public ActionResponse doAbout(String pictureId) {
		return new TextResponse(
				this.getPictureDescription(pictureId));
	}

	public ActionResponse doView(String pictureId) {
		return new FileResponse("image/jpeg", 
				IMAGE_FOLDER + "/" + pictureId + ".jpg",
				this.getPictureTitle(pictureId) + ".jpg");
	}
}

assuming this servlet is mapped to the path /pictures (on localhost:8080/testApp), the URL http://localhost:8080/testApp/pictures/view/1098756 would point to the image itself (for download/embed), while http://localhost:8080/testApp/pictures/about/1098756 would show a description/comment of the picture (served as text/plain)

more

Another example is the RestServlet, used to easily create a REST web service, separating the object management aspect (storing, retrieving, etc) from the Input/Output handling, so that the same actual resources can be presented in multiple ways (depending on the request).

Starting by extending the RestServlet abstract class will pretty much force you through the right steps ... while I write a tutorial for it (soon).

Other elements will be added once I reach a stable enough API, current (UNSTABLE) code can be found on other branches (other than master).

eajee's People

Contributors

reda-ea avatar

Watchers

James Cloos avatar  avatar

eajee's Issues

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.