Skip to content

Instantly share code, notes, and snippets.

View rcaneppele's full-sized avatar

Rodrigo da Silva Ferreira Caneppele rcaneppele

  • Alura
  • Brasília
View GitHub Profile
@rcaneppele
rcaneppele / AutorizadorRequestFilter.java
Created March 11, 2016 21:43
JAX-RS AutorizadorRequestFilter
import java.io.IOException;
import javax.annotation.Priority;
import javax.ws.rs.Priorities;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.Provider;
@rcaneppele
rcaneppele / CandleStickFactoryTest.java
Last active September 27, 2017 12:30
FJ-22 - CandlestickFactory com Java 8 e Testes de Unidade
public class CandleStickFactoryTest {
@Test
public void deveriaCriar3CandlesParaNegociacoesEmTresDiasDistintos() {
Calendar hoje = Calendar.getInstance();
Negociacao negociacao1 = new Negociacao(40.5, 100, hoje);
Negociacao negociacao2 = new Negociacao(45.0, 100, hoje);
Negociacao negociacao3 = new Negociacao(39.8, 100, hoje);
Negociacao negociacao4 = new Negociacao(42.3, 100, hoje);
@rcaneppele
rcaneppele / CSPFilter.java
Last active October 5, 2017 16:02
Filtro para definir Header CSP
@WebFilter("/*")
public class CSPFilter implements Filter {
private static final String POLICY = "default-src 'none';"
+ "base-uri 'self';"
+ "font-src 'self';"
+ "form-action 'self';"
+ "img-src 'self';"
+ "media-src 'none';"
+ "object-src 'none';"
@rcaneppele
rcaneppele / livros.txt
Last active October 11, 2017 14:23
FJ-91 - Livros
* Refactoring: Improving the Design of Existing Code
https://www.amazon.com.br/Refactoring-Improving-Design-Existing-Code/dp/0201485672
* Clean Code: A Handbook of Agile Software Craftsmanship
https://www.amazon.com.br/Clean-Code-Handbook-Software-Craftsmanship-ebook/dp/B001GSTOAM
* Domain-Driven Design: Tackling Complexity in the Heart of Software
https://www.amazon.com.br/Domain-Driven-Design-Tackling-Complexity-Software-ebook/dp/B00794TAUG
* Implementing Domain-Driven Design
@rcaneppele
rcaneppele / Escritor.java
Last active November 21, 2018 14:43
Exemplo de uso dos principios SOLID
public interface Escritor {
void escrever(String linha);
}
@rcaneppele
rcaneppele / Estudante.java
Created May 6, 2024 11:33
Mapeamento ManyToMany com JPA
@Entity
@Table(name = "estudantes")
public class Estudante {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String nome;
//outros atributos...
@rcaneppele
rcaneppele / Estudante.java
Created May 6, 2024 11:52
Mapeamento ManyToMany com colunas adicionais na JPA
@Entity
@Table(name = "estudantes")
public class Estudante {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String nome;
//outros atributos...