Skip to content

Instantly share code, notes, and snippets.

View danielbryantuk's full-sized avatar

Daniel Bryant danielbryantuk

View GitHub Profile

Keybase proof

I hereby claim:

  • I am danielbryantuk on github.
  • I am danielbryantuk (https://keybase.io/danielbryantuk) on keybase.
  • I have a public key ASAquBNL0j5RGtPCR8mFAolow-jpKHr5dai4Q_fwuEEU1wo

To claim this, I am signing this object:

[nio-8080-exec-1] u.c.t.e.c.w.f.CorrelationHeaderFilter : No correlationId found in Header. Generated : d205991b-c613-4acd-97b8-97112b2b2ad0
[pool-1-thread-1] u.c.t.e.c.w.c.CorrelatingRestClient : start REST request to http://localhost:8080/news with correlationId d205991b-c613-4acd-97b8-97112b2b2ad0
[nio-8080-exec-2] u.c.t.e.c.w.f.CorrelationHeaderFilter : Found correlationId in Header : d205991b-c613-4acd-97b8-97112b2b2ad0
[pool-1-thread-1] u.c.t.e.c.w.c.CorrelatingRestClient : completed REST request to http://localhost:8080/news with correlationId d205991b-c613-4acd-97b8-97112b2b2ad0
public class CorrelationCallable<V> implements Callable<V> {
private String correlationId;
private Callable<V> callable;
public CorrelationCallable(Callable<V> targetCallable) {
correlationId = RequestCorrelation.getId();
callable = targetCallable;
}
@Component
public class CorrelatingRestClient implements RestClient {
private RestTemplate restTemplate = new RestTemplate();
@Override
public String getForString(String uri) {
String correlationId = RequestCorrelation.getId();
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.set(RequestCorrelation.CORRELATION_ID, correlationId);
public class RequestCorrelation {
public static final String CORRELATION_ID = "correlationId";
private static final ThreadLocal<String> id = new ThreadLocal<String>();
public static String getId() { return id.get(); }
public static void setId(String correlationId) { id.set(correlationId); }
public class CorrelationHeaderFilter implements Filter {
//...
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
final HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String currentCorrId = httpServletRequest.getHeader(RequestCorrelation.CORRELATION_ID_HEADER);
@danielbryantuk
danielbryantuk / ews-client.cs
Created February 26, 2014 14:58
Example Epoints Web Service (EWS) Client Connection Code in C#
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
//This is an example how to interact with Epoints API using C# Script execution engine (http://www.csscript.net/)
class Script
{
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location="file:appConfigOverride.properties" order="-1"
ignore-unresolvable="true" ignore-resource-not-found="true" />
package uk.co.taidev.solrtesting.solr;
import com.google.common.base.Throwables;
import com.google.common.io.Files;
import com.iat.compassmassive.normalisedproductloader.springutils.SpringProfileName;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.client.solrj.response.UpdateResponse;
localhost ================================================================================
localhost
localhost Chef encountered an error attempting to create the client "vagrant.vm"
localhost
localhost ================================================================================
localhost
localhost
localhost
localhost
localhost Authorization Error: