Skip to content

Instantly share code, notes, and snippets.

View Qkyrie's full-sized avatar

QDS Qkyrie

  • Layer 0
View GitHub Profile
@Qkyrie
Qkyrie / logback.xml
Created November 30, 2013 01:48
default logback.xml
<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true" scanPeriod="3 seconds">
<contextName>${artifactId}</contextName>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{32} - %msg%n
</pattern>
</encoder>
@Qkyrie
Qkyrie / ApplicationConfig.java
Created November 30, 2013 01:47
Default Application Config for Spring NO-XML Approach
import com.qkyrie.dom.domtools.Application;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Controller;
/**
* Created with IntelliJ IDEA.
@Qkyrie
Qkyrie / JPAConfiguration.java
Created November 30, 2013 01:45
Spring JPAConfiguration
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Qkyrie
Qkyrie / calljs.java
Created July 18, 2013 09:35
code to call javascript from a managed bean
public void save() {
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.execute("dialog.hide()")
}
@Qkyrie
Qkyrie / callwebservice.java
Created July 17, 2013 08:07
make a web service send the data chunked. This will tell the host it will send it chunked before sending it
...
private static final int STREAMING_CHUNK_SIZE = 4096;
...
Map<String, Object> ctxt = ((BindingProvider)service.getUploadVisitorInformationImplPort()).getRequestContext();
ctxt.put(com.sun.xml.ws.client.BindingProviderProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, STREAMING_CHUNK_SIZE);
@Qkyrie
Qkyrie / keystoreswitcher.java
Created July 17, 2013 08:06
set keystores and truststores
System.setProperty("javax.net.ssl.keyStore", getKeystoreUrl());
System.setProperty("javax.net.ssl.keyStorePassword", getKeystorePassword());
System.setProperty("javax.net.ssl.trustStore", getTruststoreUrl());
System.setProperty("javax.net.ssl.trustStorePassword", getTruststorePassword());
@Qkyrie
Qkyrie / WebserviceDebugLogging.java
Created July 17, 2013 08:04
set the system properties to display the debug logging for webservice calls
System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true");
System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
@Qkyrie
Qkyrie / pom.xml
Created July 17, 2013 08:03
sign jar with maven
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>sign</id>
<phase>prepare-package</phase>
<goals>
<goal>sign</goal>
@Qkyrie
Qkyrie / pom.xml
Created July 17, 2013 08:02
copy library to folder with maven
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
@Qkyrie
Qkyrie / pom.xml
Created July 17, 2013 08:00
Add sources for maven to see (build-helper-maven-plugin)
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>