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 io.netty.handler.ssl.util.InsecureTrustManagerFactory; | |
import io.netty.handler.ssl.util.KeyManagerFactoryWrapper; | |
import javax.net.ssl.KeyManager; | |
SslManagerBundle insecureSslManagerBundle = SslManagerBundle.of( | |
new KeyManagerFactoryWrapper(new KeyManager() {}), | |
InsecureTrustManagerFactory.INSTANCE); | |
insecureSslBundle = SslBundle.of(null, | |
null, |
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
ObjectPostProcessor<AuthenticationEntryPoint> authenticationEntryPointFilterPostProcessor = new ObjectPostProcessor<>() { | |
@Override | |
public <O extends AuthenticationEntryPoint> O postProcess(O authenticationEntryPoint) { | |
if (authenticationEntryPoint instanceof DelegatingAuthenticationEntryPoint delegatingAuthenticationEntryPoint) { | |
Field entryPointsField = ReflectionUtils.findField(DelegatingAuthenticationEntryPoint.class, "entryPoints"); | |
assert entryPointsField != null; | |
entryPointsField.setAccessible(true); | |
LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = | |
(LinkedHashMap<RequestMatcher, AuthenticationEntryPoint>) ReflectionUtils.getField(entryPointsField, | |
delegatingAuthenticationEntryPoint); |
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
logging.level._org.springframework.web.servlet.HandlerMapping=DEBUG |
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
@ExceptionHandler(Exception.class) | |
public ResponseEntity<String> handleError(HttpServletRequest req, Exception ex) { | |
if (ex.getCause() instanceof SocketTimeoutException) { | |
return ResponseEntity.status(HttpStatus.GATEWAY_TIMEOUT).body(HttpStatus.GATEWAY_TIMEOUT.getReasonPhrase()); | |
} | |
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase()); | |
} |
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
org.apache.catalina.core.ApplicationDispatcher#wrapRequest |
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 sandipchitale.twowaytlsclient.twowaytlsclient; | |
import jakarta.servlet.*; | |
import jakarta.servlet.http.HttpServletRequest; | |
import jakarta.servlet.http.HttpServletRequestWrapper; | |
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.core.Ordered; | |
import org.springframework.core.annotation.Order; | |
import org.springframework.http.HttpHeaders; |
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
# | |
# Author: Brian Beffa <brbsix@gmail.com> | |
# Original source: https://brbsix.github.io/2015/11/29/accessing-tab-completion-programmatically-in-bash/ | |
# License: LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.txt) | |
# | |
get_completions(){ | |
local completion COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS COMPREPLY=() | |
# load bash-completion if necessary |
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
static class PreConfigDataEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { | |
@Override | |
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { | |
PropertiesPropertySourceLoader propertiesPropertySourceLoader = new PropertiesPropertySourceLoader(); | |
try { | |
List<PropertySource<?>> propertySources = propertiesPropertySourceLoader.load("Config resource 'class path resource [application.properties]' via location 'optional:classpath:/'", | |
new ClassPathResource("/application.properties")); | |
propertySources.stream().forEach((PropertySource<?> propertySource) -> { | |
Object springProfilesActive = propertySource.getProperty("spring.profiles.active"); | |
if (springProfilesActive instanceof String springProfilesActiveString) { |
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
record $MODEL$(long id, String name) {} | |
@Bean | |
@Qualifier("$DCMODEL$-rest-client") | |
RestClient $DCMODEL$RestClient(RestClient.Builder builder) { | |
return builder.baseUrl("https://$DCMODEL$.api.com/$MODEL$s").build(); | |
} | |
interface $MODEL$Service { | |
@GetExchange |
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 sandipchitale.webclient; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.http.HttpHeaders; | |
import org.springframework.http.HttpStatusCode; | |
import org.springframework.http.ResponseEntity; | |
import org.springframework.http.client.reactive.ClientHttpRequest; | |
import org.springframework.http.server.reactive.ServerHttpRequest; | |
import org.springframework.web.bind.annotation.*; |
NewerOlder