Skip to content

Instantly share code, notes, and snippets.

Nicolas Oeschger nioe

Block or report user

Report or block nioe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View JsonDateTimeAdapter.java
package ch.exq.triplog.server.util.json;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class JsonDateTimeAdapter extends XmlAdapter<String, LocalDateTime> {
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
View LoggerProducer
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LoggerProducer {
@Produces
public Logger produce(InjectionPoint injectionPoint) {
@nioe
nioe / HttpHeader.java
Last active Sep 8, 2019
Get remote IP from HttpServletRequest
View HttpHeader.java
public enum HttpHeader {
AUTHORIZATION("Authorization"),
AUTHENTICATION_TYPE_BASIC("Basic"),
X_AUTH_TOKEN("X-AUTH-TOKEN"),
WWW_Authenticate("WWW-Authenticate"),
X_FORWARDED_FOR("X-Forwarded-For"),
PROXY_CLIENT_IP("Proxy-Client-IP"),
WL_PROXY_CLIENT_IP("WL-Proxy-Client-IP"),
HTTP_CLIENT_IP("HTTP_CLIENT_IP"),
HTTP_X_FORWARDED_FOR("HTTP_X_FORWARDED_FOR");
@nioe
nioe / FutureCallback.java
Last active Aug 29, 2015
Generic implementation to wait for Java EE Futures and run callback after one is done
View FutureCallback.java
import java.util.concurrent.ExecutionException;
public interface FutureCallback<CallbackType, FutureType> {
public CallbackType work(FutureProvider<FutureType> futureContainer) throws InterruptedException,
ExecutionException;
}
You can’t perform that action at this time.