Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
Original samples from book release
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatloka committed Feb 6, 2015
1 parent b5a169e commit 742a6a6
Show file tree
Hide file tree
Showing 358 changed files with 14,134 additions and 0 deletions.
50 changes: 50 additions & 0 deletions 1980EN_02_Code/chapter-2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.packtpub.wflydevelopment.chapter2</groupId>
<artifactId>TestServlet</artifactId>
<version>1.0</version>
<packaging>war</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.packtpub.wflydevelopment.chapter2;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* Servlet implementation class TestServlet
*/
@WebServlet("/test")
public class TestServlet extends HttpServlet {

private static final String CONTENT_TYPE = "text/html;charset=UTF-8";
private static final String MESSAGE = "<!DOCTYPE html><html>" + "<head><title>Hello!</title></head>"
+ "<body>Hello World WildFly</body>" + "</html>";

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
try (PrintWriter out = response.getWriter()) {
out.println(MESSAGE);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/hello</context-root>
</jboss-web>
22 changes: 22 additions & 0 deletions 1980EN_03_Code/ticket-agency/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.packtpub.wflydevelopment.chapter3</groupId>
<artifactId>ticket-agency</artifactId>
<version>1.0</version>
<packaging>pom</packaging>

<name>ticket-agency</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<modules>
<module>ticket-agency-ejb</module>
<module>ticket-agency-ejb-client</module>
</modules>

</project>
141 changes: 141 additions & 0 deletions 1980EN_03_Code/ticket-agency/ticket-agency-ejb-client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.packtpub.wflydevelopment.chapter3</groupId>
<artifactId>ticket-agency</artifactId>
<version>1.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>ticket-agency-ejb-client</artifactId>
<packaging>jar</packaging>
<name>ticket-agency-ejb-client</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<version.wildfly>8.1.0.Final</version.wildfly>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-ejb-client-bom</artifactId>
<version>${version.wildfly}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- We depend on the EJB remote business interfaces of this application -->
<dependency>
<groupId>com.packtpub.wflydevelopment.chapter3</groupId>
<artifactId>ticket-agency-ejb</artifactId>
<type>ejb-client</type>
<version>${project.version}</version>
</dependency>

<!-- Import the transaction spec API -->
<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.2_spec</artifactId>
<scope>runtime</scope>
</dependency>

<!-- Import the EJB 3.2 API -->
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.2_spec</artifactId>
<scope>runtime</scope>
</dependency>

<!-- JBoss EJB client API jar -->
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-ejb-client</artifactId>
<scope>runtime</scope>
</dependency>

<!-- Client communications with the server use XNIO -->
<dependency>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-api</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-nio</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting</artifactId>
<version>3.3.3.Final</version>
<scope>runtime</scope>
</dependency>

<!-- Remote EJB security -->
<dependency>
<groupId>org.jboss.sasl</groupId>
<artifactId>jboss-sasl</artifactId>
<scope>runtime</scope>
</dependency>

<!-- Data serialization for remote EJBs -->
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling-river</artifactId>
<scope>runtime</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<!-- enforce Java 8 -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<!-- Add exec:exec goal maven goal to run TicketAgencyClient.main -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<workingDirectory>${project.build.directory}/exec-working-directory</workingDirectory>
<arguments>
<!-- automatically creates the classpath using all project dependencies,
also adding the project build directory -->
<argument>-classpath</argument>
<classpath>
</classpath>
<argument>com.packtpub.wflydevelopment.chapter3.client.TicketAgencyClient</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.packtpub.wflydevelopment.chapter3.client;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class IOUtils {

private static final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));

public static String readLine(String s) {
System.out.print(s);
try {
return bufferedReader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}

public static int readInt(String s) {
System.out.print(s);

try {
final String text = bufferedReader.readLine();
return Integer.parseInt(text);
} catch (IOException e) {
e.printStackTrace();
}
return 0;
}
}
Loading

0 comments on commit 742a6a6

Please sign in to comment.