I hereby claim:
- I am azare on github.
- I am panic88 (https://keybase.io/panic88) on keybase.
- I have a public key ASDIj00r803VJn5YC7HVE2j0yRHMIyHufB1k-Ocb7hHmjQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// | |
// Sieve.swift | |
// | |
// The MIT License (MIT) | |
// | |
// Copyright (c) 2016 Erik J. Azar | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights |
public class ServiceContext { | |
private static final ThreadLocal<ServiceContext> instance = new ThreadLocal<ServiceContext>(); | |
public static ServiceContext get() { | |
if (instance.get() == null) { | |
instance.set(new ServiceContext()); | |
} | |
return instance.get(); | |
} |
public class ResponseHeaderInterceptor extends AbstractPhaseInterceptor<Message> { | |
private static final String ORIGINAL_HTTP_STATUS_CODE = "X-Original-Http-Status-Code"; | |
public ResponseHeaderInterceptor() { | |
super(Phase.MARSHAL); | |
} | |
@SuppressWarnings("unchecked") | |
@Override |
public class RequestHeaderInterceptor extends AbstractPhaseInterceptor<Message> { | |
private final static String HEADER_STATUS_CODE_OVERRIDE_KEY = "X-HTTP-Status-Code-Override"; | |
public AuthenticationInterceptor() { | |
super(Phase.READ); | |
} | |
@SuppressWarnings("unchecked") | |
@Override |
public class OutboundHttpStatusCodeInterceptor extends AbstractPhaseInterceptor<Message> { | |
public OutboundHttpStatusCodeInterceptor() { | |
super(Phase.SEND); | |
} | |
@Override | |
public void handleMessage(Message message) { | |
if (ServiceContext.get().isHttpStatusCodeValueOverridden()) { |