Commit f1f22cd12da366d2735b7b545d8bc28eac848251
1 parent
2f3a8856
Exists in
master
Melhoria no tratamente de exceções
Showing
3 changed files
with
86 additions
and
0 deletions
Show diff stats
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/InternalServerErrorException.java
0 → 100644
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +package br.gov.frameworkdemoiselle; | ||
| 2 | + | ||
| 3 | +import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; | ||
| 4 | + | ||
| 5 | +public class InternalServerErrorException extends HttpViolationException { | ||
| 6 | + | ||
| 7 | + private static final long serialVersionUID = 1L; | ||
| 8 | + | ||
| 9 | + public InternalServerErrorException() { | ||
| 10 | + super(SC_INTERNAL_SERVER_ERROR); | ||
| 11 | + } | ||
| 12 | +} |
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/ServiceUnavailableException.java
0 → 100644
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +package br.gov.frameworkdemoiselle; | ||
| 2 | + | ||
| 3 | +import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE; | ||
| 4 | + | ||
| 5 | +public class ServiceUnavailableException extends HttpViolationException { | ||
| 6 | + | ||
| 7 | + private static final long serialVersionUID = 1L; | ||
| 8 | + | ||
| 9 | + public ServiceUnavailableException() { | ||
| 10 | + super(SC_SERVICE_UNAVAILABLE); | ||
| 11 | + } | ||
| 12 | +} |
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/security/RESTSecurityConfig.java
0 → 100644
| @@ -0,0 +1,62 @@ | @@ -0,0 +1,62 @@ | ||
| 1 | +/* | ||
| 2 | + * Demoiselle Framework | ||
| 3 | + * Copyright (C) 2010 SERPRO | ||
| 4 | + * ---------------------------------------------------------------------------- | ||
| 5 | + * This file is part of Demoiselle Framework. | ||
| 6 | + * | ||
| 7 | + * Demoiselle Framework is free software; you can redistribute it and/or | ||
| 8 | + * modify it under the terms of the GNU Lesser General Public License version 3 | ||
| 9 | + * as published by the Free Software Foundation. | ||
| 10 | + * | ||
| 11 | + * This program is distributed in the hope that it will be useful, | ||
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | + * GNU General Public License for more details. | ||
| 15 | + * | ||
| 16 | + * You should have received a copy of the GNU Lesser General Public License version 3 | ||
| 17 | + * along with this program; if not, see <http://www.gnu.org/licenses/> | ||
| 18 | + * or write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| 19 | + * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| 20 | + * ---------------------------------------------------------------------------- | ||
| 21 | + * Este arquivo é parte do Framework Demoiselle. | ||
| 22 | + * | ||
| 23 | + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | ||
| 24 | + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | ||
| 25 | + * do Software Livre (FSF). | ||
| 26 | + * | ||
| 27 | + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | ||
| 28 | + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | ||
| 29 | + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | ||
| 30 | + * para maiores detalhes. | ||
| 31 | + * | ||
| 32 | + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | ||
| 33 | + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | ||
| 34 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., | ||
| 35 | + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | ||
| 36 | + */ | ||
| 37 | +package br.gov.frameworkdemoiselle.security; | ||
| 38 | + | ||
| 39 | +import java.io.Serializable; | ||
| 40 | + | ||
| 41 | +import br.gov.frameworkdemoiselle.annotation.Name; | ||
| 42 | +import br.gov.frameworkdemoiselle.configuration.Configuration; | ||
| 43 | + | ||
| 44 | +@Configuration(prefix = "frameworkdemoiselle.security") | ||
| 45 | +public class RESTSecurityConfig implements Serializable { | ||
| 46 | + | ||
| 47 | + private static final long serialVersionUID = 1L; | ||
| 48 | + | ||
| 49 | + @Name("basic.filter.active") | ||
| 50 | + private boolean basicFilterActive = true; | ||
| 51 | + | ||
| 52 | + @Name("token.filter.active") | ||
| 53 | + private boolean tokenFilterActive = true; | ||
| 54 | + | ||
| 55 | + public boolean isBasicFilterActive() { | ||
| 56 | + return basicFilterActive; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public boolean isTokenFilterActive() { | ||
| 60 | + return tokenFilterActive; | ||
| 61 | + } | ||
| 62 | +} |