Simplistic Router With WebStandards

In this screencast I'm using the standard onhashchange event listener to replace a section with content loaded from an external file. It is a simplistic router:

This screencast is bonus material from: webstandards.training. You might also like: webcomponents.training.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

From Jakarta EE Profiles over Exception Handling To Swing Migrations -- 50th airhacks.tv

"Jakarta EE Profiles and News, Exception Handling, TransactionSynchronizationRegistry, UUID progation and XA, equals, hashcode and JPA, remote CDI, websockets testing, Code Coverage, Swing Migration and Thin WARs with Hibernate" or 50th airhacks.tv is available:

Any questions left? Ask now: https://gist.github.com/AdamBien/dc00f6b83c2430c91533486e72fb4d54 and get the answers at the next airhacks.tv.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Simplest Possible MicroProfile Maven Kickstarter

Execution of the microprofile-essentials-archetype (see also Simplest Possible Java EE 8 Kickstarter):

mvn archetype:generate -DarchetypeGroupId=com.airhacks -DarchetypeArtifactId=microprofile-essentials-archetype -DarchetypeVersion=0.0.1 -DgroupId=com.airhacks -DartifactId=[YOUR_PROJECT_NAME] -Dversion=0.0.1 -Darchetype.interactive=false --batch-mode

creates a ready to use 3.5kB Thin WAR project with configured JAX-RS runtime, a resource with a GET endpoint ("/ping"), 25 lines of pom.xml with a single microprofile dependency:

 <dependency>
    <groupId>org.eclipse.microprofile</groupId>
    <artifactId>microprofile</artifactId>
    <version>1.3</version>
    <type>pom</type>
    <scope>provided</scope>
</dependency>
and a shell script which executes the the maven and Docker build and starts the image. The build-and-run cycle takes about ...5 seconds.

Payara 5 Full server is not only Java EE 8 compliant, it also comes with MicroProfile 1.2 APIs -- so you don't have to use any esoteric runtimes.

Payara 5 Dockerfile is also available from: docklands. The Maven Archetype is available in: https://github.com/AdamBien/microprofile-essentials-archetype.

See you at Java EE Microservices. Is Munich's airport too far? Learn from home: javaeemicro.services.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Jakarta EE Profiles and News, Exception Handling, UUID progation, equals, hashcode and JPA, remote CDI, websockets testing, or 50th airhacks.tv

