Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ hs_err_pid*

# NetBeans created artifacts
/target/
/nb-configuration.xml
/nb-configuration.xml
.DS_Store
.classpath
.project
.settings
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ Note that this project will just as well work with NetBeans, for which the cargo
settings will be ignored. With NetBeans, you can just 'run' the project with a
preconfigured Application Server (Tomcat 8).

The project also runs in Eclipse without any changes.


# Docker

This can be easily dockerized as well - a sample Dockerfile has been included. A version has been pushed to Docker Hub as well, although I cannot guarantee which version. To find it in Docker Hub: jdesmet/zakee-web:latest
Expand Down
59 changes: 48 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@
need to include this api as compile (or default). -->
<!--scope>provided</scope-->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.25</version>
<scope>runtime</scope>
</dependency>


<!-- JavaMail (JSR 919) http://java.net/projects/javamail/pages/Home -->
<dependency>
Expand Down Expand Up @@ -158,6 +165,14 @@
<version>5.0.7.Final</version>
<scope>runtime</scope>
</dependency>

<!-- JPA implementation and API -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.0</version>
</dependency>


<!-- Jersey Implementation of JAX-RS -->
<!--
Expand All @@ -171,6 +186,12 @@
<artifactId>jersey-container-servlet</artifactId>
<version>2.25</version>
</dependency>
<dependency>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no explicit dependencies on repackaged libraries. They are intended internal only to other dependencies that applied it in a transitive manner.

<groupId>org.glassfish.jersey.bundles.repackaged</groupId>
<artifactId>jersey-guava</artifactId>
<version>2.25</version>
</dependency>

<!-- Required only when you are using JAX-RS Client -->
<!--dependency>
<groupId>org.glassfish.jersey.core</groupId>
Expand Down Expand Up @@ -199,33 +220,49 @@
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>net.java.html.json</artifactId>
<version>1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>net.java.html.json</artifactId>
<version>1.3</version>
<scope>compile</scope>
</dependency>

<!-- Customizations beyond standards -->
<!-- =============================== -->

<dependency>
<groupId>net.bootsfaces</groupId>
<artifactId>bootsfaces</artifactId>
<version>0.9.1</version>
<scope>compile</scope>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.0</version>
<version>6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.10</version>
</dependency>
</dependency>

<!-- testing -->
<dependency>
<groupId>org.jglue.cdi-unit</groupId>
<artifactId>cdi-unit</artifactId>
<version>4.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>


</dependencies>

<build>
Expand Down Expand Up @@ -264,7 +301,7 @@
<container>
<containerId>tomcat8x</containerId>
<zipUrlInstaller>
<url>http://repo1.maven.org/maven2/org/apache/tomcat/tomcat/8.5.9/tomcat-8.5.9.zip</url>
<url>http://repo1.maven.org/maven2/org/apache/tomcat/tomcat/8.5.21/tomcat-8.5.21.zip</url>
</zipUrlInstaller>
<dependencies>
<!-- Dependencies to be included in the container classpath (JDBC Drivers) -->
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/desmet/jo/zakee/rs/ZakeeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public class ZakeeService {
@Produces(MediaType.TEXT_HTML)
@Path("context")
public String processContextPath() {
return "<p>This "+contextPath+" service is life!</p>";
return "This "+contextPath+" service is alife!";
}

@GET
@Produces(MediaType.TEXT_HTML)
@Path("who")
public String processWho() {
return "<p>Service for "+who.getYou().getFirstName()+"</p>";
return "Service for "+who.getYou().getFirstName() + " (using CDI)";
}

@PostConstruct
Expand Down
63 changes: 47 additions & 16 deletions src/main/webapp/index.xhtml
Original file line number Diff line number Diff line change
@@ -1,23 +1,54 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui"
>
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui">
<h:head>
<title>Introduce</title>
</h:head>
<h:body>
<h:outputText rendered="${who.you.introduced}" value="I think I know you, are you ${who.you.firstName}?"/>
<h:form>
<h:panelGrid columns="2" cellpadding="5" cellspacing="5">
<h:outputText value="User:"/>
<b:inputText value="#{who.you.firstName}">
<f:facet name="prepend"><b:icon name="user" /></f:facet>
</b:inputText>
</h:panelGrid>
</h:form>
<b:container>
<b:panel title="CDI demo" look="primary">
<b:panelGrid columns="1" look="primary">
<h:outputText rendered="${who.you.introduced}"
value="I think I know you, are you ${who.you.firstName}?" />
<h:form>
<b:inputText label="User:" value="#{who.you.firstName}">
<f:facet name="prepend">
<b:icon name="user" />
</f:facet>
</b:inputText>
<p>If the text in the input field is "Guest", CDI works.</p>
</h:form>
</b:panelGrid>
</b:panel>

<b:panel title="JAX-RS demo" look="primary">
<b:row>
<b:column small-screen="half">Simple REST service:
<a href="#{request.contextPath}/rs/zakee-service/context">#{request.contextPath}/rs/zakee-service/context</a>
</b:column>
<b:column small-screen="half">Result: <span class="result-rest-service-one">(waiting for the REST service result)</span>
</b:column>
</b:row>
<b:row>
<b:column small-screen="half">REST service using CDI:
<a href="#{request.contextPath}/rs/zakee-service/who">#{request.contextPath}/rs/zakee-service/who</a>
</b:column>
<b:column small-screen="half">Result: <span class="result-rest-service-two">(waiting for the REST service result)</span>
</b:column>
</b:row>
<script>
$.get('#{request.contextPath}/rs/zakee-service/context', function(data) {
$('.result-rest-service-one').html(data);
});
$.get('#{request.contextPath}/rs/zakee-service/who', function(data) {
$('.result-rest-service-two').html(data);
});
</script>
</b:panel>
</b:container>
</h:body>
</html>

</html>