Commit ea2ef8690f19b35b2c1464133ab16fec10662d28
1 parent
5830b1d9
Exists in
master
OPEN - issue FWK-164: Método anotado com @PostConstruct na classe
FacesContextProxy viola especificação CDI https://demoiselle.atlassian.net/browse/FWK-164
Showing
2 changed files
with
16 additions
and
4 deletions
Show diff stats
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/proxy/FacesContextProxy.java
| ... | ... | @@ -22,19 +22,30 @@ import javax.faces.context.ResponseStream; |
| 22 | 22 | import javax.faces.context.ResponseWriter; |
| 23 | 23 | import javax.faces.event.PhaseId; |
| 24 | 24 | import javax.faces.render.RenderKit; |
| 25 | +import javax.inject.Inject; | |
| 26 | + | |
| 27 | +import br.gov.frameworkdemoiselle.annotation.Name; | |
| 28 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
| 25 | 29 | |
| 26 | 30 | @Default |
| 27 | 31 | public class FacesContextProxy extends FacesContext implements Serializable { |
| 28 | 32 | |
| 29 | 33 | private static final long serialVersionUID = 1L; |
| 30 | - | |
| 34 | + | |
| 35 | + @Inject | |
| 36 | + @Name("demoiselle-jsf-bundle") | |
| 37 | + private ResourceBundle bundle; | |
| 38 | + | |
| 31 | 39 | @PostConstruct |
| 40 | + protected void initialize() { | |
| 41 | + getDelegate(); | |
| 42 | + } | |
| 43 | + | |
| 32 | 44 | public FacesContext getDelegate() { |
| 33 | 45 | FacesContext facesContext = FacesContext.getCurrentInstance(); |
| 34 | 46 | |
| 35 | 47 | if (facesContext == null) { |
| 36 | - // TODO Colocar a mensagem correta | |
| 37 | - throw new ContextNotActiveException(); | |
| 48 | + throw new ContextNotActiveException(bundle.getString("faces-context-not-available")); | |
| 38 | 49 | } |
| 39 | 50 | |
| 40 | 51 | return facesContext; | ... | ... |
impl/extension/jsf/src/main/resources/demoiselle-jsf-bundle.properties
| ... | ... | @@ -36,4 +36,5 @@ |
| 36 | 36 | id-converter-not-found=Voc\u00EA precisa criar um FacesConverter para a classe "{0}". |
| 37 | 37 | login-page-not-found=A tela de login "{0}" n\u00E3o foi encontrada. Caso essa n\u00E3o seja a p\u00E1gina correta, defina a p\u00E1gina no arquivo de configura\u00E7\u00E3o usando a chave "frameworkdemoiselle.security.login.page" |
| 38 | 38 | after-login-page-not-found=A tela "{0}" acessada ap\u00F3s o login n\u00E3o foi encontrada. Caso essa n\u00E3o seja a p\u00E1gina correta, defina a p\u00E1gina no arquivo de configura\u00E7\u00E3o usando a chave "frameworkdemoiselle.security.redirect.after.login" |
| 39 | -after-logout-page-not-found=A tela "{0}" acessada ap\u00F3s o logout n\u00E3o foi encontrada. Caso essa n\u00E3o seja a p\u00E1gina correta, defina a p\u00E1gina no arquivo de configura\u00E7\u00E3o usando a chave "frameworkdemoiselle.security.redirect.after.logout" | |
| 40 | 39 | \ No newline at end of file |
| 40 | +after-logout-page-not-found=A tela "{0}" acessada ap\u00F3s o logout n\u00E3o foi encontrada. Caso essa n\u00E3o seja a p\u00E1gina correta, defina a p\u00E1gina no arquivo de configura\u00E7\u00E3o usando a chave "frameworkdemoiselle.security.redirect.after.logout" | |
| 41 | +faces-context-not-available=N\u00E3o existe uma inst\u00E2ncia de FacesContext ativa para esse escopo | |
| 41 | 42 | \ No newline at end of file | ... | ... |