Skip to content

Commit 516020e

Browse files
committed
Rename Router.render to Router.encoder
1 parent 6c69f23 commit 516020e

File tree

14 files changed

+50
-17
lines changed

14 files changed

+50
-17
lines changed

TODO

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
* tests and coverage
22
* server options from application.conf MUST override hardcoded settings
33
* make reset headers on error configurable
4+
* netty reports a leak in MVC body
45

56
* websockets

examples/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@
5454
<artifactId>jooby-jdbi</artifactId>
5555
<version>${jooby.version}</version>
5656
</dependency>
57+
<dependency>
58+
<groupId>io.jooby</groupId>
59+
<artifactId>jooby-freemarker</artifactId>
60+
<version>${jooby.version}</version>
61+
</dependency>
5762
<dependency>
5863
<groupId>ch.qos.logback</groupId>
5964
<artifactId>logback-classic</artifactId>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Jooby https://jooby.io
3+
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+
* Copyright 2014 Edgar Espina
5+
*/
6+
package examples;
7+
8+
import io.jooby.Jooby;
9+
import io.jooby.ModelAndView;
10+
import io.jooby.freemarker.FreemarkerModule;
11+
12+
public class FreemarkerApp extends Jooby {
13+
14+
{
15+
install(new FreemarkerModule());
16+
17+
get("/", ctx -> {
18+
return new ModelAndView("index.ftl").put("name", "Freemarker");
19+
});
20+
}
21+
22+
public static void main(String[] args) {
23+
runApp(args, FreemarkerApp::new);
24+
}
25+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello ${name}!

jooby/src/main/java/io/jooby/Jooby.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ public <T> Jooby mvc(@Nonnull Class<T> router, @Nonnull Provider<T> provider) {
298298
return this;
299299
}
300300

301-
@Nonnull @Override public Jooby renderer(@Nonnull MessageEncoder encoder) {
302-
router.renderer(encoder);
301+
@Nonnull @Override public Jooby encoder(@Nonnull MessageEncoder encoder) {
302+
router.encoder(encoder);
303303
return this;
304304
}
305305

@@ -310,8 +310,8 @@ public <T> Jooby mvc(@Nonnull Class<T> router, @Nonnull Provider<T> provider) {
310310
}
311311

312312
@Nonnull @Override
313-
public Jooby renderer(@Nonnull MediaType contentType, @Nonnull MessageEncoder encoder) {
314-
router.renderer(contentType, encoder);
313+
public Jooby encoder(@Nonnull MediaType contentType, @Nonnull MessageEncoder encoder) {
314+
router.encoder(contentType, encoder);
315315
return this;
316316
}
317317

jooby/src/main/java/io/jooby/Router.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ interface Match {
228228
* @param encoder MessageEncoder instance.
229229
* @return This router.
230230
*/
231-
@Nonnull Router renderer(@Nonnull MessageEncoder encoder);
231+
@Nonnull Router encoder(@Nonnull MessageEncoder encoder);
232232

233233
/**
234234
* Register a route response encoder.
@@ -237,7 +237,7 @@ interface Match {
237237
* @param encoder MessageEncoder instance.
238238
* @return This router.
239239
*/
240-
@Nonnull Router renderer(@Nonnull MediaType contentType, @Nonnull MessageEncoder encoder);
240+
@Nonnull Router encoder(@Nonnull MediaType contentType, @Nonnull MessageEncoder encoder);
241241

242242
/**
243243
* Application temporary directory.

jooby/src/main/java/io/jooby/internal/RouterImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,14 @@ public <T> Router mvc(@Nonnull Class<T> router, @Nonnull Provider<T> provider) {
238238
return this;
239239
}
240240

241-
@Nonnull @Override public Router renderer(@Nonnull MessageEncoder encoder) {
241+
@Nonnull @Override public Router encoder(@Nonnull MessageEncoder encoder) {
242242
this.renderer.add(encoder);
243243
return this;
244244
}
245245

246246
@Nonnull @Override
247-
public Router renderer(@Nonnull MediaType contentType, @Nonnull MessageEncoder encoder) {
248-
return renderer(encoder.accept(contentType));
247+
public Router encoder(@Nonnull MediaType contentType, @Nonnull MessageEncoder encoder) {
248+
return encoder(encoder.accept(contentType));
249249
}
250250

251251
@Nonnull @Override public Router parser(@Nonnull MediaType contentType, @Nonnull

modules/jooby-freemarker/src/main/java/io/jooby/freemarker/FreemarkerModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public FreemarkerModule() {
237237
if (freemarker == null) {
238238
freemarker = create().setTemplatesPath(templatesPath).build(application.getEnvironment());
239239
}
240-
application.renderer(MediaType.html, new FreemarkerTemplateEngine(freemarker));
240+
application.encoder(MediaType.html, new FreemarkerTemplateEngine(freemarker));
241241

242242
ServiceRegistry services = application.getServices();
243243
services.put(Configuration.class, freemarker);

modules/jooby-handlebars/src/main/java/io/jooby/handlebars/HandlebarsModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public HandlebarsModule() {
200200
if (handlebars == null) {
201201
handlebars = create().setTemplatesPath(templatesPath).build(application.getEnvironment());
202202
}
203-
application.renderer(MediaType.html, new HbsTemplateEngine(handlebars));
203+
application.encoder(MediaType.html, new HbsTemplateEngine(handlebars));
204204

205205
ServiceRegistry services = application.getServices();
206206
services.put(Handlebars.class, handlebars);

modules/jooby-jackson/src/main/java/io/jooby/json/JacksonModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public JacksonModule module(Class<? extends Module> module) {
105105

106106
@Override public void install(@Nonnull Jooby application) {
107107
application.parser(MediaType.json, this);
108-
application.renderer(MediaType.json, this);
108+
application.encoder(MediaType.json, this);
109109

110110
ServiceRegistry services = application.getServices();
111111
services.put(ObjectMapper.class, mapper);

0 commit comments

Comments
 (0)