Pular para o conteúdo principal

Postagens

What is the final solution to reuse code in JAX-RS resources?

Back in 2008 I was in college and had to finish my graduation thesis, which was about mashing Web applications. At that time that great news was REST and it was in WAR with SOAP! I came across Roy Fielding famous dissertation , read RESTful Web Services , the book that speed up truly REST APIs (we had data update with GET back then!) in the WEB and then I stated calling myself a RESTAFarian . "Stateless architectures will never work" - said some SOAP lover 10 years ago  And I was also a Java programmer! However, back then create REST services for Java was not easy. We had to use servlets and JAX-RS was still in its early days  and we already had Restlet! However, JAX-RS was the best solution: annotation based, truly REST language and more. I decided to use Jersey and Spring for my thesis. (the only time I used it, after I felt in love with RESTEasy and have been using it since then). I liked JAX-RS since 10 years ago I have to repeat code, like check nullable entitie...

Hello World, Kogito!

Kogito is what you need to bring business automation to the cloud! Kogito Quarkus extension allows you to build applications on top of quarkus, bringing native business applications, developer joy and multiple useful extensions that can be used along with Kogito. Here are some interesting links for you to get started with Kogito: Kogito Get Started Guide Kogito Quarkus Extension Guide Kogito Examples Kogito Tooling Installation Kogito + Quarkus on VS Code Tutorial If you are a video person there's also this: Wondering about where Kogito came from? Read this blog from Kris. Happy Coding!

Hello World, Quarkus!

Today JBoss community released Quarkus . I could not wait to test it. Projects can be generated using the following archetype: mvn io.quarkus:quarkus-maven-plugin:0.11.0:create      \     -DprojectGroupId=org.fxapps                        \     -DprojectArtifactId=quarkus-getting-started        \     -DclassName="org.fxapps.GreetingResource"          \     -Dpath="/hello"              With the project that was generated you can create native binaries and docker images from it. See the following video for a quick demo of a hello world application:

Adding dynamic properties to a Javascript object in a GWT + JSInterop context

GWT is a framework that allows you to program the user interface of your application in Java and later it is compiled to Javascript, which will work across all browsers. The main advantage is that you don't have to care about minification of Javascript and compatibility across browsers, easy communication with server side and it is Java, you can use Java on server and client side. With Errai you have CDI (and more) on the client side, which means that you can make your application flexible and create pluggable components. GWT in its later versions introduced JSInterop , a great way to call Javascript using Java. During the compilation the Java bean will be compiled to an equivalent Javascript code. This is good for Javascript objects with static properties, but knowing Javascript you will always find cases where the attribute name is dynamic, where the attribute is created "on the fly", for example: var myObject = {     someAttributeIJustCreated : "the value...

Debugging error "Could not import XML from stream: invalid LOC header (bad signature)" when building a Thorntail application

Tl;DR: Check if there's corrupted JARs in your maven repository When building a Thorntail 2.2.0.Final application I faced the error  Could not import XML from stream: invalid LOC header (bad signature) when trying to build the JAR using mvn clean install . I could not find what is wrong, I just downloaded the application using Thorntail generator but I was not able to run it, so frustrating. When I used the -X flag I could see the error stack trace. The part that was causing the error was: Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)     at java.util.zip.ZipFile.read (Native Method)     at java.util.zip.ZipFile.access$1400 (ZipFile.java:60) (...)     at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse (DocumentBuilderImpl.java:339)     at javax.xml.parsers.DocumentBuilder.parse (DocumentBuilder.java:121)     at org.jboss.shrinkwrap.descriptor.spi.node.dom.XmlDom...

Very simple chat using JGroups and JavaFX

I just wanted to share this small application using JGroups and JavaFX. JGroups is "a toolkit for reliable messaging" and one of the oldest and stable Java libraries. The chat code I used was the same one from JGroups sample code page , we need less than 5 codes to implement all the chat functionality!

The Image Classifier Microservice is public on Docker repository

Using fabric8 docker plugin and the project from A Java microservice for image classification using Thorntail and DeepLearning4J  post I was able to build a docker image and I pushed it to my Docker repository! In this post I am sharing the steps I followed to build the docker image and publish it. Next post I hope to show you how to run on Openshift with some real world application. Step 1: Build an image from the Thorntail project This is simple, you will need just a configuration in the maven descriptor, see the changes in the project pom.xml . Notice that I had to made a manual copy of a JAR file as described in Thorntail's issue #951 , however, I am probably missing something, that may not be a bug,. Let's wait to see what Thorntail team will provide as a feedback for that issue. I wasn't a bug, Bob just commented on the issue, the solution is not use the thin mode. For having help I pinged Thorntail users on #thorntail IRC channel in freenode and Ken Finin...