Skip to content

Instantly share code, notes, and snippets.

View arjunKumbakkara's full-sized avatar
💭
Focus

Arjun Kumbakkara arjunKumbakkara

💭
Focus
  • 6d Technologies pvt ltd.
  • Bangalore ,Karnataka , India
View GitHub Profile
@jonikarppinen
jonikarppinen / PdfOrErrorController.java
Last active November 17, 2021 11:49
Example of using ExceptionHandler in Spring Boot: a controller method that returns either binary data or error JSON
package com.company.project.controllers;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Random;
@eugenp
eugenp / PaginationDiscoverabilityListener.java
Last active March 24, 2022 13:07
Pagination with REST - the Discoverability Listener full
package org.baeldung.web.hateoas;
import javax.servlet.http.HttpServletResponse;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriComponentsBuilder;
import com.google.common.base.Preconditions;
@outbounder
outbounder / ClientHelper.java
Created July 7, 2011 13:08
jersey client helper for trusting all certificates in SSL/TLS
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;