Skip to content

Commit 72a7bd0

Browse files
committed
request/access log #492
* javadoc fixes * fix #492
1 parent c7261e2 commit 72a7bd0

File tree

14 files changed

+737
-14
lines changed

14 files changed

+737
-14
lines changed

jooby-archetype/src/main/resources/archetype-resources/conf/logback.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,34 @@
66
</encoder>
77
</appender>
88

9+
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
10+
<file>log/app.log</file>
11+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
12+
<fileNamePattern>logs/app.%d{yyyy-MM-dd}.log</fileNamePattern>
13+
<totalSizeCap>1mb</totalSizeCap>
14+
</rollingPolicy>
15+
16+
<encoder>
17+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
18+
</encoder>
19+
</appender>
20+
21+
<appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
22+
<file>log/access.log</file>
23+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
24+
<fileNamePattern>log/access.%d{yyyy-MM-dd}.log</fileNamePattern>
25+
<totalSizeCap>1mb</totalSizeCap>
26+
</rollingPolicy>
27+
28+
<encoder>
29+
<pattern>%msg%n</pattern>
30+
</encoder>
31+
</appender>
32+
33+
<logger name="org.jooby.RequestLogger" additivity="false">
34+
<appender-ref ref="ACCESS" />
35+
</logger>
36+
937
<root level="info">
1038
<appender-ref ref="STDOUT" />
1139
</root>

jooby-pac4j/src/main/java/org/jooby/pac4j/Auth.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,22 @@
3131
import java.util.function.Function;
3232
import java.util.stream.Collectors;
3333

34-
import com.google.inject.TypeLiteral;
3534
import org.jooby.Env;
3635
import org.jooby.Jooby;
3736
import org.jooby.Route;
3837
import org.jooby.Routes;
3938
import org.jooby.Session;
40-
import org.jooby.internal.pac4j.*;
39+
import org.jooby.internal.pac4j.AuthCallback;
40+
import org.jooby.internal.pac4j.AuthContext;
41+
import org.jooby.internal.pac4j.AuthFilter;
42+
import org.jooby.internal.pac4j.AuthLogout;
43+
import org.jooby.internal.pac4j.AuthorizerFilter;
44+
import org.jooby.internal.pac4j.BasicAuth;
45+
import org.jooby.internal.pac4j.ClientType;
46+
import org.jooby.internal.pac4j.ClientsProvider;
47+
import org.jooby.internal.pac4j.ConfigProvider;
48+
import org.jooby.internal.pac4j.FormAuth;
49+
import org.jooby.internal.pac4j.FormFilter;
4150
import org.jooby.scope.Providers;
4251
import org.jooby.scope.RequestScoped;
4352
import org.pac4j.core.authorization.authorizer.Authorizer;
@@ -60,6 +69,7 @@
6069
import com.google.common.collect.Maps;
6170
import com.google.common.collect.Multimap;
6271
import com.google.inject.Binder;
72+
import com.google.inject.TypeLiteral;
6373
import com.google.inject.multibindings.MapBinder;
6474
import com.google.inject.multibindings.Multibinder;
6575
import com.google.inject.multibindings.OptionalBinder;
@@ -117,10 +127,9 @@
117127
* </pre>
118128
*
119129
* <p>
120-
* A {@link IndirectBasicAuthClient} depends on {@link Authenticator<UsernamePasswordCredentials>}, default is
130+
* A {@link IndirectBasicAuthClient} depends on {@link Authenticator}, default is
121131
* {@link SimpleTestUsernamePasswordAuthenticator} which is great for development, but nothing good
122-
* for other environments. Next example setup a basic auth with a custom:
123-
* {@link Authenticator<UsernamePasswordCredentials>}:
132+
* for other environments. Next example setup a basic auth with a custom {@link Authenticator}:
124133
* </p>
125134
*
126135
* <pre>
@@ -151,7 +160,7 @@
151160
* </pre>
152161
*
153162
* <p>
154-
* Like basic auth, form auth depends on a {@link Authenticator<UsernamePasswordCredentials>}.
163+
* Like basic auth, form auth depends on a {@link Authenticator}.
155164
* </p>
156165
*
157166
* <p>

jooby/src/main/java/org/jooby/Env.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ default <T> Option<T> when(final Predicate<String> predicate, final T result) {
449449
/**
450450
* Get or chain the required xss functions.
451451
*
452+
* @param xss XSS to combine.
452453
* @return Chain of required xss functions.
453454
*/
454455
default Function<String, String> xss(final String... xss) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4017,6 +4017,7 @@ public Jooby executor(final ExecutorService executor) {
40174017
*
40184018
* The {@link ExecutorService} will automatically shutdown.
40194019
*
4020+
* @param name Name of the executor.
40204021
* @param executor Executor to use.
40214022
* @return This jooby instance.
40224023
*/

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,11 @@ public Request push(final String path, final Map<String, Object> headers) {
383383
return this;
384384
}
385385

386+
@Override
387+
public long timestamp() {
388+
return req.timestamp();
389+
}
390+
386391
@Override
387392
public String toString() {
388393
return req.toString();
@@ -427,6 +432,7 @@ default String path() {
427432
* http://domain.com/404<h1>X</h1> {@literal ->} /404%3Ch1%3EX%3C/h1%3E
428433
* }</pre>
429434
*
435+
* @param escape True if we want to escape this path.
430436
* @return The request URL pathname.
431437
*/
432438
default String path(final boolean escape) {
@@ -1108,4 +1114,12 @@ default Request push(final String path) {
11081114
* @return This request.
11091115
*/
11101116
Request push(final String path, final Map<String, Object> headers);
1117+
1118+
/**
1119+
* Request timestamp.
1120+
*
1121+
* @return The time that the request was received.
1122+
*/
1123+
long timestamp();
1124+
11111125
}

0 commit comments

Comments
 (0)