Skip to content

Commit 0069220

Browse files
committed
update documentation and reflect latest changes
1 parent 37e3896 commit 0069220

22 files changed

Lines changed: 212 additions & 215 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ A web socket looks like:
289289
{
290290
ws("/", (ws) -> {
291291

292-
ws.onMessage(message -> ws.send("Hello " + message.stringValue()));
292+
ws.onMessage(message -> ws.send("Hello " + message.value()));
293293

294294
ws.send("connected");
295295
});
@@ -628,10 +628,10 @@ get("/mail/inbox", (req, rsp) -> rsp.send("hey jooby"));
628628
### var/regex patterns
629629

630630
```java
631-
get("/user/:id", (req, rsp) -> rsp.send("hey " + req.param("id").stringValue()));
631+
get("/user/:id", (req, rsp) -> rsp.send("hey " + req.param("id").value()));
632632

633633
// alternative syntax
634-
get("/user/{id}", (req, rsp) -> rsp.send("hey " + req.param("id").stringValue()));
634+
get("/user/{id}", (req, rsp) -> rsp.send("hey " + req.param("id").value()));
635635

636636
// regex
637637
get("/user/{id:\d+}", (req, rsp) -> rsp.send("hey " + req.param("id").intValue()));
@@ -796,7 +796,7 @@ Some examples:
796796
get("/", (req, rsp) -> {
797797
int iparam = req.param("intparam").intValue();
798798

799-
String str = req.param("str").stringValue();
799+
String str = req.param("str").value();
800800

801801
// custom object type using type conversion
802802
MyObject object = req.param("object").to(MyObject.class);
@@ -839,7 +839,7 @@ Produces:
839839
```java
840840
get("/user/:id", (req, rsp) -> {
841841
// path param at idx = 0
842-
assertEquals("first", req.param("id").stringValue());
842+
assertEquals("first", req.param("id").value());
843843
assertEquals("first", req.param("id").toList(String.class).get(0));
844844

845845
// query param at idx = 1
@@ -874,7 +874,7 @@ Retrieval of request headers is done via: [request.header("name")]({{}}Request.h
874874
get("/", (req, rsp) -> {
875875
int iparam = req.header("intparam").intValue();
876876

877-
String str = req.header("str").stringValue();
877+
String str = req.header("str").value();
878878

879879
// custom object type using type conversion
880880
MyObject object = req.header("object").to(MyObject.class);
@@ -1256,7 +1256,7 @@ The use of web sockets is pretty easy too:
12561256
```java
12571257
{
12581258
ws("/", (ws) -> {
1259-
ws.onMessage(message -> System.out.println(message.stringValue()));
1259+
ws.onMessage(message -> System.out.println(message.value()));
12601260
12611261
ws.send("connected");
12621262
});

coverage-report/src/test/java/org/jooby/MvcNoContentFeature.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ public class MvcNoContentFeature extends ServerFeature {
1010
public static class Resource {
1111
@GET
1212
@Path("/")
13-
public void noContent() {
14-
13+
public Result noContent() {
14+
return Results.noContent();
1515
}
1616
}
1717

jooby/src/main/java/org/jooby/Jooby.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
* <pre>
311311
* List{@literal <}String{@literal >} names = new ArrayList{@literal <}{@literal >}(); // names produces side effects
312312
* get("/", (req, rsp) {@literal ->} {
313-
* names.add(req.param("name").stringValue();
313+
* names.add(req.param("name").value();
314314
* // response will be different between calls.
315315
* rsp.send(names);
316316
* });

jooby/src/main/java/org/jooby/Request.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ default String method() {
460460
* produces:
461461
*
462462
* <pre>
463-
* assertEquals("jooby", req.param(name).stringValue());
463+
* assertEquals("jooby", req.param(name).value());
464464
*
465465
* assertEquals("jooby", req.param(name).toList(String.class).get(0));
466466
* assertEquals("rocks", req.param(name).toList(String.class).get(1));

jooby/src/main/java/org/jooby/Route.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
* <pre>
159159
* List{@literal <}String{@literal >} names = new ArrayList{@literal <>}(); // names produces side effects
160160
* get("/", (req, rsp) {@literal ->} {
161-
* names.add(req.param("name").stringValue();
161+
* names.add(req.param("name").value();
162162
* // response will be different between calls.
163163
* rsp.send(names);
164164
* });
@@ -796,7 +796,7 @@ public String toString() {
796796
* <h3>Auth handler example</h3>
797797
*
798798
* <pre>
799-
* String token = req.header("token").stringValue();
799+
* String token = req.header("token").value();
800800
* if (token != null) {
801801
* // validate token...
802802
* if (valid(token)) {

jooby/src/main/java/org/jooby/WebSocket.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* ws("/", (ws) {@literal ->} {
4444
* // connected
4545
* ws.onMessage(message {@literal ->} {
46-
* System.out.println(message.stringValue());
46+
* System.out.println(message.value());
4747
* ws.send("Message Received");
4848
* });
4949
* ws.send("Connected");

jooby/src/main/java/org/jooby/internal/mvc/MvcHandler.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.jooby.Request;
2828
import org.jooby.Response;
2929
import org.jooby.Route;
30-
import org.jooby.Status;
3130
import org.jooby.internal.reqparam.RequestParam;
3231
import org.jooby.internal.reqparam.RequestParamProvider;
3332

@@ -59,11 +58,7 @@ public void handle(final Request req, final Response rsp) throws Exception {
5958
final Object result = handler.invoke(target, args);
6059

6160
Class<?> returnType = handler.getReturnType();
62-
if (returnType == void.class || returnType == Void.class) {
63-
// ignore glob pattern
64-
if (!req.route().pattern().contains("*")) {
65-
rsp.status(Status.NO_CONTENT);
66-
}
61+
if (returnType == void.class) {
6762
return;
6863
}
6964

jooby/src/test/java/org/jooby/internal/WsBinaryMessageTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void longValue() throws Exception {
111111
}
112112

113113
@Test(expected = Err.class)
114-
public void stringValue() throws Exception {
114+
public void value() throws Exception {
115115
new WsBinaryMessage(ByteBuffer.wrap("bytes".getBytes())).value();
116116
}
117117

md/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import org.jooby.Jooby;
1414
public class App extends Jooby {
1515

1616
{
17-
get("/", (req) ->
17+
get("/", () ->
1818
"Hey Jooby!"
1919
);
2020
}
@@ -32,6 +32,7 @@ versioning
3232
Jooby uses [semantic versioning](http://semver.org/) for releases.
3333

3434
API is considered unstable while release version is: ```0.x.x``` and it might changes and/or broke without previous notification.
35+
This might sounds terrible but isn't. Jooby is plain Java there, then any change on the API will be reported by the Java Compiler :)
3536

3637
{{quickstart.md}}
3738

@@ -88,6 +89,8 @@ help and support
8889
related projects
8990
=====
9091

92+
* [Netty](http://netty.io/)
93+
* [Jetty](http://eclipse.org/jetty)
9194
* [Undertow](http://undertow.io/)
9295
* [Guice](https://github.com/google/guice)
9396
* [Type Safe](https://github.com/typesafehub/config)

md/config.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,31 @@ Any property can be injected using the ```javax.inject.Named``` annotation and a
1414

1515
2) Is an enum
1616

17-
1) Has a public **constructor** that accepts a single **String** argument
17+
3) Has a public **constructor** that accepts a single **String** argument
1818

19-
2) Has a static method **valueOf** that accepts a single **String** argument
19+
4) Has a static method **valueOf** that accepts a single **String** argument
2020

21-
3) Has a static method **fromString** that accepts a single **String** argument. Like ```java.util.UUID```
21+
5) Has a static method **fromString** that accepts a single **String** argument. Like ```java.util.UUID```
2222

23-
4) Has a static method **forName** that accepts a single **String** argument. Like ```java.nio.charset.Charset```
23+
6) Has a static method **forName** that accepts a single **String** argument. Like ```java.nio.charset.Charset```
2424

25-
5) There is custom Guice type converter for the type
25+
7) There is custom Guice type converter for the type
2626

27-
It is also possible to inject a ```com.typesafe.config.Config``` object.
27+
It is also possible to inject the root ```com.typesafe.config.Config``` object or a child of it.
2828

2929
## special properties
3030

31-
### application.mode
31+
### application.env
3232

33-
Jooby internals and the module system rely on the ```application.mode``` property. By defaults, this property is set to ```dev```.
33+
Jooby internals and the module system rely on the ```application.env``` property. By defaults, this property is set to ```dev```.
3434

35-
For example, the [development stage](https://github.com/google/guice/wiki/Bootstrap) is set in [Guice](https://github.com/google/guice) when ```application.mode == dev```. A module provider, might decided to create a connection pool, cache, etc when ```application.mode != dev ```.
35+
For example, the [development stage](https://github.com/google/guice/wiki/Bootstrap) is set in [Guice](https://github.com/google/guice) when ```application.env == dev```. A module provider, might decided to create a connection pool, cache, etc when ```application.env != dev ```.
3636

37-
This special property is represented at runtime with the [Mode]({{apidocs}}/org/jooby/Mode.html) class.
37+
This special property is represented at runtime with the [Env]({{apidocs}}/org/jooby/Env.html) class.
3838

3939
### application.secret
4040

41-
The session cookie is signed with an ```application.secret```, while you are in **dev** you aren't required to provide an ```application.secret```. A secret is required when environment isn't **dev** and if you fail to provide a secret your application wont startup.
41+
If present, the session cookie will be signed with the ```application.secret```.
4242

4343
### default properties
4444

@@ -67,7 +67,7 @@ It does, but at the same time it is very intuitive and makes a lot of sense. Let
6767

6868
### system properties
6969

70-
System properties can override any other property. A sys property is be set at startup time, like:
70+
System properties can override any other property. A sys property is set at startup time, like:
7171

7272
java -jar myapp.jar -Dapplication.secret=xyz
7373

@@ -83,31 +83,31 @@ Let's say your app includes a default property file: ```application.conf``` bund
8383
* inside that directory create a file: ```application.conf```
8484
* start the app from same directory
8585

86-
That's all. The file system conf file will take precedence over the classpath path config files overriding any property.
86+
That's all. The file system conf file will take precedence over the classpath config file, overriding any property.
8787

88-
A good practice is to start up your app with a **mode**, like:
88+
A good practice is to start up your app with a **env**, like:
8989

90-
java -jar myapp.jar -Dapplication.mode=prod
90+
java -jar myapp.jar -Dapplication.env=prod
9191

9292
The process is the same, except this time you can name your file as:
9393

9494
application.prod.conf
9595

9696
### cp://[application].[mode].[conf]
9797

98-
Again, the use of this conf file is optional and works like previous config option, except that here the **fat jar** was bundled with all your config files (dev, stage, prod, etc.)
98+
Again, the use of this conf file is optional and works like previous config option, except here the **fat jar** was bundled with all your config files (dev, stage, prod, etc.)
9999

100-
Example: you have two config files: ```application.conf``` and ```application.prod.conf````. Both files were bundled with the **fat jar**, starting the app in **prod** mode is:
100+
Example: you have two config files: ```application.conf``` and ```application.prod.conf````. Both files were bundled inside the **fat jar**, starting the app in **prod** env:
101101

102-
java -jar myapp.jar -Dapplication.mode=prod
102+
java -jar myapp.jar -Dapplication.env=prod
103103

104104
So here the ```application.prod.conf``` will takes precedence over the ```application.conf``` conf file.
105105

106106
This is the recommended option from Jooby, because your app doesn't have an external dependency. If you need to deploy the app in a new server all you need is your **fat jar**
107107

108108
### [application].[conf]
109109

110-
This is your default config files and it should be bundle inside the **fat jar**. As mentioned early, the default name is: **application.conf**, but if you don't like it or need to change it just call **use** in Jooby:
110+
This is the default config files and it should be bundle inside the **fat jar**. As mentioned early, the default name is: **application.conf**, but if you don't like it or need to change it:
111111

112112
```java
113113
{
@@ -130,4 +130,3 @@ As mentioned in the [modules](#modules) section a module might define his own se
130130
In the previous example the M2 modules properties will take precedence over M1 properties.
131131

132132
As you can see the config system is very powerful and can do a lot for you.
133-

0 commit comments

Comments
 (0)