Skip to content

Commit

Permalink
request/access log #492
Browse files Browse the repository at this point in the history
* javadoc fixes
* fix #492
  • Loading branch information
jknack committed Oct 5, 2016
1 parent c7261e2 commit 72a7bd0
Show file tree
Hide file tree
Showing 14 changed files with 737 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,34 @@
</encoder>
</appender>

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/app.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/app.%d{yyyy-MM-dd}.log</fileNamePattern>
<totalSizeCap>1mb</totalSizeCap>
</rollingPolicy>

<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>

<appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/access.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/access.%d{yyyy-MM-dd}.log</fileNamePattern>
<totalSizeCap>1mb</totalSizeCap>
</rollingPolicy>

<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>

<logger name="org.jooby.RequestLogger" additivity="false">
<appender-ref ref="ACCESS" />
</logger>

<root level="info">
<appender-ref ref="STDOUT" />
</root>
Expand Down
21 changes: 15 additions & 6 deletions jooby-pac4j/src/main/java/org/jooby/pac4j/Auth.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,22 @@
import java.util.function.Function;
import java.util.stream.Collectors;

import com.google.inject.TypeLiteral;
import org.jooby.Env;
import org.jooby.Jooby;
import org.jooby.Route;
import org.jooby.Routes;
import org.jooby.Session;
import org.jooby.internal.pac4j.*;
import org.jooby.internal.pac4j.AuthCallback;
import org.jooby.internal.pac4j.AuthContext;
import org.jooby.internal.pac4j.AuthFilter;
import org.jooby.internal.pac4j.AuthLogout;
import org.jooby.internal.pac4j.AuthorizerFilter;
import org.jooby.internal.pac4j.BasicAuth;
import org.jooby.internal.pac4j.ClientType;
import org.jooby.internal.pac4j.ClientsProvider;
import org.jooby.internal.pac4j.ConfigProvider;
import org.jooby.internal.pac4j.FormAuth;
import org.jooby.internal.pac4j.FormFilter;
import org.jooby.scope.Providers;
import org.jooby.scope.RequestScoped;
import org.pac4j.core.authorization.authorizer.Authorizer;
Expand All @@ -60,6 +69,7 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.inject.Binder;
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.MapBinder;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.multibindings.OptionalBinder;
Expand Down Expand Up @@ -117,10 +127,9 @@
* </pre>
*
* <p>
* A {@link IndirectBasicAuthClient} depends on {@link Authenticator<UsernamePasswordCredentials>}, default is
* A {@link IndirectBasicAuthClient} depends on {@link Authenticator}, default is
* {@link SimpleTestUsernamePasswordAuthenticator} which is great for development, but nothing good
* for other environments. Next example setup a basic auth with a custom:
* {@link Authenticator<UsernamePasswordCredentials>}:
* for other environments. Next example setup a basic auth with a custom {@link Authenticator}:
* </p>
*
* <pre>
Expand Down Expand Up @@ -151,7 +160,7 @@
* </pre>
*
* <p>
* Like basic auth, form auth depends on a {@link Authenticator<UsernamePasswordCredentials>}.
* Like basic auth, form auth depends on a {@link Authenticator}.
* </p>
*
* <p>
Expand Down
1 change: 1 addition & 0 deletions jooby/src/main/java/org/jooby/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ default <T> Option<T> when(final Predicate<String> predicate, final T result) {
/**
* Get or chain the required xss functions.
*
* @param xss XSS to combine.
* @return Chain of required xss functions.
*/
default Function<String, String> xss(final String... xss) {
Expand Down
1 change: 1 addition & 0 deletions jooby/src/main/java/org/jooby/Jooby.java
Original file line number Diff line number Diff line change
Expand Up @@ -4017,6 +4017,7 @@ public Jooby executor(final ExecutorService executor) {
*
* The {@link ExecutorService} will automatically shutdown.
*
* @param name Name of the executor.
* @param executor Executor to use.
* @return This jooby instance.
*/
Expand Down
14 changes: 14 additions & 0 deletions jooby/src/main/java/org/jooby/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,11 @@ public Request push(final String path, final Map<String, Object> headers) {
return this;
}

@Override
public long timestamp() {
return req.timestamp();
}

@Override
public String toString() {
return req.toString();
Expand Down Expand Up @@ -427,6 +432,7 @@ default String path() {
* http://domain.com/404<h1>X</h1> {@literal ->} /404%3Ch1%3EX%3C/h1%3E
* }</pre>
*
* @param escape True if we want to escape this path.
* @return The request URL pathname.
*/
default String path(final boolean escape) {
Expand Down Expand Up @@ -1108,4 +1114,12 @@ default Request push(final String path) {
* @return This request.
*/
Request push(final String path, final Map<String, Object> headers);

/**
* Request timestamp.
*
* @return The time that the request was received.
*/
long timestamp();

}
Loading

0 comments on commit 72a7bd0

Please sign in to comment.