Topics and questions (https://gist.github.com/AdamBien/e96e52400c5582f86d5f4962a68470ac)

for the 50th airhacks.tv.
  1. Swing Migrations Workshop
  2. Jakarta EE News
  3. Exception handling strategies
  4. Transparent and remote UUI propagation
  5. Thin WARs and 3rd party JPA
  6. Equals and hashCode in JPA entities
  7. Remote CDI events
  8. WebSockets testing
  9. Jakarta EE's future
  10. Combining Primefaces with JAX-RS
  11. When Numbers Are More Important Than Quality

Ask questions during the show via twitter mentioning me: http://twitter.com/AdamBien (@AdamBien) or using the hashtag: #airhacks. You can join the Q&A session live each first Monday of month, 6 P.M at airhacks.tv or http://www.ustream.tv/channel/adambien

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Live-Coding No-Ceremony Microservices with Thin WARs

In this screencast I implemented Thin WAR microservices, let them communicate and implemented microservice patterns from scratch. I started with Java EE full profile and ended with microprofile. No tricks, no frameworks, no magic:

See you at Java EE Microservices. Is Munich's airport too far? Learn from home: javaeemicro.services.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Java EE 8 / JSON-P 1.1: Convenient JsonArray to POJO conversion

With the JSON-P 1.1 / Java EE 8 method: getValueAs a JsonArray instance can be directly converted into a POJO-List. The POJO's constructor:


import javax.json.JsonObject;

public class Developer {

    private String name;
    private String language;

    public Developer(JsonObject input) {
        this.name = input.getString("name", null);
        this.language = input.getString("language", null);
    }

    @Override
    public String toString() {
        return "Developer{" + "name=" + name + ", language=" + language + '}';
    }
}

...can be used as the converter function / parameter of getValueAs:


import java.util.List;
import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonObject;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;

public class MappingArrayValuesTest {

    @Test
    public void map() {
        JsonArray developerArray = getDevelopers();
        List<Developer> developers = developerArray.getValuesAs(Developer::new);
        assertThat(developers.size(), is(2));
        System.out.println("developers = " + developers);
    }

    JsonArray getDevelopers() {
        return Json.createArrayBuilder().
                add(create("brendan", "JavaScript")).
                add(create("james", "Java")).
                build();
    }

    JsonObject create(String name, String language) {
        return Json.createObjectBuilder().
                add("name", name).
                add("language", language).
                build();
    }
}

The successful test outputs: developers = [Developer{name=brendan, language=JavaScript}, Developer{name=james, language=Java}]

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

From Xelphi, over Nashorn To JVM Compiler Innovation with GraalVM

8th episode of airhacks.fm, or a conversation with @JaroslavTulach about the beginnings of NetBeans, xelphi, JavaDoc, Glasgow, JavaBeans for the network, LimeTree, mounting jars, deals with Jonathan Schwartz, Bck2Brws (Back To Browser), Duke Script, Multi OS Engine, JavaFX, Java to JavaScript transpiler, Typescript, Frameworks, GraalVM, Project Maxwell , Maxine VM, C2 compiler, IGV, nashorn and performance, Graal and Twitter, JEP metropolis, Graal speedup, the most complex statement, speculative interpreters, talk to your compiler, Truffle, SubstrateVM, avatar.js, node.js on JVM, Graal Installation, language interop is available.

Subscribe to airhacks.fm podcast via: iTunes or RSS

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Binding WildFly To IP-Address

To bind WildFly to a particular address, launch it with the -b flag: ${WILDFLY_HOME}/bin/standalone.sh -b=0.0.0.0 (see e.g. Docklands Wildfly image).

Alternatively you can also change the defaults in the standalone-full.xml from 127.0.0.1 to 0.0.0.0 (0.0.0.0 means: all interfaces, what is useful for development):


<interfaces>
    
    <interface name="management">
        
        <inet-address value="${jboss.bind.address.management:0.0.0.0}"/>
    
    </interface>
    
    <interface name="public">
        
        <inet-address value="${jboss.bind.address:0.0.0.0}"/>
    
    </interface>
    
    <interface name="unsecure">
        
        <inet-address value="${jboss.bind.address.unsecure:0.0.0.0}"/>
    
    </interface>

</interfaces>    
See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

JSON-B, Groovy and Jenkins, CQRS, 40k with JSF, EJB TX or 48th airhacks.tv is available

36mins: with JSON-B and hierarchical mapping, Groovy and Jenkins pipelines, CQRS, 40k with (deprecated) JSF, EJB TX, JSON-B, Java EE migrations and I'm performing live a code review / refactoring.

Also checkout past episodes: airhacks.tv

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Local-Variable Type Inference Java 10 Example

Java 9 legacy code:


@Test
public void java9Legacy() {
    Map<String, String> devs = new HashMap();
    devs.put("duke", "java8");
    for (Map.Entry<String, String> dev : devs.entrySet()) {
        System.out.println(dev.getKey() + " " + dev.getValue());
    }
}

...can be streamlined with Java 10 and Local-Variable Type Inference (JEP-286):


import java.util.HashMap;
import java.util.Map;
import org.junit.Test;

public class VariableTypeInferenceTest {

    @Test
    public void inferTypeWithJava10() {
        var modernDevs = new HashMap<String, String>();
        modernDevs.put("duke", "java10");
        for (var dev : modernDevs.entrySet()) {
            System.out.println(dev.getKey() + " " + dev.getValue());
        }
    }
}

The code above runs on openJDK 10 GA JDK 10, was edited with Apache Netbeans 9 and built with Maven 3.5.0


        <project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.airhacks</groupId>
        <artifactId>variable-type-inference</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <maven.compiler.source>10</maven.compiler.source>
            <maven.compiler.target>10</maven.compiler.target>
        </properties>
    </project>    

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License