Watch and Deploy (WAD) Utility Released

Watch and Deploy WAD watches the src/main/java directory, uses the pom.xm to build your ThinWAR and copies the ./target/[name].war into the specified folder.

Usage: [THIN_WAR]/java -jar wad.jar /openliberty/wlp/usr/servers/defaultServer/dropins/

Download wad.jar.

See you at Web, MicroProfile and 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: Online Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

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

WebComponents With or Without Java -- A Conversation with Marcus Hellberg

Subscribe to airhacks.fm podcast via: RSS iTunes.

An airhacks.fm conversation with @marcushellberg about:
"Vaadin in Turku, simplifying with EJB 3 without layers, hacking JavaScript in browser, www.itmill.comwww.millstone.org and the history of vaadin, how Joonas started vaadin, the benefits of opensource, WebComponents with Vaadin Elements, Java generates WebComponents, Java is listening to WebComponents, melting frameworks, framework-less development with WebStandards, effectiveweb workshop easy to explain ServiceWorkers, higher level caching strategies with WorkBox, simple code first, Markus Code One Talk, lit-html is the missing piece, high performance with lit-html, lit-html outperforms virtual DOM, Angular is J2EE for the frontend, Angular's clunky module system predates ES 6 modules, future Angular versions could migrate away from the proprietary module system, possible breaking changes every 6 months, questionable DI in browser, less code with WebStandards, polyfills make your app leaner, WebStandards are moving forward, webworkers and webassembly, the lean WebStandard revolution, enterprise integration with WebComponents, Custom Elements Everywhere, Polymer's mission statement is to go away, polymer is the anti framework, npm is the remaining strange thing, the future of Vaadin, PWA for Java developers, upcoming WebStandards, and layered APIs, Vaadin Flow, and Vaadin Components, @marcushellberg, @vaadin"

See you at Web, MicroProfile and 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: Online Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

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

Fetching the name of the current working directory with Java 7+

Paths.get("").toAbsolutePath().getFileName() returns the name of the current directory:


    import java.nio.file.Path;
    import java.nio.file.Paths;
    import static org.hamcrest.CoreMatchers.is;
    import static org.junit.Assert.assertThat;
    import org.junit.Test;
    
    public class AppTest {
    
        @Test
        public void currentFolderFolderName() {
            String expected = "[CURRENT WORKING DIRECTORY NAME]";
            Path currentPath = Paths.get("").toAbsolutePath().getFileName();
            assertThat(currentPath.toString(), is(expected));
        }
    }
    

If you launch the test in directory: "/duke/work/coolness", currentPath will yield coolness.

See you at Web, MicroProfile and 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: Online Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

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

SystemTests with Apache CXF, JAX-RS, JSON-P on Java 11

To use Apache CXF JAX-RS 2.X client with JSON-P on Java 11 you will have to include the following dependencies first:


<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency> 
<!-- Java 11 comes without the "enterprise" dependencies -->
<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
    <scope>test</scope>
</dependency>   
<dependency>
    <groupId>javax.activation</groupId>
    <artifactId>activation</artifactId>
    <version>1.1.1</version>
    <scope>test</scope>
</dependency>   
<!-- cxf / JAX-RS client dependencies dependencies -->        
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-rs-client</artifactId>
    <version>3.1.4</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-rs-extension-providers</artifactId>
    <version>3.2.7</version>
    <scope>test</scope>
</dependency>   
<!-- JSON-P -->             
<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.json</artifactId>
    <version>1.1.4</version>
    <scope>test</scope>
</dependency>

The Java release version has to be set to 11 and the maven compiler to the most recent version:


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                    <source>11</source>
                </configuration>                
            </plugin>
        </plugins>        
    </build>    

You will have to register the JsrJsonpProvider to get automatic serialization into JSON-P objects:


public class HealthCheckIT {

    private Client client;
    private WebTarget tut;

    @Before
    public void init() {
        this.client = ClientBuilder.newClient().register(JsrJsonpProvider.class);
        this.tut = this.client.target("http://localhost:9080/health");
    }

