-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Moesif/feature-add-configuration-option
Bump moesif-servlet and moesifapi dependencies
- Loading branch information
Showing
13 changed files
with
165 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#### Spring Boot example | ||
|
||
In order to run this example you will need to have Java 7+ and Maven installed. | ||
|
||
Before starting, check that your maven version is 3.0.x or above: | ||
|
||
```sh | ||
mvn -v | ||
``` | ||
|
||
1. Clone the repository | ||
|
||
```sh | ||
git clone https://github.com/Moesif/moesif-servlet | ||
cd moesif-servlet | ||
``` | ||
|
||
2. Update MyConfig to use your own Moesif ApplicationId | ||
(Register for an account on [moesif.com](https://www.moesif.com)) | ||
|
||
```sh | ||
vim spring-example/src/main/java/com/moesif/servlet/spring/MyConfig.java | ||
``` | ||
|
||
3. Compile the example | ||
|
||
```sh | ||
cd spring-example | ||
mvn clean install | ||
``` | ||
|
||
4. Run spring-example (from the spring-example dir) | ||
|
||
```sh | ||
java -jar target/moesif-spring-example.jar | ||
``` | ||
|
||
Alternatively: | ||
|
||
```sh | ||
mvn spring-boot:run | ||
``` | ||
|
||
|
||
5. Go to `http://localhost:8080/greeting` or the port that Spring Boot is running on. | ||
|
||
6. Set logBody flag to `false` in `MyConfig.java` file to remove logging request and response body to Moesif | ||
|
||
```java | ||
// Set flag to log request and response body | ||
moesifFilter.setLogBody(true); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#### Spring MVC example | ||
|
||
In order to run this example you will need to have Java 7+ and Maven installed. | ||
|
||
Before starting, check that your maven version is 3.0.x or above: | ||
|
||
```sh | ||
mvn -v | ||
``` | ||
|
||
1. Clone the repository | ||
|
||
```sh | ||
git clone https://github.com/Moesif/moesif-servlet | ||
cd moesif-servlet | ||
``` | ||
|
||
2. Update MyConfig to use your own Moesif ApplicationId | ||
(Register for an account on [moesif.com](https://www.moesif.com)) | ||
|
||
```sh | ||
vim spring-mvc-example/src/main/webapp/WEB-INF/web.xml | ||
``` | ||
|
||
3. Run spring-mvc-example | ||
|
||
```sh | ||
cd spring-mvc-example | ||
mvn jetty:run | ||
``` | ||
|
||
4. Go to `http://localhost:8080/api/json`. In your Moesif Account, you should see event logged and monitored. | ||
|
||
Shut it down manually with Ctrl-C. | ||
|
||
In Spring MVC + XML configuration, you can register the filters via web.xml | ||
|
||
In `web.xml` file: | ||
|
||
```xml | ||
|
||
<filter> | ||
<filter-name>MoesifFilter</filter-name> | ||
<filter-class>com.moesif.servlet.MoesifFilter</filter-class> | ||
<init-param> | ||
<param-name>application-id</param-name> | ||
<param-value>your application id</param-value> | ||
</init-param> | ||
<init-param> | ||
<param-name>debug</param-name> | ||
<param-value>false</param-value> | ||
</init-param> | ||
<init-param> | ||
<param-name>logBody</param-name> | ||
<param-value>true</param-value> | ||
</init-param> | ||
</filter> | ||
<filter-mapping> | ||
<filter-name>MoesifFilter</filter-name> | ||
<url-pattern>/*</url-pattern> | ||
</filter-mapping> | ||
|
||
|
||
``` | ||
You may have to override `onStartup()` to pass in the MoesifConfiguration object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters