Commit 3da86acafa306492bd9599cbe3cbfe8ee5b502d1
1 parent
8a5fd1f9
Exists in
master
Implementação da chamada do avaliador de css para dentro do próprio
servidor.
Showing
9 changed files
with
43 additions
and
41 deletions
Show diff stats
src/main/java/br/com/ases/business/impl/AvaliacaoBusinessImpl.java
@@ -47,7 +47,8 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness { | @@ -47,7 +47,8 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness { | ||
47 | 47 | ||
48 | // private static String CSS_VALIDATOR_URL = | 48 | // private static String CSS_VALIDATOR_URL = |
49 | // "http://www.css-validator.org/validator?uri=#{url}&warning=0&output=soap12"; | 49 | // "http://www.css-validator.org/validator?uri=#{url}&warning=0&output=soap12"; |
50 | - private static String CSS_VALIDATOR_URL = "http://jigsaw.w3.org/css-validator/validator?uri=#{url}&warning=0&output=soap12"; | 50 | + //private static String CSS_VALIDATOR_URL = "http://jigsaw.w3.org/css-validator/validator?uri=#{url}&warning=0&output=soap12"; |
51 | + private static String CSS_VALIDATOR_URL = null; | ||
51 | // private static String HTML_VALIDATOR_URL = | 52 | // private static String HTML_VALIDATOR_URL = |
52 | // "https://validator.w3.org/nu/?doc=#{url}&out=json"; | 53 | // "https://validator.w3.org/nu/?doc=#{url}&out=json"; |
53 | private static String HTML_VALIDATOR_URL = "https://validator.w3.org/check?uri=#{url}&output=json"; | 54 | private static String HTML_VALIDATOR_URL = "https://validator.w3.org/check?uri=#{url}&output=json"; |
@@ -354,6 +355,7 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness { | @@ -354,6 +355,7 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness { | ||
354 | lsRecomendacaoCriterios = new ArrayList<RecomendacaoCriterios>(); | 355 | lsRecomendacaoCriterios = new ArrayList<RecomendacaoCriterios>(); |
355 | 356 | ||
356 | } | 357 | } |
358 | + | ||
357 | //postParams.addParam("relatorioAvaliacao.recomendacoes[" + countReq+ "].totalErros", Integer.toString(totalErros)); | 359 | //postParams.addParam("relatorioAvaliacao.recomendacoes[" + countReq+ "].totalErros", Integer.toString(totalErros)); |
358 | //postParams.addParam("relatorioAvaliacao.recomendacoes[" + countReq+ "].totalAvisos", Integer.toString(totalAvisos)); | 360 | //postParams.addParam("relatorioAvaliacao.recomendacoes[" + countReq+ "].totalAvisos", Integer.toString(totalAvisos)); |
359 | postParams.addParam("relatorioAvaliacao.qtdeLinhas", Integer.toString(totalLinhas)); | 361 | postParams.addParam("relatorioAvaliacao.qtdeLinhas", Integer.toString(totalLinhas)); |
@@ -361,7 +363,6 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness { | @@ -361,7 +363,6 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness { | ||
361 | Gson g = new GsonBuilder().create(); | 363 | Gson g = new GsonBuilder().create(); |
362 | 364 | ||
363 | String jsonNota = postParams.execute().getContent(); | 365 | String jsonNota = postParams.execute().getContent(); |
364 | - | ||
365 | if(jsonNota.contains("nota\":")) | 366 | if(jsonNota.contains("nota\":")) |
366 | { | 367 | { |
367 | nota = g.fromJson(jsonNota, Nota.class); | 368 | nota = g.fromJson(jsonNota, Nota.class); |
@@ -532,6 +533,7 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness { | @@ -532,6 +533,7 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness { | ||
532 | try { | 533 | try { |
533 | UrlConvertida = new URL(url); | 534 | UrlConvertida = new URL(url); |
534 | 535 | ||
536 | + this.CSS_VALIDATOR_URL = this.eseloProperties.getUrl("linkAvaliacaoCSS"); | ||
535 | 537 | ||
536 | if (isCss) { | 538 | if (isCss) { |
537 | String content = WebChecker.from(CSS_VALIDATOR_URL.replace("#{url}", URLEncoder.encode(UrlConvertida.toExternalForm(), "UTF-8"))).withGetRequest().execute().getContent(); | 539 | String content = WebChecker.from(CSS_VALIDATOR_URL.replace("#{url}", URLEncoder.encode(UrlConvertida.toExternalForm(), "UTF-8"))).withGetRequest().execute().getContent(); |
src/main/java/br/com/ases/controller/AvaliacaoController.java
@@ -217,8 +217,7 @@ public class AvaliacaoController { | @@ -217,8 +217,7 @@ public class AvaliacaoController { | ||
217 | .setAttribute("webaxscore", webaxscore); | 217 | .setAttribute("webaxscore", webaxscore); |
218 | 218 | ||
219 | novaChave = "webaxscore" + chaveIdentificaAvaliacao; | 219 | novaChave = "webaxscore" + chaveIdentificaAvaliacao; |
220 | - VRaptorRequestHolder.currentRequest().getServletContext() | ||
221 | - .setAttribute(novaChave, webaxscore); | 220 | + VRaptorRequestHolder.currentRequest().getServletContext().setAttribute(novaChave, webaxscore); |
222 | } | 221 | } |
223 | 222 | ||
224 | } | 223 | } |
@@ -293,8 +292,7 @@ public class AvaliacaoController { | @@ -293,8 +292,7 @@ public class AvaliacaoController { | ||
293 | .setAttribute("ancoraCampoVazio", ancoraCampoVazio); | 292 | .setAttribute("ancoraCampoVazio", ancoraCampoVazio); |
294 | 293 | ||
295 | novaChave = "ancoraCampoVazio" + chaveIdentificaAvaliacao; | 294 | novaChave = "ancoraCampoVazio" + chaveIdentificaAvaliacao; |
296 | - VRaptorRequestHolder.currentRequest().getServletContext() | ||
297 | - .setAttribute(novaChave, ancoraCampoVazio); | 295 | + VRaptorRequestHolder.currentRequest().getServletContext().setAttribute(novaChave, ancoraCampoVazio); |
298 | 296 | ||
299 | this.validator = validate.getMessage(); | 297 | this.validator = validate.getMessage(); |
300 | this.validator.onErrorUsePageOf(IndexController.class).index(); | 298 | this.validator.onErrorUsePageOf(IndexController.class).index(); |
@@ -869,7 +867,7 @@ public class AvaliacaoController { | @@ -869,7 +867,7 @@ public class AvaliacaoController { | ||
869 | } catch (UnsupportedEncodingException e) { | 867 | } catch (UnsupportedEncodingException e) { |
870 | e.printStackTrace(); | 868 | e.printStackTrace(); |
871 | } | 869 | } |
872 | - | 870 | + result.include("linkAvaliacaoCSSExterno",this.eseloProperties.getUrl("linkAvaliacaoCSSExterno")); |
873 | } | 871 | } |
874 | 872 | ||
875 | private String encodeURI(String url) throws UnsupportedEncodingException { | 873 | private String encodeURI(String url) throws UnsupportedEncodingException { |
@@ -1048,7 +1046,6 @@ public class AvaliacaoController { | @@ -1048,7 +1046,6 @@ public class AvaliacaoController { | ||
1048 | AvaliacaoAutomatica avaliacaoAutomatica = new AvaliacaoAutomatica(); | 1046 | AvaliacaoAutomatica avaliacaoAutomatica = new AvaliacaoAutomatica(); |
1049 | ErroWs erroWs = new ErroWs(); | 1047 | ErroWs erroWs = new ErroWs(); |
1050 | this.dataHoraAvaliacao = (String) DateUtil.dataHoraAtual(); | 1048 | this.dataHoraAvaliacao = (String) DateUtil.dataHoraAtual(); |
1051 | - | ||
1052 | WebChecker.PostParams postParams = | 1049 | WebChecker.PostParams postParams = |
1053 | WebChecker.from(this.eseloProperties.getUrl("urlAutenticacaoServico")).withPostRequest(); | 1050 | WebChecker.from(this.eseloProperties.getUrl("urlAutenticacaoServico")).withPostRequest(); |
1054 | postParams.addParam("codigoHash", codigoHash); | 1051 | postParams.addParam("codigoHash", codigoHash); |
src/main/java/br/com/ases/controller/ContatoController.java
@@ -58,7 +58,7 @@ public class ContatoController { | @@ -58,7 +58,7 @@ public class ContatoController { | ||
58 | 58 | ||
59 | EnvioEmailSemAutenticacao envioEmailSemAutenticacao = new EnvioEmailSemAutenticacao(email.getHost(), Integer.toString(email.getPort())); | 59 | EnvioEmailSemAutenticacao envioEmailSemAutenticacao = new EnvioEmailSemAutenticacao(email.getHost(), Integer.toString(email.getPort())); |
60 | 60 | ||
61 | - respSendEmail = envioEmailSemAutenticacao.sendMail(contato.getEmail(),email.getTo(), "Fad - " + StringHelper.convertFromUTF8(contato.getAssunto()), StringHelper.convertFromUTF8(contato.getMensagem()),email.getAuth(), email.getAuthUser(), email.getAuthPass()); | 61 | + respSendEmail = envioEmailSemAutenticacao.sendMail(contato.getEmail(),email.getTo(), "ASES - " + StringHelper.convertFromUTF8(contato.getAssunto()), StringHelper.convertFromUTF8(contato.getMensagem()),email.getAuth(), email.getAuthUser(), email.getAuthPass()); |
62 | 62 | ||
63 | 63 | ||
64 | /*String respSendEmail = email.sendEmail("Contato","govbr@planejamento.gov.br", contato.getNome(),contato.getEmail(),StringHelper.convertFromUTF8(contato.getAssunto()), | 64 | /*String respSendEmail = email.sendEmail("Contato","govbr@planejamento.gov.br", contato.getNome(),contato.getEmail(),StringHelper.convertFromUTF8(contato.getAssunto()), |
@@ -70,7 +70,7 @@ public class ContatoController { | @@ -70,7 +70,7 @@ public class ContatoController { | ||
70 | 70 | ||
71 | } else { | 71 | } else { |
72 | result.include("mensagem", | 72 | result.include("mensagem", |
73 | - "N�o foi poss�vel enviar a mensagem! Ocorreu o problema: " + respSendEmail); | 73 | + "Não foi possível enviar a mensagem! Ocorreu o problema: " + respSendEmail); |
74 | result.include("status", "error"); | 74 | result.include("status", "error"); |
75 | } | 75 | } |
76 | 76 |
src/main/java/br/com/ases/controller/IndexController.java
1 | package br.com.ases.controller; | 1 | package br.com.ases.controller; |
2 | 2 | ||
3 | -import java.sql.Connection; | ||
4 | -import java.sql.DriverManager; | ||
5 | - | ||
6 | -import org.apache.regexp.REUtil; | ||
7 | - | ||
8 | -import com.jcabi.http.Response; | ||
9 | - | ||
10 | import br.com.caelum.vraptor.Path; | 3 | import br.com.caelum.vraptor.Path; |
11 | import br.com.caelum.vraptor.Resource; | 4 | import br.com.caelum.vraptor.Resource; |
12 | import br.com.caelum.vraptor.Result; | 5 | import br.com.caelum.vraptor.Result; |
src/main/java/br/com/ases/model/entity/EnvioEmailSemAutenticacao.java
@@ -34,7 +34,7 @@ public class EnvioEmailSemAutenticacao { | @@ -34,7 +34,7 @@ public class EnvioEmailSemAutenticacao { | ||
34 | String retorno = ""; | 34 | String retorno = ""; |
35 | 35 | ||
36 | props.put("mail.transport.protocol", "smtp"); //define protocolo de envio como SMTP | 36 | props.put("mail.transport.protocol", "smtp"); //define protocolo de envio como SMTP |
37 | - props.put("mail.smtp.starttls.enable","true"); | 37 | + props.put("mail.smtp.starttls.enable","false"); |
38 | props.put("mail.smtp.host", mailSMTPServer); //server SMTP do GMAIL | 38 | props.put("mail.smtp.host", mailSMTPServer); //server SMTP do GMAIL |
39 | props.put("mail.smtp.auth", comAutenticacao); //ativa autenticacao | 39 | props.put("mail.smtp.auth", comAutenticacao); //ativa autenticacao |
40 | props.put("mail.smtp.user", from); //usuario ou seja, a conta que esta enviando o email (tem que ser do GMAIL) | 40 | props.put("mail.smtp.user", from); //usuario ou seja, a conta que esta enviando o email (tem que ser do GMAIL) |
@@ -44,28 +44,29 @@ public class EnvioEmailSemAutenticacao { | @@ -44,28 +44,29 @@ public class EnvioEmailSemAutenticacao { | ||
44 | //Cria um autenticador que sera usado a seguir | 44 | //Cria um autenticador que sera usado a seguir |
45 | SimpleAuth auth = null; | 45 | SimpleAuth auth = null; |
46 | auth = new SimpleAuth (authuser,authpass); | 46 | auth = new SimpleAuth (authuser,authpass); |
47 | - //Session - objeto que ira realizar a conexão com o servidor | ||
48 | - /*Como há necessidade de autenticação é criada uma autenticacao que | ||
49 | - * é responsavel por solicitar e retornar o usuário e senha para | ||
50 | - * autenticação */ | 47 | + //Session - objeto que ira realizar a conex�o com o servidor |
48 | + /*Como h� necessidade de autentica��o � criada uma autenticacao que | ||
49 | + * � responsavel por solicitar e retornar o usu�rio e senha para | ||
50 | + * autentica��o */ | ||
51 | Session session = Session.getDefaultInstance(props, auth); | 51 | Session session = Session.getDefaultInstance(props, auth); |
52 | - session.setDebug(true); //Habilita o LOG das ações executadas durante o envio do email | ||
53 | - //Objeto que contém a mensagem | 52 | + session.setDebug(true); //Habilita o LOG das a��es executadas durante o envio do email |
53 | + //Objeto que cont�m a mensagem | ||
54 | Message msg = new MimeMessage(session); | 54 | Message msg = new MimeMessage(session); |
55 | try { | 55 | try { |
56 | - //Setando o destinatário | 56 | + //Setando o destinat�rio |
57 | msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to)); | 57 | msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to)); |
58 | //Setando a origem do email | 58 | //Setando a origem do email |
59 | msg.setFrom(new InternetAddress(from)); | 59 | msg.setFrom(new InternetAddress(from)); |
60 | //Setando o assunto | 60 | //Setando o assunto |
61 | msg.setSubject(subject); | 61 | msg.setSubject(subject); |
62 | - //Setando o conteúdo/corpo do email | ||
63 | - msg.setContent(message,"text/html; charset=utf-8"); | 62 | + //Setando o conte�do/corpo do email |
63 | + msg.setContent(message,"text/html; charset=UTF-8"); | ||
64 | 64 | ||
65 | 65 | ||
66 | } catch (Exception e) { | 66 | } catch (Exception e) { |
67 | retorno = e.getMessage(); | 67 | retorno = e.getMessage(); |
68 | - System.out.println(">> Erro: Completar Mensagem"); | 68 | + System.out.println(">> Erro: Completar Mensagem"); |
69 | + System.out.println(retorno); | ||
69 | e.printStackTrace(); | 70 | e.printStackTrace(); |
70 | return retorno; | 71 | return retorno; |
71 | } | 72 | } |
@@ -89,6 +90,8 @@ public class EnvioEmailSemAutenticacao { | @@ -89,6 +90,8 @@ public class EnvioEmailSemAutenticacao { | ||
89 | // TODO Auto-generated catch block | 90 | // TODO Auto-generated catch block |
90 | System.out.println(">> Erro: Envio Mensagem"); | 91 | System.out.println(">> Erro: Envio Mensagem"); |
91 | retorno = e.getMessage(); | 92 | retorno = e.getMessage(); |
93 | + System.out.println(retorno); | ||
94 | + e.printStackTrace(); | ||
92 | } | 95 | } |
93 | return retorno; | 96 | return retorno; |
94 | } | 97 | } |
src/main/java/br/com/ases/model/utilities/Email.java
@@ -82,9 +82,9 @@ public class Email { | @@ -82,9 +82,9 @@ public class Email { | ||
82 | this.email.setSubject(assunto); // assunto do e-mail | 82 | this.email.setSubject(assunto); // assunto do e-mail |
83 | 83 | ||
84 | if(isHtml) | 84 | if(isHtml) |
85 | - this.email.setContent("<p>Ol�, <b>"+nomeRemetente+"</b> enviou a seguinte mensagem:</p> \n "+mensagem, "text/html"); | 85 | + this.email.setContent("<p>Olá, <b>"+nomeRemetente+"</b> enviou a seguinte mensagem:</p> \n "+mensagem, "text/html"); |
86 | else | 86 | else |
87 | - this.email.setMsg("<p>Ol�, <b>"+nomeRemetente+"</b> enviou a seguinte mensagem:</p> \n "+mensagem); //conteudo do e-mail | 87 | + this.email.setMsg("<p>Olá, <b>"+nomeRemetente+"</b> enviou a seguinte mensagem:</p> \n "+mensagem); //conteudo do e-mail |
88 | 88 | ||
89 | this.email.setSentDate(new Date()); | 89 | this.email.setSentDate(new Date()); |
90 | 90 | ||
@@ -93,9 +93,11 @@ public class Email { | @@ -93,9 +93,11 @@ public class Email { | ||
93 | 93 | ||
94 | 94 | ||
95 | this.email.setSmtpPort(this.port); | 95 | this.email.setSmtpPort(this.port); |
96 | - this.email.setSSL(true); | ||
97 | - this.email.setTLS(true); | ||
98 | - | 96 | + //this.email.setSSL(true); |
97 | + //this.email.setTLS(true); | ||
98 | + this.email.setSSLOnConnect(true); | ||
99 | + this.email.isStartTLSEnabled(); | ||
100 | + this.email.setStartTLSEnabled(true); | ||
99 | try { | 101 | try { |
100 | this.email.send(); | 102 | this.email.send(); |
101 | return ""; | 103 | return ""; |
src/main/java/br/com/ases/model/utilities/ManagerReport.java
@@ -33,7 +33,6 @@ public class ManagerReport { | @@ -33,7 +33,6 @@ public class ManagerReport { | ||
33 | private String fileName = null; | 33 | private String fileName = null; |
34 | 34 | ||
35 | public ManagerReport(String path){ | 35 | public ManagerReport(String path){ |
36 | - System.out.println("path:" + path); | ||
37 | this.pathTemplate = path; | 36 | this.pathTemplate = path; |
38 | } | 37 | } |
39 | 38 |
src/main/webapp/WEB-INF/eselo.properties
1 | #url=https://sistemas-treinamento.ifbaiano.edu.br/intg_ases_selo/calcular-nota | 1 | #url=https://sistemas-treinamento.ifbaiano.edu.br/intg_ases_selo/calcular-nota |
2 | -#url=http://localhost:18080/eselo/calcular-nota | ||
3 | -#url=http://189.9.137.162:8080/eselo/calcular-nota | ||
4 | -url=http://eselo-prd.brazilsouth.cloudapp.azure.com/calcular-nota | 2 | +u#rl=http://localhost:18080/eselo/calcular-nota |
3 | +url=http://189.9.137.162:8080/eselo/calcular-nota | ||
4 | +#url=http://eselo-prd.brazilsouth.cloudapp.azure.com:8080/calcular-nota | ||
5 | 5 | ||
6 | 6 | ||
7 | 7 | ||
8 | #urlAutenticacaoServico=http://189.9.137.162:8080/eselo/existe_usuario_servico_web | 8 | #urlAutenticacaoServico=http://189.9.137.162:8080/eselo/existe_usuario_servico_web |
9 | -urlAutenticacaoServico=http://eselo-prd.brazilsouth.cloudapp.azure.com/existe_usuario_servico_web | 9 | +urlAutenticacaoServico=http://localhost:18080/eselo/existe_usuario_servico_web |
10 | 10 | ||
11 | #Esconde a nota caso não esteja usando o ESELO | 11 | #Esconde a nota caso não esteja usando o ESELO |
12 | #Se atribuir o valor "sem_nota" na chave 'sem_nota', não exibirá a nota | 12 | #Se atribuir o valor "sem_nota" na chave 'sem_nota', não exibirá a nota |
13 | sem_nota= | 13 | sem_nota= |
14 | 14 | ||
15 | #Altera a mensagem caso não esteja usando o ESELO (Nota e Resumo da Avaliação de Acessibilidade) | 15 | #Altera a mensagem caso não esteja usando o ESELO (Nota e Resumo da Avaliação de Acessibilidade) |
16 | -mensagem_avaliacao =Nota e Resumo da Avaliação de Acessibilidade | ||
17 | \ No newline at end of file | 16 | \ No newline at end of file |
17 | +mensagem_avaliacao =Nota e Resumo da Avaliação de Acessibilidade | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | +linkAvaliacaoCSS=http://189.9.137.162:8080/css-validator/validator?uri=#{url}&warning=0&output=soap12 | ||
22 | +linkAvaliacaoCSSExterno=http://189.9.137.162:8080/css-validator/validator?uri= | ||
18 | \ No newline at end of file | 23 | \ No newline at end of file |
src/main/webapp/WEB-INF/jsp/avaliacao/detalhesAvaliacao.jsp
@@ -116,9 +116,10 @@ | @@ -116,9 +116,10 @@ | ||
116 | varStatus="index"> | 116 | varStatus="index"> |
117 | <c:if test="${fn:contains(aReqIsW3c, req)}"> | 117 | <c:if test="${fn:contains(aReqIsW3c, req)}"> |
118 | <c:if test="${fn:contains(aReqIsCss, req) && linkCssJaAdicionado == false}"> | 118 | <c:if test="${fn:contains(aReqIsCss, req) && linkCssJaAdicionado == false}"> |
119 | - <a | ||
120 | - href=" http://jigsaw.w3.org/css-validator/validator?uri=${urlFormatada}"> Serviço de validação de CSS do W3C (link para um novo sitio) | 119 | + <a href=" ${linkAvaliacaoCSSExterno}${urlFormatada}"> Serviço de validação de CSS do W3C (link para um novo sitio) |
120 | + | ||
121 | </a> | 121 | </a> |
122 | + <!--<a href=" http://jigsaw.w3.org/css-validator/validator?uri=${urlFormatada}"> Serviço de validação de CSS do W3C (link para um novo sitio)</a> --> | ||
122 | <c:set var="linkCssJaAdicionado" value="true" /> | 123 | <c:set var="linkCssJaAdicionado" value="true" /> |
123 | </c:if> | 124 | </c:if> |
124 | 125 |