Skip to content

Commit 5696240

Browse files
committed
doc: more doc cleanup
1 parent b141642 commit 5696240

File tree

8 files changed

+40
-127
lines changed

8 files changed

+40
-127
lines changed

docs/asciidoc/context.adoc

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,6 @@ In most of the cases you can access the context object as a parameter of your ro
2020
}
2121
----
2222

23-
If you need to access the context via the service registry or dependency injection, you need to
24-
explicitly request the registration of it as a service with the following invocation:
25-
26-
.Java
27-
[source, java, role="primary"]
28-
----
29-
{
30-
setContextAsService(true);
31-
}
32-
----
33-
34-
.Kotlin
35-
[source, kotlin, role="secondary"]
36-
----
37-
{
38-
setContextAsService(true)
39-
}
40-
----
41-
42-
Important to note that the context is a *request scoped* object, it's only available through the service
43-
registry while the request it belongs to is being processed.
44-
4523
javadoc:Context[Context] also provides derived information about the current request such as a
4624
matching locale (or locales) based on the `Accept-Language` header (if presents). You may use
4725
the result of javadoc:Context[locale] or javadoc:Context[locales] to present content matching to
@@ -133,7 +111,7 @@ response.
133111
----
134112

135113
<1> Header variable `token`
136-
<2> All headers as javadoc:Value[]
114+
<2> All headers as javadoc:value.Value[]
137115
<3> All headers as map
138116

139117
==== Cookie
@@ -256,7 +234,7 @@ Path parameter are part of the `URI`. To define a path variable you need to use
256234
- `/a b` => `/a%20b` (not decoded)
257235
- `/%2F%2B` => `/%2F%2B` (not decoded)
258236

259-
<2> Path as javadoc:Value[] object:
237+
<2> Path as javadoc:value.Value[] object:
260238

261239
- `/a+b` => `{name=a+b}`
262240
- `/a b` => `{name=a b}` (decoded)

docs/asciidoc/handlers/ssl.adoc

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
The javadoc:handler.SSLHandler[] forces client to use HTTPS by redirecting non-HTTPS calls to the HTTPS version.
44

