Skip to content

Commit f5a5c02

Browse files
forketyforkpivovarit
authored andcommitted
BAEL-1128: A Practical Guide to Java Remote Debugging (eugenp#3144)
1 parent 2ed8da6 commit f5a5c02

5 files changed

Lines changed: 105 additions & 0 deletions

File tree

guest/remote-debugging/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Building
2+
3+
To build the module, use Maven's `package` goal:
4+
5+
```
6+
mvn clean package
7+
```
8+
9+
The `war` file will be available at `target/remote-debugging.war`
10+
11+
## Running
12+
13+
The `war` application is deployed to Apache Tomcat 8 or any other Java Web or Application server.
14+
To deploy it to the Apache Tomcat 8 server, drop it in the `tomcat/webapps` directory.
15+
16+
The service then will be accessible at http://localhost:8080/remote-debugging/hello?name=John

guest/remote-debugging/pom.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>com.stackify</groupId>
7+
<artifactId>java-remote-debugging</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
<packaging>war</packaging>
10+
11+
<parent>
12+
<groupId>org.springframework.boot</groupId>
13+
<artifactId>spring-boot-starter-parent</artifactId>
14+
<version>1.5.8.RELEASE</version>
15+
<relativePath/> <!-- lookup parent from repository -->
16+
</parent>
17+
18+
<properties>
19+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
21+
<java.version>1.8</java.version>
22+
</properties>
23+
24+
<dependencies>
25+
26+
<dependency>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-starter-web</artifactId>
29+
</dependency>
30+
31+
<dependency>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-starter-tomcat</artifactId>
34+
<scope>provided</scope>
35+
</dependency>
36+
37+
</dependencies>
38+
39+
<build>
40+
<finalName>remote-debugging</finalName>
41+
<plugins>
42+
<plugin>
43+
<groupId>org.springframework.boot</groupId>
44+
<artifactId>spring-boot-maven-plugin</artifactId>
45+
</plugin>
46+
</plugins>
47+
</build>
48+
49+
</project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.stackify.debug;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class JavaRemoteDebuggingApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(JavaRemoteDebuggingApplication.class, args);
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.stackify.debug.config;
2+
3+
import com.stackify.debug.JavaRemoteDebuggingApplication;
4+
import org.springframework.boot.builder.SpringApplicationBuilder;
5+
import org.springframework.boot.web.support.SpringBootServletInitializer;
6+
7+
public class WebInitializer extends SpringBootServletInitializer {
8+
@Override
9+
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
10+
return application.sources(JavaRemoteDebuggingApplication.class);
11+
}
12+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.stackify.debug.rest;
2+
3+
import org.springframework.web.bind.annotation.GetMapping;
4+
import org.springframework.web.bind.annotation.RequestParam;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
@RestController("/hello")
8+
public class HelloController {
9+
10+
@GetMapping
11+
public String hello(@RequestParam("name") String name) {
12+
String message = "Hello, " + name;
13+
return message;
14+
}
15+
16+
}

0 commit comments

Comments
 (0)