Takes - review changes

This commit is contained in:
Anshul BANSAL 2020-02-24 15:17:18 +02:00
parent c82c692eb3
commit 93e7e1a51c
2 changed files with 11 additions and 5 deletions

View File

@ -10,10 +10,13 @@ import org.takes.rs.RsWithStatus;
import org.takes.rs.RsWithType;
public final class TakesContact implements Take {
@Override
public Response act(Request req) throws IOException {
return new RsWithStatus(new RsWithType(new RsWithBody("Contact us at https://www.baeldung.com"), "text/html"), 200);
}
return new RsWithStatus(
new RsWithType(
new RsWithBody("Contact us at https://www.baeldung.com"),
"text/html"), 200);
}
}

View File

@ -10,12 +10,15 @@ import org.takes.rs.RsHtml;
import org.takes.rs.RsVelocity;
public final class TakesIndex implements Take {
@Override
public Response act(final Request req) throws IOException {
RqFormSmart form = new RqFormSmart(req);
String username = form.single("username");
return new RsHtml(new RsVelocity(this.getClass().getResource("/templates/index.vm"), new RsVelocity.Pair("username", username)));
return new RsHtml(
new RsVelocity(this.getClass().getResource("/templates/index.vm"),
new RsVelocity.Pair("username", username))
);
}
}