This file contains hidden or 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
$(function() { | |
var jsonDec; | |
try { | |
jsonDec = decodeURIComponent(window.atob($.captures().jsonEnc)); | |
} catch(e) { | |
$('#errors').puidialog('show'); | |
alert("This page is just available for those who already added items to the cart!"); | |
location.href = 'shopping.html'; | |
} | |
var cart = JSON.parse(jsonDec); |
This file contains hidden or 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
$("#submitButton").click(function() { | |
$.ajax({ | |
type : "POST", | |
url : "api/cart", | |
contentType : "application/json", | |
data : JSON.stringify(cartItems), | |
success : function(data, status, xhr) { | |
var dataEnc = window.btoa(unescape(encodeURIComponent(JSON.stringify(data)))); | |
$.redirect('/virtual-store/confirm.html', dataEnc); | |
$('#jsonForm').capture(); |
This file contains hidden or 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 pkg; | |
import java.text.SimpleDateFormat; | |
import java.util.TimeZone; | |
import javax.ws.rs.Produces; | |
import javax.ws.rs.ext.ContextResolver; | |
import javax.ws.rs.ext.Provider; | |
import org.codehaus.jackson.map.DeserializationConfig; |
This file contains hidden or 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 pckg; | |
import javax.enterprise.context.ApplicationScoped; | |
import javax.enterprise.context.RequestScoped; | |
import javax.enterprise.inject.Default; | |
import javax.enterprise.inject.Disposes; | |
import javax.enterprise.inject.Produces; | |
import javax.persistence.EntityManager; | |
import javax.persistence.EntityManagerFactory; | |
import javax.persistence.PersistenceUnit; |
This file contains hidden or 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 utils; | |
import java.io.ByteArrayInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import net.sf.expectit.Expect; | |
import net.sf.expectit.ExpectBuilder; | |
import net.sf.expectit.matcher.Matchers; |
This file contains hidden or 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 javax.xml.ws.Binding; | |
import javax.xml.ws.BindingProvider; | |
import javax.xml.ws.WebServiceRef; | |
import javax.xml.ws.handler.Handler; | |
public class WebServiceCaller implements Serializable { | |
private static final int MINUTES = 60000; | |
@WebServiceRef(wsdlLocation = "http://localhost/WebService.wsdl") |
This file contains hidden or 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
@ApplicationScoped | |
public class AsyncProcessManager implements Serializable { | |
private Map<AsyncProcess, Future<Object>> asyncProcesses = new ConcurrentHashMap<AsyncProcess, Future<Object>>(); | |
public void addProcess(AsyncProcess process) { | |
// put the process into the map. | |
} | |
public void removeProcess(AsyncProcess process) { |
This file contains hidden or 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
@BusinessController | |
public class MeuBC implements Serializable { | |
@Inject MeuDAO meuDAO; | |
public List<JPABean> listaJPABeans() { | |
return meuDAO.findAll(); | |
} | |
} |
This file contains hidden or 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
Durante a migração de algumas funcionalidades de um sistema que foi desenvolvido utilizando JEE 5 para JEE 6 conforme | |
algumas experiências expostas em (https://gist.github.com/2361046), fui observando e prestando a atenção em especial no | |
funcionamento do DI (Dependency Injection) do CDI. Alguns detalhes que exponho aqui podem parecer óbvios para quem já | |
trabalha com o CDI, mas que para "marinheiros de primeira viagem" possam não ser naturais. | |
- Injections null em construtores e como o CDI os trata | |
A verdade sobre construtores é: JAMAIS coloque muita responsabilidade em construtores. Construtores servem para | |
inicializar um objeto, desde que não se tenha muitas dependências para realizar isso. Ao usar CDI, até recomendo que nem | |
se crie um construtor. Você raramente (só para não dizer NUNCA) irá usar a keyword "new" para instanciar objetos CDI. | |
Deixe o container cuidar disso pra você. |
This file contains hidden or 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
Eis aqui as experiências que tive até o momento, ao migrar algumas funcionalidades de um sistema, desenvolvido usando | |
Demoiselle 1 com JSF 1.2, RichFaces 3.3, JPA para Demoiselle 2, JSF 2, RichFaces 4 e J2EE 6. | |
*** XHTML: | |
- Mudar xmlns do a4j para xmlns:a4j="http://richfaces.org/a4j" | |
- Mudar tag "<body>" para "<h:body>". | |
- Mudar tag "<head> para "<h:head>". | |
- Retirar o prefixo "on" dos eventos atribuidos na propriedade "event" das tags ajax. | |
Ex.: JSF1: "<a4j:support event="onchange">", JSF2: "<a4j:ajax event="change">" |