5+
Refer to <<server-https-support, configure ssl>> to see how to setup SSL in your project.
6+
57
.Force SSL
68
[source, java, role = "primary"]
79
----
@@ -10,8 +12,6 @@ import io.jooby.handler.SSLHandler;
1012
...
1113
{
1214
13-
setServerOptions(new ServerOptions().setSecurePort(8443));
14-
1515
before(new SSLHandler()); <1>
1616
1717
get("/", ctx -> {
@@ -27,10 +27,6 @@ import io.jooby.Jooby
2727
import io.jooby.handler.SSHandler
2828
...
2929
{
30-
serverOptions {
31-
securePort = 8443
32-
}
33-
3430
before(SSLHandler()) <1>
3531
3632
get("/") {
@@ -54,8 +50,6 @@ import io.jooby.handler.SSLHandler;
5450
...
5551
{
5652
57-
setServerOptions(new ServerOptions().setSecurePort(8443));
58-
5953
before(new SSLHandler("myhost.org")); <1>
6054
6155
get("/", ctx -> {
@@ -71,9 +65,6 @@ import io.jooby.Jooby
7165
import io.jooby.handler.SSHandler
7266
...
7367
{
74-
serverOptions {
75-
securePort = 8443
76-
}
7768
7869
before(SSLHandler("myhost.org")) <1>
7970
@@ -88,5 +79,5 @@ For more information about SSL, please check the <<server-https-support, configu
8879
[TIP]
8980
====
9081
If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header,
91-
please consider to add the <<router-options-trust-proxy, trust proxy>> to your pipeline.
82+
please consider adding the <<router-options-trust-proxy, trust proxy>> to your pipeline.
9283
====

docs/asciidoc/migration/4.x.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ runApp(args, new NettyServer(new ServerOptions()), App::new);
6161

6262
==== Method
6363
|===
64-
|2.x|3.x|Description
64+
|3.x|4.x|Description
6565
|io.jooby.Jooby.setServerOptions()|Server.setOptions()| removed in favor of `Server.setOptions()`
6666
|io.jooby.Router.mvc|-| it was deprecated and now removed
6767
|io.jooby.Router.decorator|-| it was deprecated and now removed

docs/asciidoc/mvc-api.adoc

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,27 @@ JAX-RS specification and there is no immediate plan to do it.
868868
The main reason to support JAX-RS annotations is to let you plug-in third-party tools that rely
869869
on them (mostly annotations processors).
870870

871+
=== Generated router
872+
873+
For each MVC/controller class a new class is generated. The new class ends with `_`, this class
874+
mimics the constructors from the source class. If the constructor is annotated with `@Inject` a
875+
default constructor will exists.
876+
877+
Any annotation found on the controller method will be persisted as route attributes, unless
878+
`jooby.skipAttributeAnnotations` excludes it.
879+
880+
Access to generated routes is allowed:
881+
882+
[source, java]
883+
----
884+
{
885+
var routes = mvc(new MyController_());
886+
routes.forEach(route -> {
887+
// do something with route
888+
});
889+
}
890+
----
891+
871892
=== Annotation Processor Options
872893

873894
[cols="1,1,1,1"]
@@ -884,21 +905,11 @@ on them (mostly annotations processors).
884905
|true
885906
|Hints maven/gradle to do incremental compilation. Useful for development.
886907

887-
|jooby.services
888-
|boolean
889-
|true
890-
|Generates META-INF/services metadata
891-
892908
|jooby.skipAttributeAnnotations
893909
|array
894910
|[]
895911
|Skip annotation during byte code generation (i.e. don't generate them as route attributes)
896912

897-
|jooby.handler
898-
|string
899-
|[]
900-
|Add custom handler mapping.
901-
902913
|jooby.mvcMethod
903914
|boolean
904915
|false

docs/asciidoc/routing.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Attributes let you annotate a route at application bootstrap time. It functions
7070
----
7171
{
7272
get("/foo", ctx -> "Foo")
73-
.attribute("foo", "bar");
73+
.setAttribute("foo", "bar");
7474
}
7575
----
7676

@@ -80,7 +80,7 @@ Attributes let you annotate a route at application bootstrap time. It functions
8080
{
8181
get("/foo") {
8282
"Foo"
83-
}.attribute("foo", "bar")
83+
}.setAttribute("foo", "bar")
8484
}
8585
----
8686

@@ -93,7 +93,7 @@ Attributes can be accessed at runtime in a request/response cycle. For example,
9393
{
9494
use(next -> ctx -> {
9595
User user = ...;
96-
String role = ctx.getRoute().attribute("Role");
96+
String role = ctx.getRoute().getAttribute("Role");
9797
9898
if (user.hasRole(role)) {
9999
return next.apply(ctx);
@@ -110,7 +110,7 @@ Attributes can be accessed at runtime in a request/response cycle. For example,
110110
{
111111
use(
112112
val user = ...
113-
val role = ctx.route.attribute("Role")
113+
val role = ctx.route.getAttribute("Role")
114114
115115
if (user.hasRole(role)) {
116116
return next.apply(ctx)
@@ -144,7 +144,7 @@ public class AdminResource {
144144
145145
{
146146
use(next -> ctx -> {
147-
System.out.println(ctx.getRoute().attribute("Role"));
147+
System.out.println(ctx.getRoute().getAttribute("Role"));
148148
});
149149
}
150150
----
@@ -168,7 +168,7 @@ class AdminResource {
168168
169169
{
170170
use {
171-
println(ctx.route.attribute("Role"))
171+
println(ctx.route.getAttribute("Role"))
172172
}
173173
}
174174
----

docs/asciidoc/value-api.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
=== Value API
22

3-
The javadoc:Value[Value] is an unified and type-safe API across all parameter types:
3+
The javadoc:value.Value[Value] is an unified and type-safe API across all parameter types:
44

55
- Header
66
- Path
77
- Query
88
- Formdata/Multipart
99
10-
For learning purpose we are going to show all the javadoc:Value[Value] features using query
10+
For learning purpose we are going to show all the javadoc:value.Value[Value] features using query
1111
parameters, but keep in mind these features apply to all the parameter types.
1212

1313
==== Single value
@@ -127,8 +127,8 @@ Default and optional value are available in two different ways:
127127

128128
Multiple values are available via functions:
129129

130-
- javadoc:Value[toList]: Returns a `java.util.List` of values
131-
- javadoc:Value[toSet]: Returns a `java.util.Set` of values
130+
- javadoc:value.Value[toList]: Returns a `java.util.List` of values
131+
- javadoc:value.Value[toSet]: Returns a `java.util.Set` of values
132132

133133
.Java
134134
[source, java,role="primary"]
@@ -182,7 +182,7 @@ Multiple values are available via functions:
182182

183183
==== Structured data
184184

185-
The javadoc:Value[Value API] provides a way to traverse and parse structured data:
185+
The javadoc:value.Value[Value API] provides a way to traverse and parse structured data:
186186

187187
----
188188
/?user.name=root&user.pass=pass
@@ -221,7 +221,7 @@ The javadoc:Value[Value API] provides a way to traverse and parse structured dat
221221
<3> Get the `pass` value from `user` node
222222
<4> Get the `mail` value from `user` node. This is an optional value.
223223

224-
The javadoc:Value[get, java.lang.String] takes a `path` and returns another value. The returning
224+
The javadoc:value.Value[get, java.lang.String] takes a `path` and returns another value. The returning
225225
value may or may not exists.
226226

227227
===== Syntax

jooby/src/main/java/io/jooby/Environment.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import java.nio.file.Files;
99
import java.nio.file.Path;
1010
import java.nio.file.Paths;
11-
import java.util.Arrays;
1211
import java.util.Collections;
1312
import java.util.HashMap;
1413
import java.util.List;
@@ -54,7 +53,7 @@ public class Environment {
5453
*/
5554
public Environment(
5655
@NonNull ClassLoader classLoader, @NonNull Config config, @NonNull String... actives) {
57-
this(classLoader, config, Arrays.asList(actives));
56+
this(classLoader, config, List.of(actives));
5857
}
5958

6059
/**

jooby/src/main/java/io/jooby/output/ForwardingOutputFactory.java

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)