You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-29Lines changed: 30 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Servlet Url Mapper
2
2
3
-
This small and non-invasive library is intended to be used in servlet-only environments where for some reasons developers are left without any frameworks like Spring MVC or Jax-RS.
3
+
This small and non-invasive library is intended to be used in servlet-only environments where for some reasons developers are forced to use
4
+
Servlet API directly (like in Atlassian plugin SDK).
5
+
4
6
In such servlet-only environments, this library helps to handle nested URL structures in one servlet.
5
7
6
8
_Non-invasive_: You don't need to use `servlet url mapper` in every servlet, you can use only in some of them.
@@ -32,17 +34,39 @@ You can use different methods for different URLs in the same servlet. You can ev
32
34
| /products | POST | ProductsServlet#create |
33
35
34
36
35
-
## Usage
37
+
## Quick start
36
38
37
-
1. You need to extend your servlet from `MappingServlet`
39
+
1. Add the dependency
40
+
41
+
You should use [jitpack](https://jitpack.io) to add this library as a dependency for Maven or Gradle (or others).
42
+
43
+
```xml
44
+
<repositories>
45
+
<repository>
46
+
<id>jitpack.io</id>
47
+
<url>https://jitpack.io</url>
48
+
</repository>
49
+
</repositories>
50
+
```
51
+
```xml
52
+
<dependency>
53
+
<groupId>com.github.kodgemisi</groupId>
54
+
<artifactId>servlet-url-mapper</artifactId>
55
+
<version>1.2.0</version>
56
+
</dependency>
57
+
```
58
+
59
+
See https://jitpack.io/#kodgemisi/servlet-url-mapper
60
+
61
+
2. Extend your servlet from `MappingServlet`
38
62
39
63
```java
40
64
publicclassMyServletextendsMappingServlet {
41
65
//...
42
66
}
43
67
```
44
68
45
-
2. Register your url mappings via `protected urlMappingRegistrar` field from `MappingServlet`. You can do this either in `constructor` or in `init` method.
69
+
3. Register your url mappings via `protected urlMappingRegistrar` field from `MappingServlet`. You can do this either in `constructor` or in `init` method.
@@ -83,36 +107,13 @@ public class MyServlet extends MappingServlet {
83
107
84
108
**Java 8 usage remainder**: Note that (assuming you have an `AddressHelper` class in your project) `AddressHelper::addAddress` usage implies that `addAddress` is a static method. You can use non-static methods by providing an object instead of Class name like `addressHelper::addAddress` assuming `addressHelper` is an object of `AddressHelper` class.
85
109
86
-
87
-
## Dependency Management
88
-
89
-
You can use [jitpack](https://jitpack.io) to add this library as a dependency for maven, gradle and others.
90
-
91
-
```
92
-
<repositories>
93
-
<repository>
94
-
<id>jitpack.io</id>
95
-
<url>https://jitpack.io</url>
96
-
</repository>
97
-
</repositories>
98
-
```
99
-
```
100
-
<dependency>
101
-
<groupId>com.github.kodgemisi</groupId>
102
-
<artifactId>servlet-url-mapper</artifactId>
103
-
<version>1.0.0</version>
104
-
</dependency>
105
-
```
106
-
107
-
See https://jitpack.io/#kodgemisi/servlet-url-mapper
Copy file name to clipboardExpand all lines: src/main/java/com/kodgemisi/servlet_url_mapping/ServletRequestHandler.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,8 @@
12
12
importjava.io.IOException;
13
13
14
14
/**
15
-
* <p>Servlets extending {@link MappingServlet} provide methods matching {@link ServletRequestHandler#handleRequest} signature so that those methods
16
-
* can be used as request handlers.</p> <p>See {@link ServletUrlPatternRegistrar} for examples.</p>
15
+
* <p>Servlets extending {@link MappingServlet} should provide methods matching {@link ServletRequestHandler#handleRequest} signature so that those methods
16
+
* can be used as request handlers.</p> <p>See {@link ServletUrlPattern} for examples.</p>
0 commit comments