Skip to content

Instantly share code, notes, and snippets.

View d-subrahmanyam's full-sized avatar
👼
god mode

Subrahmanyam d-subrahmanyam

👼
god mode
View GitHub Profile
@d-subrahmanyam
d-subrahmanyam / BufferedRequestWrapper.java
Created September 12, 2019 18:00
BufferedServletWrapper to process the request before a Spring REST Controller
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.*;
public class BufferedRequestWrapper extends HttpServletRequestWrapper {
private ByteArrayInputStream bais = null;
private ByteArrayOutputStream baos = null;
private BufferedServletInputStream bsis = null;
@d-subrahmanyam
d-subrahmanyam / EventUtils.java
Created September 12, 2019 02:53
jslack-boot implementation gist
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.JsonPath;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class EventUtils {
public static String detectEventType(String json) {
String eventType = null;
Object document = Configuration.defaultConfiguration().jsonProvider().parse(json);
@d-subrahmanyam
d-subrahmanyam / jspc-pom.xml
Created June 23, 2019 19:23
compile jsp to servlet using org.apache.sling:jspc-maven-plugin:2.1.0 and embed them into a webapp
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.subbu.jsp</groupId>
<artifactId>JspServlets</artifactId>
<version>1.0-SNAPSHOT</version>
@d-subrahmanyam
d-subrahmanyam / Mosaic.java
Created December 28, 2017 11:34 — forked from codebox/Mosaic.java
Java code to create a mosaic image from multiple small tiles (the code is a bit rough, sorry)
package uk.org.codebox.mosaic;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;