Skip to content

Instantly share code, notes, and snippets.

@edubriguenti
edubriguenti / basic_auth_WS.java
Last active December 25, 2015 19:39
Basic Authentication WebService
try {
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
Properties.obterPropertiesEndPoint().readString(Constantes.ENDPOINT_PESSOAS_USERNAME),
descriptografarSenha(Properties.obterPropertiesEndPoint().readString(Constantes.ENDPOINT_PESSOAS_PASSWORD)).toCharArray());
}
});
@edubriguenti
edubriguenti / ws_install.bat
Last active December 26, 2015 13:28
WSIMPORT
"D:\desenv\IBM\SDP\runtimes\base_v7\bin\wsimport.bat" -d "D:\WS" -p pacote -keep -verbose wsdl
pause
@edubriguenti
edubriguenti / maven_install_stand_alone_jar.txt
Last active December 26, 2015 21:59
Maven install standalone jar
mvn install:install-file -Dfile=sonar-maven-plugin-3.7.1-RC2.jar -DgroupId=sonar-maven-plugin -DartifactId=org.codehaus.sonar -Dversion=3.7.1 -Dpackaging=jar
@edubriguenti
edubriguenti / junit_ws.java
Last active December 26, 2015 22:19
Teste de web-service com JUNIT
@RunWith(MockitoJUnitRunner.class)
public class AcessoDadosCadastroSeguradoTest {
protected static URL wsdlURL;
protected static QName serviceName;
protected static QName portName;
static {
serviceName = new QName("XX", "XX");
portName = new QName("XX", "XX");
@edubriguenti
edubriguenti / endpoint_JaxWS.java
Last active December 27, 2015 00:29
JAX WS dynamically change endpoint
/**
* The following snippets shows how to set a custom endpoint for a JAX-WS generated WebClient on runtime
*/
// Get the service and the port
SampleService service = new SampleService();
Sample port = service.getESamplePort();
// Use the BindingProvider's context to set the endpoint
BindingProvider bp = (BindingProvider)port;
@edubriguenti
edubriguenti / Sonar_ant_build.xml
Created November 8, 2013 10:50
Sonar Ant Build
<project name="My Project" default="all" basedir="."
xmlns:sonar="antlib:org.sonar.ant">
<!--
<property name="sonar.jdbc.url"
value="jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8" />
-->
<property name="sonar.host.url" value="http://localhost:9000" />
<property name="sonar.jdbc.username" value="sonar" />
<property name="sonar.jdbc.password" value="sonar" />
@edubriguenti
edubriguenti / applet_sign.txt
Last active December 30, 2015 22:39
Signed Applet
keytool -genkey
keytool -selfcert
jarsigner -signedjar tecladoVirtualSigned.jar tecladoVirtual.jar mykey
@edubriguenti
edubriguenti / jsf_redirect.java
Last active January 1, 2016 23:49
JSF redirectListener
public class RedirectLoginListener implements PhaseListener {
public static final LogManager LOGGER = LogManager.getLog(RedirectLoginListener.class);
private final Properties properties = PropertiesLoader.loadProperties(PropertiesConstants.PROPERTIES_PATH);
public PhaseId getPhaseId() {
return PhaseId.RESTORE_VIEW;
}
@edubriguenti
edubriguenti / quest_servico.txt
Last active January 2, 2016 19:39
Informações importantes em um serviço
Campo Tipo Obrigatorio
Nome String Sim
Endereço String Não
Idade Integer Não
Descrição Valor
1.1. Tempo máximo de resposta por requisição 7 s
1.2. Tempo médio de resposta por requisição 7 s
1.3. Número máximo de requisições simultâneas 20 requisições
@edubriguenti
edubriguenti / Print Obj Attributes
Created September 8, 2014 13:39
Print the attibutes of an object
var output = '';
for (var property in obj) {
output += property + ': ' + obj[property]+'; ';
}
alert(output);