This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.snaphop.jaxws; | |
import static java.util.Arrays.asList; | |
import java.net.URL; | |
import java.util.Collection; | |
import java.util.Collections; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.ServiceLoader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAVEN_REPO=/home/maven/repo/release | |
PACKAGES="com/snaphop/snaphopsuite-web com/snaphop/snaphop-ats-web" | |
for p in $PACKAGES; do | |
PACKAGE=$MAVEN_REPO/$p | |
echo "Truncating $p" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static java.util.Arrays.asList; | |
import static org.springframework.util.StringUtils.hasText; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
import javax.servlet.ServletContext; | |
import org.slf4j.Logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import javax.xml.bind.annotation.XmlAttribute; | |
import javax.xml.bind.annotation.XmlElement; | |
import javax.xml.bind.annotation.XmlRootElement; | |
import javax.xml.bind.annotation.XmlValue; | |
@XmlRootElement(name="testsuites") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.snaphop.spring; | |
import java.io.IOException; | |
import javax.servlet.FilterChain; | |
import javax.servlet.ServletException; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import org.springframework.http.MediaType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExampleController { | |
@RequestMapping(value = {"/blah", ""}) | |
public @ResponseBody Map<String, Object> blah(@Valid Blah blah, BindingResult errors, ModelMap model) { | |
if (errors.hasErrors()) { | |
return ModelUtils.mapBuilder().put("status", "errors").build(); | |
} | |
return ModelUtils.mapBuilder().put("status", blah.getFirst() + " " + blah.getLast()).build(); | |
} | |
public static class Blah { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ResourceUtils { | |
private final static Supplier<Cache<ClasspathResourceKey, String>> cacheSupplier = | |
Suppliers.memoize(new Supplier<Cache<ClasspathResourceKey, String>>() { | |
@Override | |
public Cache<ClasspathResourceKey, String> get() { | |
return CacheBuilder.newBuilder().maximumSize(100).expireAfterAccess(10000, TimeUnit.SECONDS).build(); | |
} | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.snaphop.util; | |
import javax.annotation.Nullable; | |
import org.slf4j.helpers.MessageFormatter; | |
import java.lang.IllegalArgumentException; | |
import java.lang.IllegalStateException; | |
public abstract class Precondition<ARG extends IllegalArgumentException, STATE extends IllegalStateException> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CrockfordIdGenerator { | |
public static String encodeBase32(UUID uuid) { | |
Long leastBits = uuid.getLeastSignificantBits(); | |
Long mostBits = uuid.getMostSignificantBits(); | |
byte[] bytes = ByteBuffer.allocate(16) | |
.putLong(mostBits) | |
.putLong(leastBits).array(); | |
return new String(encodeBase32(bytes)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.snaphop.util; | |
import static com.google.common.base.Preconditions.checkState; | |
import java.io.Reader; | |
import java.util.Iterator; | |
import javax.xml.bind.JAXBContext; | |
import javax.xml.bind.JAXBElement; |