SkillAgentSearch skills...

Asta4d

View first web application framework

Install / Use

/learn @astamuse/Asta4d
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

News

  • 2016-11-17, 1.2-M2 is released.
  • 2016-04-13, 1.2-M1 with some essential enhancements is released.
  • 2016-01-22, asta4d-ide is release to accelerate our development with asta4d.
  • 2015-12-25, 1.1 official release "1.1-Xmas" is released.
  • 2015-12-17, the scala extension for asta4d asta4d-scala is released.
  • 2015-10-27, the 1.1-b3 with minor bug fixes is released.
  • 2015-09-07, the 1.1-b2 with minor bug fixes is released.
  • 2015-07-23, the 1.1-b1 with better Java 8 support is released.
  • 2015-02-14, the first official release "1.0-Valentines" is released at the Valentine's day!

Quick start

NOTE: There are some breaking changes related to form flow and url initialization in the recent release of 1.2-M1. The user guide will be modified in the next release, thus there may be some unmatched contents in the document if you use the newest 1.2-M1 instead of the previous stable version 1.1-Xmas.

documents

Online Sample

There is a maven archetype for asta4d. If you want to start with the archetype, you have to install Maven 3 at first. After installed Maven 3, create the sample project by the following command:

mvn archetype:generate                       \
    -DarchetypeGroupId=com.astamuse          \
    -DarchetypeArtifactId=asta4d-archetype   \
    -DarchetypeVersion=1.1-Xmas        \
    -DgroupId=<your.groupid>                 \
    -DartifactId=<your-artifactId>

or simply follow the wizard by filtered list:

mvn archetype:generate -DarchetypeGroupId=com.astamuse -DarchetypeArtifactId=asta4d-archetype -DarchetypeVersion=1.1-Xmas

The 1.1-Xmas with better Java 8 support is recommended for new projects, if you cannot use Java 8, use 1.0-Valentines instead.

After the archetype is created, enter the folder which has a "pom.xml" file, run the following command:

mvn jetty:run

Then you can access the sample project by http://localhost:8080, there are source samples shown, it is a good start from reading the samples. After you confirm the sample project is OK, you can add your own url mapping rules to /src/main/java/.../.../UrlRules.java, and also you can add your own html template files to /src/main/webapp.

Reading the Best Practice before writing your own code is recommended.

What is Asta4D

Asta4D is a view first web application framework which is friendly to designers and flexible to developers. Asta4D affords high productivity than traditional MVC architecture by "View First" architecture. It also allows front-end engineers and back-end engineers work independently without interference by separating rendering logic from template files.

Asta4D is inspired by lift which is a famous scala web application framework and it is developed by astamuse company Ltd. locating at Tokyo Japan. We are concentrating on global innovation support and developing Asta4D for our own services. Currently, Asta4D is driving our new service development.

Why Asta4D

In the past decade, plenty of Java based web application frameworks are generated. Especially the MVC architecture and JSP tag libs (or other traditional template technologies) that has greatly released our productivity. But unfortunately, we are still suffering from the following situations:

  1. The designers or front-end engineers are keeping complaining the mixed-in dynamic code, as they disturb their efforts of redesigning the page style or structure. And in the mean time, the back-end developers are also complaining that the front-end guys break the working page frequently, because redesign or the new design is hard to merge due to the huge cost of source refactoring.
  2. The developers are complaining about the poor functionalities of template language which they are using and tired from the various magic skills for complex rendering logic.
  3. The developers are discontented with the counterproductivity of MVC architecture and desire a more efficient approach.

Thus, we created Asta4D. Currently, Asta4D is driving our service site:astamuse.com

What does "Asta4D" mean

