Skip to content

Instantly share code, notes, and snippets.

View fedotxxl's full-sized avatar

Fedor Belov fedotxxl

View GitHub Profile
location ~ ^/otm-proxy/(.*) {
resolver 8.8.8.8;
access_log /var/log/alfadart-prebid-server/otm.log prebid_server_otm_proxy;
proxy_pass https://ssp.otm-r.com/$1;
proxy_set_header Host ssp.otm-r.com;
}
@Bean
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> webServerFactoryCustomizer() {
return new WebServerFactoryCustomizer<TomcatServletWebServerFactory>() {
@Override
public void customize(TomcatServletWebServerFactory factory) {
TomcatServletWebServerFactory tomcat = (TomcatServletWebServerFactory) factory;
tomcat.addContextCustomizers(context -> context.setCookieProcessor(new LegacyCookieProcessor()));
}
};
}
package com.devadmin.utils.dropwizard;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.util.ContextInitializer;
import ch.qos.logback.core.joran.spi.JoranException;
import com.codahale.metrics.MetricRegistry;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.dropwizard.logging.LoggingFactory;
import io.dropwizard.logging.LoggingUtil;
objectMapper.readValue(node, new TypeReference<Map<String, List<TagTranslation>>>() {
}))
this.order = to.list(JacksonUtils.fromJson(order, NabuOrderWithField[].class));
<!-- http://stackoverflow.com/a/36707798 -->
<appender name="main" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/var/log/http-file-cache/cache.log</file>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] [%X] %-5level %logger{36} - %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>/var/log/http-file-cache/cache.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>10MB</maxFileSize>
<maxHistory>30</maxHistory>
//<import resource="applicationContext.log.db.${log.to.db:false}.xml"/>
//http://stackoverflow.com/questions/3035630/how-to-achieve-conditional-resource-import-in-a-spring-xml-context
private void loadConditionalProperties() {
try {
Properties properties = new Properties();
try (InputStream stream = FileUtils.openInputStream(new File(getDefaultConfigPath()))) {
properties.load(stream);
}
package com.devadmin.ta.domain;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.QueryParam;
/**
* Created by fbelov on 4/16/16.
*/
public class QueryParamWithDefaultValueRequest {
@Component
@Provider
public class SiteWithParamsConverterProvider implements ParamConverterProvider {
@Autowired
private Converter converter;
@Override
public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) {
if (genericType.equals(SiteWithParams.class)) {
client = ClientBuilder.newClient();
client.register(new LoggingFilter());
client.property(ClientProperties.CONNECT_TIMEOUT, timeoutInMillis);
client.property(ClientProperties.READ_TIMEOUT, timeoutInMillis);