    @Test
    public void health() {
        Response response = this.tut.request().get();
        assertThat(response.getStatus(), is(200));
        JsonObject health = response.readEntity(JsonObject.class);
        JsonArray checks = health.getJsonArray("checks");
        //...
    }
}
See you at Web, MicroProfile and Java EE Workshops at MUC Airport, particularly at the Java EE CI/CD, Testing and Quality workshop


NEW: Online Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

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

Death of logging, technology and architectures, CMS and blogs, OpenJDK in production, data consistency and 2PC -- or 57th airhacks.tv

Topics and questions (https://gist.github.com/AdamBien/d6af498fafa2c1dc8497f254140e6a31) for the 57th airhacks.tv:

  1. Server migrations stories
  2. Payara on OpenShift
  3. CMS for blogs
  4. Architecture as abstraction of technology?
  5. Benefits of the Hexagonal Architecture
  6. Eclipse Glassfish in Docklands
  7. Apache POI and ThinWARs
  8. OpenJDK and Corretto in production
  9. Mocking out ManagedScheduledExecutorService
  10. @Inject vs. @EJB and pooling
  11. Microservices, data consistency and 2PC / XA
  12. The death of logging frameworks

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 Web, MicroProfile and 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: Online Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

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

A Conversation with the JavaMan about Sun, Java and OpenSource

Subscribe to airhacks.fm podcast via: RSS iTunes

An airhacks.fm conversation with Bruno Souza, the "The JavaMan",
about: hello world on CPM machines without GitHub, TRS-80 vs. ZX Spectrum, Basic, Clipper, scientific Prolog work, C, copying assembler from magazines, lonely hacking, programming is the ability to creating things, no use for second disc drive, prolog application for cloud pattern recognition and cloud removal, cool Sun machines, AI for free, Sparc Station 10, back to work, work over university, John Gage and the first demonstration of Java, HotJava, OAK, Banco do Brasil was an early Java adopter in 1996, Fabiane Nardon, income tax and border control Java desktop applications, Java Ring, Java Card, Sun Java Studio, Sun Java Workshop, JBuilder, NetBeans, early JavaONEs, John Gage and "We are all Brasilians", Java source answers all questions, Richard Stallman visits Brasil, in 1998 Netscape browser was opensourced, , Open Sources 2.0: The Continuing Evolution, Brasilian Government gains independence with Java, Software Livre, Kaffee JVM, Patrick Curran, Simon Phipps, The People Who Brought You FOSS Java, Dalibor Topic, @@robilad, Geir Magnusson, Apache Harmony, http://toolscloud.com, you can't be just technical, inability to tell the vision, Summa Technologies, CodeONE and speaker's secrets, Code4.life, Best Developer Job Ever, Bruno on twitter:@brjavaman.

See you at Web, MicroProfile and 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: Online Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

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

Creating DTOs Without Mapping with JPA and Java EE

The Ping class is a JPA entity and JSON-B DTO at the same time:


@Entity
@NamedQuery(name = "all", query = "SELECT p FROM Ping p")
public class Ping {

    @Id
    @GeneratedValue
    public long id;

    public String message;
    public int age;

}

...the Ping class can be directly read from a DB:

@Stateless
public class PingStore {

    @PersistenceContext
    EntityManager em;

    public List<Ping> all() {
        return this.em.createNamedQuery("all", Ping.class).getResultList();
    }
}        
        
...and exposed via JAX-RS:

@Path("ping")
public class PingResource {

    @Inject
    PingStore store;

    @GET
    public List<Ping> all() {
        return this.store.all();
    }
}    

curl -i http://localhost:8080/flight/resources/ping/ returns:

[{"age":0,"id":1,"message":"Enjoy Java EE 8!"},{"age":0,"id":2,"message":"Enjoy Java EE 8!"}]    

A dedicated DTO:

public class PingSlice {

    public long timestamp;
    public String flightName;

    public PingSlice(String flightName) {
        this.flightName = flightName;
        this.timestamp = System.currentTimeMillis();
    }

}

can be directly mapped by the EntityManager:

public List<PingSlice> allSlices() {
        return this.em.createQuery("SELECT new com.airhacks.ping.entity.PingSlice(p.message) from Ping p", PingSlice.class).
                getResultList();
    }


exposed via JAX-RS again:

@GET
@Path("slices")
public List<PingSlice> allSlices() {
    return this.store.allSlices();
}

and returned as JSON (curl -i http://localhost:8080/flight/resources/ping/slices):

[{"flightName":"Enjoy Java EE 8!","timestamp":1542797875539},{"flightName":"Enjoy Java EE 8!","timestamp":1542797875539}]    

Also primitive types like String, can be fetched with JPA:

public List<String> allStrings() {
        return this.em.createQuery("SELECT p.message from Ping p", String.class).
                getResultList();
    }    

...exposed via JAX-RS:

@GET
@Path("strings")
public List<String> allStrings() {
    return this.store.allStrings();
}

and returned as JSON (curl -i http://localhost:8080/flight/resources/ping/strings)

["Enjoy Java EE 8!","Enjoy Java EE 8!"]

With Java EE JPA Entities can be used as DTOs first. A different "view" to the JPA entities can be implemented on-demand and without explicit mapping layers or mappers.

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


NEW: Online Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

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

No Dependencies, No "Bus Factor" Problems, No MIgrations -- A SPA / PWA with MicroService Backend in 45min Devoxx 2018

No dependencies, no code generators, no plugins. Lets create a full stack application with WebStandards frontend without any frameworks and discuss the design decisions on-the-go. #slideless #nomigrations #usetheplatform

See you at Web, MicroProfile and 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: Online Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

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

A Conversation with Scott McNealy about SUN, Innovation, OpenSource, JavaSoft, Java and Oracle

Subscribe to airhacks.fm podcast via: RSS iTunes.

An airhacks.fm conversation with Scott McNealy (@scottmcnealy), co-founder of Sun Microsystems, about:
"how Vinod Khosla, Bill Joy, Andy Bechtolsheim and Scott started Stanford University Network (SUN), Onyx Systems and Pizza Boxes for 40k USD, Sun opensourced 80% of its R & D budget, Sun was top 40 R & D spenders, opensource lowers the barrier to exit, IBM buying RedHat, Sun was the first company in 1982 shipping with TCP/IP, Scott was smart and the other founders were brilliant, Bill Joy wanted to open NFS or "what is a phone worth which doesn't connect with other phones", Java Ring was on the cover of Fortune Magazine, Network is the Computer, Java was the greatest marketing efforts ever, missing the router hype was the earliest mistake at Sun, the beginnings of JavaSoft, Bill Joy wanted to work with James Gosling, Java was invented to build a "clicker", Netscape, Java, JavaScript, LiveScript, JavaSoft was loosely coupled and highly aligned business unit, Java went with Netscape viral, being nervous and unprepared as speaker - people would like to hear what do you think as a speaker, "you don't have privacy, get over it", Steve Jobs at JavaOne, Andy Bechtolsheim was the "industrial" Steve Jobs, Sun was having fun without offending somebody, John Gage - the Chief Science "Fiction" officer and the perfect MC for Java, 130 dollars for 3rd grade text book -- the beginnings of curriki, global community of opensourcing education, curriki is a wildly successful startup, Scott is chairman of wayin.com and still spends a lot of time with curriki, corporate capitalism - private charity or Seperation of Concerns, the job of a chairman, Larry Ellison and Scott, Scott met Larry on the airplane in early eighties -- and Larry gave Scott a shaver, behind the scenes of Sun's acquisition, Wayin -- the new project, Scott at twitter: @scottmcnealy."

See you at Web, MicroProfile and 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: Online Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

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 + MIcroProfile Fusion = MicroDeployments

Deploying a 5.2 kB Jakarta EE (Java EE 8) + MicroProfile Thin WAR with Java EE 8 and MicroProfile features:

See you at Web, MicroProfile and 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: Online Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

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

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