Commit 6b429231111defbf9baecc7fb49776af43cad6d9
1 parent
8066f865
Exists in
master
Removidos TODO's e externalizadas strings para arquivo bundle.
Showing
2 changed files
with
13 additions
and
19 deletions
Show diff stats
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/SecurityObserver.java
@@ -48,6 +48,7 @@ import javax.servlet.http.HttpSession; | @@ -48,6 +48,7 @@ import javax.servlet.http.HttpSession; | ||
48 | 48 | ||
49 | import org.slf4j.Logger; | 49 | import org.slf4j.Logger; |
50 | 50 | ||
51 | +import br.gov.frameworkdemoiselle.annotation.Name; | ||
51 | import br.gov.frameworkdemoiselle.configuration.ConfigurationException; | 52 | import br.gov.frameworkdemoiselle.configuration.ConfigurationException; |
52 | import br.gov.frameworkdemoiselle.internal.configuration.JsfSecurityConfig; | 53 | import br.gov.frameworkdemoiselle.internal.configuration.JsfSecurityConfig; |
53 | import br.gov.frameworkdemoiselle.security.AfterLoginSuccessful; | 54 | import br.gov.frameworkdemoiselle.security.AfterLoginSuccessful; |
@@ -55,6 +56,7 @@ import br.gov.frameworkdemoiselle.security.AfterLogoutSuccessful; | @@ -55,6 +56,7 @@ import br.gov.frameworkdemoiselle.security.AfterLogoutSuccessful; | ||
55 | import br.gov.frameworkdemoiselle.util.Beans; | 56 | import br.gov.frameworkdemoiselle.util.Beans; |
56 | import br.gov.frameworkdemoiselle.util.PageNotFoundException; | 57 | import br.gov.frameworkdemoiselle.util.PageNotFoundException; |
57 | import br.gov.frameworkdemoiselle.util.Redirector; | 58 | import br.gov.frameworkdemoiselle.util.Redirector; |
59 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | ||
58 | 60 | ||
59 | @SessionScoped | 61 | @SessionScoped |
60 | public class SecurityObserver implements Serializable { | 62 | public class SecurityObserver implements Serializable { |
@@ -69,6 +71,10 @@ public class SecurityObserver implements Serializable { | @@ -69,6 +71,10 @@ public class SecurityObserver implements Serializable { | ||
69 | 71 | ||
70 | @Inject | 72 | @Inject |
71 | private Logger logger; | 73 | private Logger logger; |
74 | + | ||
75 | + @Inject | ||
76 | + @Name("demoiselle-jsf-bundle") | ||
77 | + private ResourceBundle bundle; | ||
72 | 78 | ||
73 | public SecurityObserver() { | 79 | public SecurityObserver() { |
74 | clear(); | 80 | clear(); |
@@ -107,12 +113,7 @@ public class SecurityObserver implements Serializable { | @@ -107,12 +113,7 @@ public class SecurityObserver implements Serializable { | ||
107 | Redirector.redirect(getConfig().getLoginPage()); | 113 | Redirector.redirect(getConfig().getLoginPage()); |
108 | 114 | ||
109 | } catch (PageNotFoundException cause) { | 115 | } catch (PageNotFoundException cause) { |
110 | - // TODO Colocar a mensagem no bundle | ||
111 | - throw new ConfigurationException( | ||
112 | - "A tela de login \"" | ||
113 | - + cause.getViewId() | ||
114 | - + "\" não foi encontrada. Caso o seu projeto possua outra, defina no arquivo de configuração a chave \"" | ||
115 | - + "frameworkdemoiselle.security.login.page" + "\"", cause); | 116 | + throw new ConfigurationException( bundle.getString("login-page-not-found",cause.getViewId()) , cause); |
116 | } | 117 | } |
117 | } | 118 | } |
118 | 119 | ||
@@ -130,12 +131,7 @@ public class SecurityObserver implements Serializable { | @@ -130,12 +131,7 @@ public class SecurityObserver implements Serializable { | ||
130 | 131 | ||
131 | } catch (PageNotFoundException cause) { | 132 | } catch (PageNotFoundException cause) { |
132 | if (redirectedFromConfig) { | 133 | if (redirectedFromConfig) { |
133 | - // TODO Colocar a mensagem no bundle | ||
134 | - throw new ConfigurationException( | ||
135 | - "A tela \"" | ||
136 | - + cause.getViewId() | ||
137 | - + "\" que é invocada após o logon não foi encontrada. Caso o seu projeto possua outra, defina no arquivo de configuração a chave \"" | ||
138 | - + "frameworkdemoiselle.security.redirect.after.login" + "\"", cause); | 134 | + throw new ConfigurationException( bundle.getString("after-login-page-not-found",cause.getViewId()) , cause); |
139 | } else { | 135 | } else { |
140 | throw cause; | 136 | throw cause; |
141 | } | 137 | } |
@@ -152,12 +148,7 @@ public class SecurityObserver implements Serializable { | @@ -152,12 +148,7 @@ public class SecurityObserver implements Serializable { | ||
152 | } | 148 | } |
153 | 149 | ||
154 | } catch (PageNotFoundException cause) { | 150 | } catch (PageNotFoundException cause) { |
155 | - // TODO Colocar a mensagem no bundle | ||
156 | - throw new ConfigurationException( | ||
157 | - "A tela \"" | ||
158 | - + cause.getViewId() | ||
159 | - + "\" que é invocada após o logout não foi encontrada. Caso o seu projeto possua outra, defina no arquivo de configuração a chave \"" | ||
160 | - + "frameworkdemoiselle.security.redirect.after.logout" + "\"", cause); | 151 | + throw new ConfigurationException( bundle.getString("after-logout-page-not-found",cause.getViewId()) , cause); |
161 | 152 | ||
162 | } finally { | 153 | } finally { |
163 | try { | 154 | try { |
impl/extension/jsf/src/main/resources/demoiselle-jsf-bundle.properties
@@ -33,4 +33,7 @@ | @@ -33,4 +33,7 @@ | ||
33 | # ou escreva para a Fundação do Software Livre (FSF) Inc., | 33 | # ou escreva para a Fundação do Software Livre (FSF) Inc., |
34 | # 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | 34 | # 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. |
35 | 35 | ||
36 | -id-converter-not-found=Voc\u00EA precisa criar um FacesConverter para a classe "{0}". | ||
37 | \ No newline at end of file | 36 | \ No newline at end of file |
37 | +id-converter-not-found=Voc\u00EA precisa criar um FacesConverter para a classe "{0}". | ||
38 | +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" | ||
39 | +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" | ||
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" | ||
38 | \ No newline at end of file | 41 | \ No newline at end of file |