Skip to content

Instantly share code, notes, and snippets.

View vijayakumar-psg587's full-sized avatar

Vijayakumar vijayakumar-psg587

View GitHub Profile
pipeline {
agent any
tools {
maven 'localMaven'
git 'localGit'
jdk 'localJava'
/*
For opehsnift jenkins
maven 'MAVEN-3.5.4'
@vijayakumar-psg587
vijayakumar-psg587 / .java
Created January 11, 2019 05:56
SwaggerFilter
@Component
public class SwaggerFilter implements Filter {
final String APPLICATION_XHTML = "application/xhtml";
final String XML_ELEMENT_START = "<Json>";
final String XML_ELEMENT_END = "</Json>";
@Override
public void init(FilterConfig config) throws ServletException {
}
@vijayakumar-psg587
vijayakumar-psg587 / .java
Created January 11, 2019 05:57
ByteArrayPrintWriter
/**
* IMplemented own Printer as the new wrapper
*
*/
public class ByteArrayPrinter {
private ByteArrayOutputStream baos = new ByteArrayOutputStream();
private PrintWriter pw = new PrintWriter(baos);
@vijayakumar-psg587
vijayakumar-psg587 / .java
Created January 11, 2019 05:58
ByteArrayServletStream
public class ByteArrayServletStream extends ServletOutputStream {
ByteArrayOutputStream baos;
ByteArrayServletStream(ByteArrayOutputStream baos) {
this.baos = baos;
}
@Override
public void write(int param) throws IOException {
@vijayakumar-psg587
vijayakumar-psg587 / .java
Created January 11, 2019 06:06
DumpFilter
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.Filter;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
//FileReadDTO is the POJO class
public class CustomFileListSupplier implements Supplier<List<FileReadDTO>> {
@Override
public List<FileReadDTO> get() {
public class CustomFileListCombiner implements BinaryOperator<List<FileReadDTO>> {
@Override
public List<FileReadDTO> apply(List<FileReadDTO> t, List<FileReadDTO> u) {
List<FileReadDTO> newList = new ArrayList<>();
newList.addAll(t);
newList.addAll(u);
return newList;
}
@Service
public class FileService {
public List<FileReadDTO> readFileFromFTPAndGenerateObjects(Path path) throws IOException{
List<FileReadDTO> list1 ;
try{
Files.lines(path).forEach(item -> System.out.println(item));
list1 = Files.lines(path).collect(new CustomFileCollector());
@vijayakumar-psg587
vijayakumar-psg587 / FileProcessorController.java
Created January 17, 2019 16:32
FileProcessorController
@GetMapping("/reportFile")
@ApiOperation(produces = MediaType.APPLICATION_JSON_VALUE, httpMethod = "GET", response = String.class,
value = "GetAll feed back plans based on planMatch and cost", notes = "Sample note")
public void processFileAndOutput(HttpServletResponse res) {
//Read the file from an FTP server
//For now read it from the resource folder
// ApplicationHome home = new ApplicationHome(this.getClass());
// File dir = home.getDir();
// System.out.println("dfs"+dir);
Path filePath = Paths.get(System.getProperty("user.dir")+"/static/test.txt");
@vijayakumar-psg587
vijayakumar-psg587 / index.html
Last active April 8, 2019 06:06
SVG symbols demo
<svg display="none">
<symbol id="icon-bell" viewBox="0 0 1024 1024">
<title>bell</title>
<path class="path1" d="M97.6 758.4c20.8 11.2 60.8 27.2 132.8 38.4 12.8 1.6 25.6 4.8 40 6.4 11.2 123.2 116.8 220.8 243.2 220.8s230.4-97.6 243.2-220.8c12.8-1.6 25.6-3.2 38.4-6.4 60.8-11.2 107.2-24 137.6-43.2 24-14.4 40-36.8 46.4-62.4 6.4-27.2 0-56-16-78.4-4.8-6.4-8-11.2-12.8-16-3.2-3.2-4.8-6.4-8-9.6-1.6-1.6-1.6-3.2-3.2-4.8l-8-11.2c-54.4-70.4-91.2-118.4-91.2-276.8 0-166.4-147.2-302.4-328-302.4-88 0-171.2 32-233.6 89.6-60.8 57.6-94.4 132.8-92.8 211.2 0 156.8-36.8 204.8-91.2 276.8l-6.4 9.6c-6.4 8-12.8 16-17.6 22.4-1.6 3.2-4.8 6.4-6.4 9.6-17.6 22.4-24 52.8-17.6 81.6s25.6 51.2 51.2 65.6zM512 896c-51.2 0-96-33.6-110.4-80 35.2 1.6 72 3.2 108.8 3.2 38.4 0 75.2-1.6 112-3.2-14.4 46.4-59.2 80-110.4 80zM196.8 649.6c59.2-80 116.8-155.2 116.8-355.2 0-43.2 17.6-84.8 52.8-116.8 38.4-35.2 89.6-54.4 145.6-54.4 110.4 0 200 78.4 200 174.4 0 201.6 57.6 276.8 118.4 355.2l3.2 4.8c-14.4 4.8-35.2 9.6-60.8 14.4-72 12.8-164.8 19.2-260.8 19.2s-18