Merge pull request #41 from ghillert/INTSAMPLES-53

INTSAMPLES-53 Update README.md

LGTM
This commit is contained in:
Gary Russell
2012-02-10 08:27:51 -08:00
4 changed files with 59 additions and 11 deletions

View File

@@ -3,13 +3,48 @@ Http Sample
This example demonstrates simple request/reply communication when using a pair of **HTTP Inbound/Outbound Gateways**.
It consists of two parts - Client and Server. To run this sample:
The sample consists of two parts:
1. Deploy project
* If you are using STS and project is imported as Eclipse project in your workspace you can just execute **Run on Server**
* You can also run **mvn clean install** and generate the WAR file that you can deploy the conventional way
2. Run the simple test client program: **org.springframework.integration.samples.http.DemoHttpClient**
* Client - Basic command-line application
* Server - Web application (War-file)
## Running the sample
### Server
#### Command Line Using Maven
The easiest way to run the **server** is to use the [Maven Jetty Plugin](http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin). Simply execute:
$ mvn jetty:run
This command starts a Jetty servlet container running on port 8080 serving the application. Alternatively you can also package the war-file and deploy it manually to a servlet container of your choosing. For that to happen execute:
$ mvn clean package
The resulting war-file will be located in the **target** folder.
#### Using an IDE such as SpringSource Tool Suite™ (STS)
If you are using [STS](http://www.springsource.com/developer/sts) and the project is imported as an Eclipse project into your workspace, you can just execute **Run on Server**. This will start the **server** application.
### Client
#### Command Line Using Maven
In order to run the **client** using Maven, execute:
$ mvn clean package exec:java
This will package the application and run it using the [Exec Maven Plugin](http://mojo.codehaus.org/exec-maven-plugin/)
#### Using an IDE such as SpringSource Tool Suite™ (STS)
In STS (Eclipse), go to package **org.springframework.integration.samples.http**, right-click **HttpClientDemo** and select **Run as** --> **Java Application**. This will run the **client** application.
### Output
The gateway (**client**) initiates a simple request posting "Hello" to the **server** and the **server** responds by appending **from the other side** to the message payload and returns. You should see the following output from the server:
The gateway initiates a simple request posting "Hello" to the server and server responds by appending **from the other side** to the message payload and returns. You should see the following output from the server:
INFO : org.springframework.integration.samples.http.HttpClientDemo - Replied with: Hello from the other side
INFO : org.springframework.integration.samples.http.HttpClientDemo - Replied with: Hello from the other side

View File

@@ -65,6 +65,19 @@
<showDeprecation>false</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>org.springframework.integration.samples.http.HttpClientDemo</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
</plugin>
</plugins>
</build>
<repositories>

View File

@@ -10,11 +10,11 @@
</layout>
</appender>
<logger name="org.springframework">
<level value="debug" />
<level value="info" />
</logger>
<logger name="org.springframework.integration.samples.multipart">
<level value="debug" />
<level value="info" />
</logger>
<!-- Root Logger -->