The name of Asta4D is from our company's name: astamuse. We explain the "4D" as following ways:

  1. For designers

    Asta4D consider the design friendliness as the most important factor of itself. We hope web designers can fulfil their maximum potential of creativity without squandering their time on the back-end technologies which they could never be adept at.

  2. For developers

    We hope Asta4D can help developers to achieve their work more easily. Developers would never be afflicted with complex rendering logic because they can use powerful Java language to do whatever they want since the rendering has been split from template files. View first also releases developers from the cumbersome MVC architecture, now they have more time to have a cup of coffee.

  3. 4 dimension

    We believe that Asta4D can act as a wormhole that connects the front-end and the back-end. We can move quicker by Asta4D just like we are going through the 4 dimensional space.

How Asta4D helps us

Asta4D is our solution to combat those issues. Thanks to lift, from where we learn a lot. We designed Asta4D complying with the following points:

  1. Separate template and rendering logic

    Asta4D affords front-end engineers a friendly environment by separating rendering logic from template files which are pure html files. At the mean time, back-end engineers can use the powerful Java language to implement the rendering logic without being suffering from the "poor and sometimes magic" template languages.

    There is no dynamic code in template file. An Asta4D template file is always a pure HTML file which can be easily maintained by front-end developers, it is very design friendly and we can reduce the workload for source refactoring by over 90%.

    <section>
        <article>
            <div afd:render="SimpleSnippet">dummy text</div>
            <afd:snippet render="SimpleSnippet:setProfile">
                <p id="name">name:<span>dummy name</span></p>
                <p id="age">age:<span>0</span></p>
            </afd:snippet>
        </article>
    </section>
    

    In the snippet class, we use traditional CSS selector to reference rendering target, amazing and powerful.

    public class SimpleSnippet {
    
        public Renderer render(String name) {
            if (StringUtils.isEmpty(name)) {
                name = "Asta4D";
            }
            return Renderer.create("div", name);
        }
    
        public Renderer setProfile() {
            Renderer render = Renderer.create();
            render.add("p#name span", "asta4d");
            render.add("p#age span", 20);
            return render;
        }
    }
    
  2. Testable Rendering logic

    All of the rendering logic of Asta4D is testable and you can simply test them by write simple junit cases, which can replace over than half of selenium tests.

        // prepare test target
        Renderer render = Renderer.create();
        render.add("#someIdForInt", 12345);
    
        // perform test
        RendererTester tester = RendererTester.forRenderer(render);
        Assert.assertEquals(tester.get("#someIdForInt"), 12345);
    
    

    Rendering for list data can be performed as well

        // prepare test target
        Renderer render = Renderer.create();
        render.add("#someIdForInt", Arrays.asList(123, 456, 789));
    
        // perform test
        RendererTester tester = RendererTester.forRenderer(render);
        Assert.assertEquals(tester.getAsList("#someIdForInt"), Arrays.asList(123, 456, 789));
    
    

    Further samples for test

  3. High security of being immune from cross-site(XSS/CSRF)

    Asta4D is, by nature, immune from cross-site(XSS/CSRF) problems. You do not need to take care of cross-site any more. All the rendered value would be escaped by default and your clients have no chance to put malicious contents to your server.

  4. View first

    Asta4D also affords higher productivity than traditional MVC architecture by View First mechanism. And it is also easier to change than MVC architecture.

    A controller is not necessary for request dispatch. All the requests cound be dispatched by a sort of predefined URL matching rules and could be forwarded to template files directly, which is called as view first.

    rules.add("/app/", "/templates/index.html");
    
  5. Isolate side effect with request handler

    Asta4D imports the conception of "side-effect" from functional programming languages and separating the "side-effect" by request handlers, which afford more flexibility on page rendering because the view layer is side-effect free now. Therefore Asta4D allows parallel page rendering in multiple threads as a built-in feature.

    See details about side effect

  6. Advanced MVC

    Asta4D also affords a evolved MVC architecture which is more clarified for the duty of each application layer than the traditional MVC architecture.

    By traditional MVC architecture, we often have to expand the transaction from the controller layer across to the view layer to combat the lazy load issue,

View on GitHub
GitHub Stars166
CategoryDevelopment
Updated6d ago
Forks56

Languages

Java

Security Score

80/100

Audited on Mar 25, 2026

No findings