Commit 0737c7d3a79e2c27459deb19974117d8f73e2e6e
1 parent
5221f7c6
Exists in
master
Atualização do arquétipo html-rest com cache e gzip
Showing
25 changed files
with
420 additions
and
119 deletions
Show diff stats
archetype/html-rest/src/main/resources/archetype-resources/src/main/resources/messages.properties
... | ... | @@ -0,0 +1 @@ |
1 | +application.version=${project.version} | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | <class>br.gov.frameworkdemoiselle.util.ValidatePayloadInterceptor</class> |
9 | 9 | <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class> |
10 | 10 | <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class> |
11 | + <class>br.gov.frameworkdemoiselle.util.CacheInterceptor</class> | |
11 | 12 | </interceptors> |
12 | 13 | |
13 | 14 | </beans> | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
... | ... | @@ -25,4 +25,34 @@ |
25 | 25 | </filter-mapping> |
26 | 26 | --> |
27 | 27 | |
28 | + <filter> | |
29 | + <filter-name>Cache Filter</filter-name> | |
30 | + <filter-class>br.gov.frameworkdemoiselle.util.CacheFilter</filter-class> | |
31 | + <init-param> | |
32 | + <param-name>value</param-name> | |
33 | + <param-value>max-age=9223372036854775807,public</param-value> | |
34 | + </init-param> | |
35 | + </filter> | |
36 | + <filter-mapping> | |
37 | + <filter-name>Cache Filter</filter-name> | |
38 | + <url-pattern>*.js</url-pattern> | |
39 | + <url-pattern>*.html</url-pattern> | |
40 | + <url-pattern>*.html?*</url-pattern> | |
41 | + <url-pattern>*.css</url-pattern> | |
42 | + <url-pattern>*.png</url-pattern> | |
43 | + <url-pattern>*.svg</url-pattern> | |
44 | + <url-pattern>*.ttf</url-pattern> | |
45 | + <url-pattern>*.woff</url-pattern> | |
46 | + <url-pattern>/api/metadata/*</url-pattern> | |
47 | + </filter-mapping> | |
48 | + | |
49 | + <filter> | |
50 | + <filter-name>GZip Filter</filter-name> | |
51 | + <filter-class>org.tuckey.web.filters.urlrewrite.gzip.GzipFilter</filter-class> | |
52 | + </filter> | |
53 | + <filter-mapping> | |
54 | + <filter-name>GZip Filter</filter-name> | |
55 | + <url-pattern>/*</url-pattern> | |
56 | + </filter-mapping> | |
57 | + | |
28 | 58 | </web-app> | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/bookmark-edit.html
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html lang="pt-br"> |
3 | + | |
3 | 4 | <head> |
4 | - <meta charset="utf-8"> | |
5 | - <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
6 | - <meta name="viewport" content="width=device-width, initial-scale=1"> | |
7 | - <title>Bookmark Edit</title> | |
8 | - <link rel="stylesheet" href="css/bootstrap.min.css"> | |
9 | - <link rel="stylesheet" href="css/bookmark.css"> | |
5 | +<meta charset="utf-8"> | |
6 | +<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
7 | +<meta name="viewport" content="width=device-width, initial-scale=1"> | |
8 | +<title>Bookmark Edit</title> | |
9 | +<link rel="stylesheet" href="css/bootstrap.min.css"> | |
10 | +<link rel="stylesheet" href="css/bookmark.css"> | |
10 | 11 | </head> |
12 | + | |
11 | 13 | <body> |
12 | 14 | <div class="container"> |
13 | 15 | <div id="menu"></div> |
... | ... | @@ -33,14 +35,17 @@ |
33 | 35 | </div> |
34 | 36 | </form> |
35 | 37 | </div> |
36 | - <p class="demoiselle">Aplicação de exemplo do Demoiselle 2.5.0</p> | |
37 | - <script src="js/lib/jquery-2.1.0.min.js" type="text/javascript"></script> | |
38 | - <script src="js/lib/bootstrap.min.js" type="text/javascript"></script> | |
39 | - <script src="js/lib/purl.js" type="text/javascript"></script> | |
40 | - <script src="js/lib/bootbox.js" type="text/javascript"></script> | |
41 | - <script type="text/javascript" src="js/lib/app.js"></script> | |
42 | - <script src="js/proxy/auth.js" type="text/javascript"></script> | |
43 | - <script src="js/proxy/bookmark.js" type="text/javascript"></script> | |
44 | - <script src="js/controller/menu.js" type="text/javascript"></script> | |
45 | - <script src="js/controller/bookmark-edit.js" type="text/javascript"></script> | |
46 | -</body> | |
47 | 38 | \ No newline at end of file |
39 | + <p class="demoiselle"> | |
40 | + Aplicação de exemplo do Demoiselle <span id="demoiselle-version"></span> | |
41 | + | |
42 | + <script type="text/javascript" src="js/lib/jquery-2.1.0.min.js"></script> | |
43 | + <script type="text/javascript" src="js/lib/bootstrap.min.js"></script> | |
44 | + <script type="text/javascript" src="js/lib/purl.js"></script> | |
45 | + <script type="text/javascript" src="js/lib/bootbox.js"></script> | |
46 | + <script type="text/javascript" src="js/lib/app.js"></script> | |
47 | + <script type="text/javascript" src="js/proxy/metadata.js"></script> | |
48 | + <script type="text/javascript" src="js/proxy/auth.js"></script> | |
49 | + <script type="text/javascript" src="js/proxy/bookmark.js"></script> | |
50 | + <script type="text/javascript" src="js/controller/menu.js"></script> | |
51 | + <script type="text/javascript" src="js/controller/bookmark-edit.js"></script> | |
52 | +</body> | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/bookmark-list.html
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html lang="pt-br"> |
3 | + | |
3 | 4 | <head> |
4 | - <meta charset="utf-8"> | |
5 | - <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
6 | - <meta name="viewport" content="width=device-width, initial-scale=1"> | |
7 | - <title>Bookmark List</title> | |
8 | - <link rel="stylesheet" href="css/bootstrap.min.css"> | |
9 | - <link rel="stylesheet" href="css/bookmark.css"> | |
10 | - <link rel="stylesheet" href="css/datatables.css"> | |
5 | +<meta charset="utf-8"> | |
6 | +<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
7 | +<meta name="viewport" content="width=device-width, initial-scale=1"> | |
8 | +<title>Bookmark List</title> | |
9 | +<link rel="stylesheet" href="css/bootstrap.min.css"> | |
10 | +<link rel="stylesheet" href="css/bookmark.css"> | |
11 | +<link rel="stylesheet" href="css/datatables.css"> | |
11 | 12 | </head> |
13 | + | |
12 | 14 | <body> |
13 | 15 | <div class="container"> |
14 | 16 | <div id="menu"></div> |
... | ... | @@ -16,7 +18,7 @@ |
16 | 18 | <button id="new" class="btn btn-success">Novo</button> |
17 | 19 | <button id="delete" class="btn btn-danger">Excluir</button> |
18 | 20 | </p> |
19 | - <table id="resultList" cellpadding="0" cellspacing="0" border="0" class="datatable table table-striped table-bordered"> | |
21 | + <table id="resultList" class="datatable table table-striped table-bordered"> | |
20 | 22 | <thead> |
21 | 23 | <tr> |
22 | 24 | <th width="3px"></th> |
... | ... | @@ -26,16 +28,20 @@ |
26 | 28 | </thead> |
27 | 29 | </table> |
28 | 30 | </div> |
29 | - <p class="demoiselle">Aplicação de exemplo do Demoiselle 2.5.0</p> | |
31 | + <p class="demoiselle"> | |
32 | + Aplicação de exemplo do Demoiselle <span id="demoiselle-version"></span> | |
33 | + </p> | |
34 | + | |
30 | 35 | <script type="text/javascript" src="js/lib/jquery-2.1.0.min.js"></script> |
31 | 36 | <script type="text/javascript" src="js/lib/bootstrap.min.js"></script> |
32 | 37 | <script type="text/javascript" src="js/lib/jquery.dataTables.js"></script> |
33 | 38 | <script type="text/javascript" src="js/lib/datatables.js"></script> |
34 | 39 | <script type="text/javascript" src="js/lib/bootbox.js"></script> |
35 | 40 | <script type="text/javascript" src="js/lib/app.js"></script> |
41 | + <script type="text/javascript" src="js/proxy/metadata.js"></script> | |
36 | 42 | <script type="text/javascript" src="js/proxy/auth.js"></script> |
37 | 43 | <script type="text/javascript" src="js/proxy/bookmark.js"></script> |
38 | 44 | <script type="text/javascript" src="js/controller/menu.js"></script> |
39 | 45 | <script type="text/javascript" src="js/controller/bookmark-list.js"></script> |
40 | 46 | </body> |
41 | -</html> | |
42 | 47 | \ No newline at end of file |
48 | +</html> | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/fonts/glyphicons-halflings-regular.woff
No preview for this file type
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/home.html
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html> |
3 | + | |
3 | 4 | <head> |
4 | - <meta charset="UTF-8"> | |
5 | - <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
6 | - <meta name="viewport" content="width=device-width, initial-scale=1"> | |
7 | - <title>Bookmark</title> | |
8 | - <link href="css/bootstrap.min.css" rel="stylesheet"> | |
9 | - <link href="css/bookmark.css" rel="stylesheet"> | |
5 | +<meta charset="UTF-8"> | |
6 | +<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
7 | +<meta name="viewport" content="width=device-width, initial-scale=1"> | |
8 | +<title>Bookmark</title> | |
9 | +<link href="css/bootstrap.min.css" rel="stylesheet"> | |
10 | +<link href="css/bookmark.css" rel="stylesheet"> | |
10 | 11 | </head> |
12 | + | |
11 | 13 | <body> |
12 | 14 | <div class="container"> |
13 | 15 | <div id="menu"></div> |
14 | 16 | <div class="jumbotron"> |
15 | 17 | <h3> |
16 | - Bem-vindo à aplicação de exemplo Bookmark usando arquétipo html-rest. <br /> | |
17 | - Este é o seu ponto de partida, portanto sinta-se à vontade para modificar esta aplicação. | |
18 | + Bem-vindo à aplicação de exemplo Bookmark usando arquétipo html-rest. <br /> Este é o seu ponto de partida, portanto sinta-se à vontade para | |
19 | + modificar esta aplicação. | |
18 | 20 | </h3> |
19 | 21 | </div> |
20 | 22 | </div> |
21 | - <p class="demoiselle">Aplicação de exemplo do Demoiselle 2.5.0</p> | |
23 | + <p class="demoiselle"> | |
24 | + Aplicação de exemplo do Demoiselle <span id="demoiselle-version"></span> | |
25 | + </p> | |
26 | + | |
22 | 27 | <script type="text/javascript" src="js/lib/jquery-2.1.0.min.js"></script> |
23 | 28 | <script type="text/javascript" src="js/lib/bootstrap.min.js"></script> |
24 | 29 | <script type="text/javascript" src="js/lib/bootbox.js"></script> |
25 | 30 | <script type="text/javascript" src="js/lib/app.js"></script> |
31 | + <script type="text/javascript" src="js/proxy/metadata.js"></script> | |
26 | 32 | <script type="text/javascript" src="js/proxy/auth.js"></script> |
27 | 33 | <script type="text/javascript" src="js/controller/menu.js"></script> |
28 | 34 | <script type="text/javascript" src="js/controller/home.js"></script> |
29 | 35 | </body> |
30 | -</html> | |
31 | 36 | \ No newline at end of file |
37 | +</html> | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/bookmark-edit.js
1 | 1 | $(function() { |
2 | - | |
3 | 2 | $("#delete").hide(); |
4 | - | |
5 | 3 | $("#description").focus(); |
6 | 4 | |
5 | + MetadataProxy.getDemoiselleVersion().done(function(data) { | |
6 | + $("#demoiselle-version").html(data); | |
7 | + }); | |
8 | + | |
7 | 9 | $(document).ready(function() { |
8 | 10 | if (id = $.url().param('id')) { |
9 | 11 | BookmarkProxy.load(id).done(loadOk).fail(loadFailed); |
... | ... | @@ -15,24 +17,24 @@ $(function() { |
15 | 17 | }); |
16 | 18 | |
17 | 19 | $("#save").click(function() { |
18 | - var form = { | |
20 | + var data = { | |
19 | 21 | description : $("#description").val(), |
20 | 22 | link : $("#link").val() |
21 | 23 | }; |
22 | 24 | |
23 | 25 | if (id = $("#id").val()) { |
24 | - BookmarkProxy.update(id, form).done(saveOk).fail(saveFailed); | |
26 | + BookmarkProxy.update(id, data).done(saveOk).fail(saveFailed); | |
25 | 27 | } else { |
26 | - BookmarkProxy.insert(form).done(saveOk).fail(saveFailed); | |
28 | + BookmarkProxy.insert(data).done(saveOk).fail(saveFailed); | |
27 | 29 | } |
28 | 30 | }); |
29 | 31 | |
30 | 32 | $("#delete").click(function() { |
31 | 33 | bootbox.confirm("Tem certeza que deseja apagar?", function(result) { |
32 | - if(result) { | |
33 | - BookmarkProxy.remove([$("#id").val()]).done(removeOk); | |
34 | + if (result) { | |
35 | + BookmarkProxy.remove([ $("#id").val() ]).done(removeOk); | |
34 | 36 | } |
35 | - }); | |
37 | + }); | |
36 | 38 | }); |
37 | 39 | |
38 | 40 | $("#back").click(function() { |
... | ... | @@ -52,7 +54,7 @@ function loadOk(data) { |
52 | 54 | function loadFailed(request) { |
53 | 55 | switch (request.status) { |
54 | 56 | case 404: |
55 | - bootbox.alert("Você está tentando acessar um registro inexistente!", function(){ | |
57 | + bootbox.alert("Você está tentando acessar um registro inexistente!", function() { | |
56 | 58 | location.href = "bookmark-list.html"; |
57 | 59 | }); |
58 | 60 | break; |
... | ... | @@ -96,4 +98,4 @@ function saveFailed(request) { |
96 | 98 | |
97 | 99 | function removeOk(data) { |
98 | 100 | location.href = 'bookmark-list.html'; |
99 | -} | |
100 | 101 | \ No newline at end of file |
102 | +} | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/bookmark-list.js
1 | 1 | $(function() { |
2 | - | |
3 | 2 | $("#new").focus(); |
4 | 3 | |
4 | + MetadataProxy.getDemoiselleVersion().done(function(data) { | |
5 | + $("#demoiselle-version").html(data); | |
6 | + }); | |
7 | + | |
5 | 8 | $(document).ready(function() { |
6 | 9 | BookmarkProxy.findAll().done(findAllOk); |
7 | 10 | }); |
... | ... | @@ -22,19 +25,21 @@ $(function() { |
22 | 25 | }); |
23 | 26 | |
24 | 27 | if (ids.length == 0) { |
25 | - bootbox.alert({message: "Nenhum registro selecionado"}); | |
28 | + bootbox.alert({ | |
29 | + message : "Nenhum registro selecionado" | |
30 | + }); | |
26 | 31 | } else { |
27 | 32 | bootbox.confirm("Tem certeza que deseja apagar?", function(result) { |
28 | - if(result) { | |
33 | + if (result) { | |
29 | 34 | BookmarkProxy.remove(ids).done(removeOk); |
30 | 35 | } |
31 | - }); | |
36 | + }); | |
32 | 37 | } |
33 | 38 | }); |
34 | 39 | }); |
35 | 40 | |
36 | 41 | function findAllOk(data) { |
37 | - var oTable = $('#resultList').dataTable({ | |
42 | + $('#resultList').dataTable({ | |
38 | 43 | "aoColumns" : [ { |
39 | 44 | "aTargets" : [ 0 ], |
40 | 45 | "mDataProp" : "id", |
... | ... | @@ -70,10 +75,10 @@ function findAllOk(data) { |
70 | 75 | "bDestroy" : true, |
71 | 76 | "sPaginationType" : "bs_full", |
72 | 77 | "aaData" : data, |
73 | - "bSort" : false | |
78 | + "bSort" : true | |
74 | 79 | }); |
75 | 80 | } |
76 | 81 | |
77 | 82 | function removeOk() { |
78 | 83 | BookmarkProxy.findAll().done(findAllOk); |
79 | -} | |
80 | 84 | \ No newline at end of file |
85 | +} | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/home.js
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js
1 | 1 | $(function() { |
2 | 2 | $("#username").focus(); |
3 | 3 | |
4 | + MetadataProxy.getDemoiselleVersion().done(function(data) { | |
5 | + $("#demoiselle-version").html(data); | |
6 | + }); | |
7 | + | |
4 | 8 | $("form").submit(function(event) { |
5 | 9 | event.preventDefault(); |
6 | 10 | |
7 | 11 | $("[id$='-message']").hide(); |
8 | 12 | |
9 | - var form = { | |
13 | + var data = { | |
10 | 14 | 'username' : $("#username").val().trim(), |
11 | 15 | 'password' : $("#password").val().trim() |
12 | 16 | }; |
13 | 17 | |
14 | - AuthProxy.login(form).done(loginOk).fail(loginFail); | |
18 | + AuthProxy.login(data).done(loginOk).fail(loginFail); | |
15 | 19 | }); |
16 | 20 | }); |
17 | 21 | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/menu.js
1 | 1 | $(function() { |
2 | - | |
3 | 2 | $("#menu").load("menu.html", function() { |
4 | - | |
5 | 3 | AuthProxy.getUser().done(getUserOk); |
6 | 4 | |
7 | 5 | $("#logout").on("click", function() { |
8 | 6 | App.removeToken(); |
9 | 7 | location.href = "login.html"; |
10 | 8 | }); |
11 | - | |
12 | 9 | }); |
13 | - | |
14 | 10 | }); |
15 | 11 | |
16 | 12 | function getUserOk(data) { |
17 | 13 | $("#username").html(data.username); |
18 | -} | |
19 | 14 | \ No newline at end of file |
15 | +} | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/lib/app.js
... | ... | @@ -2,7 +2,7 @@ $.ajaxSetup({ |
2 | 2 | error : function(request) { |
3 | 3 | switch (request.status) { |
4 | 4 | case 401: |
5 | - bootbox.alert("Você não está autenticado!", function(){ | |
5 | + bootbox.alert("Você não está autenticado!", function() { | |
6 | 6 | location.href = "login.html"; |
7 | 7 | }); |
8 | 8 | break; |
... | ... | @@ -25,5 +25,4 @@ var App = { |
25 | 25 | removeToken : function() { |
26 | 26 | sessionStorage.removeItem(this.tokenKey); |
27 | 27 | } |
28 | - | |
29 | -} | |
28 | +}; | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/auth.js
... | ... | @@ -8,7 +8,7 @@ var AuthProxy = { |
8 | 8 | type : "POST", |
9 | 9 | data : JSON.stringify($credentials), |
10 | 10 | contentType : "application/json", |
11 | - error: function(){ } | |
11 | + error : function() {} | |
12 | 12 | }); |
13 | 13 | }, |
14 | 14 | |
... | ... | @@ -31,5 +31,4 @@ var AuthProxy = { |
31 | 31 | } |
32 | 32 | }); |
33 | 33 | } |
34 | - | |
35 | -} | |
36 | 34 | \ No newline at end of file |
35 | +}; | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/bookmark.js
1 | 1 | var BookmarkProxy = { |
2 | - | |
2 | + | |
3 | 3 | url : "api/bookmark", |
4 | - | |
4 | + | |
5 | 5 | findAll : function() { |
6 | 6 | return $.ajax({ |
7 | 7 | type : "GET", |
... | ... | @@ -11,7 +11,7 @@ var BookmarkProxy = { |
11 | 11 | } |
12 | 12 | }); |
13 | 13 | }, |
14 | - | |
14 | + | |
15 | 15 | load : function($id) { |
16 | 16 | return $.ajax({ |
17 | 17 | type : "GET", |
... | ... | @@ -21,12 +21,12 @@ var BookmarkProxy = { |
21 | 21 | } |
22 | 22 | }); |
23 | 23 | }, |
24 | - | |
25 | - insert : function($form) { | |
24 | + | |
25 | + insert : function($data) { | |
26 | 26 | return $.ajax({ |
27 | 27 | type : "POST", |
28 | 28 | url : this.url, |
29 | - data : JSON.stringify($form), | |
29 | + data : JSON.stringify($data), | |
30 | 30 | contentType : "application/json", |
31 | 31 | beforeSend : function(request) { |
32 | 32 | request.setRequestHeader("Authorization", App.getToken()); |
... | ... | @@ -45,7 +45,7 @@ var BookmarkProxy = { |
45 | 45 | } |
46 | 46 | }); |
47 | 47 | }, |
48 | - | |
48 | + | |
49 | 49 | remove : function($ids) { |
50 | 50 | return $.ajax({ |
51 | 51 | type : "DELETE", |
... | ... | @@ -57,5 +57,4 @@ var BookmarkProxy = { |
57 | 57 | } |
58 | 58 | }); |
59 | 59 | } |
60 | - | |
61 | -} | |
62 | 60 | \ No newline at end of file |
61 | +}; | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/metadata.js
0 → 100644
... | ... | @@ -0,0 +1,25 @@ |
1 | +var MetadataProxy = { | |
2 | + | |
3 | + url : "api/metadata", | |
4 | + | |
5 | + getVersion : function() { | |
6 | + return $.ajax({ | |
7 | + type : "GET", | |
8 | + url : this.url + "/version" | |
9 | + }); | |
10 | + }, | |
11 | + | |
12 | + getMessage : function($key) { | |
13 | + return $.ajax({ | |
14 | + type : "GET", | |
15 | + url : this.url + "/message/" + $key | |
16 | + }); | |
17 | + }, | |
18 | + | |
19 | + getDemoiselleVersion : function() { | |
20 | + return $.ajax({ | |
21 | + type : "GET", | |
22 | + url : this.url + "/demoiselle/version" | |
23 | + }); | |
24 | + } | |
25 | +}; | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/login.html
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html> |
3 | -<head> | |
4 | - <meta charset="UTF-8"> | |
5 | - <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
6 | - <meta name="viewport" content="width=device-width, initial-scale=1"> | |
7 | - <title>Bookmark</title> | |
8 | - <link href="css/bootstrap.min.css" rel="stylesheet"> | |
9 | - <link href="css/bookmark.css" rel="stylesheet"> | |
3 | + | |
4 | +<head> | |
5 | +<meta charset="UTF-8"> | |
6 | +<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
7 | +<meta name="viewport" content="width=device-width, initial-scale=1"> | |
8 | +<title>Bookmark</title> | |
9 | +<link href="css/bootstrap.min.css" rel="stylesheet"> | |
10 | +<link href="css/bookmark.css" rel="stylesheet"> | |
10 | 11 | </head> |
12 | + | |
11 | 13 | <body> |
12 | 14 | <div class="container"> |
13 | - <form id="form-login" role="form"> | |
15 | + <form id="form-login" role="form"> | |
14 | 16 | <div class="col-md-4 col-md-offset-4"> |
15 | 17 | <div class="form-group"> |
16 | 18 | <h1>Bookmark | Login</h1> |
... | ... | @@ -38,12 +40,16 @@ |
38 | 40 | </div> |
39 | 41 | </form> |
40 | 42 | </div> |
41 | - <p class="demoiselle">Aplicação de exemplo do Demoiselle 2.5.0</p> | |
43 | + <p class="demoiselle"> | |
44 | + Aplicação de exemplo do Demoiselle <span id="demoiselle-version"></span> | |
45 | + </p> | |
46 | + | |
42 | 47 | <script type="text/javascript" src="js/lib/jquery-2.1.0.min.js"></script> |
43 | 48 | <script type="text/javascript" src="js/lib/bootstrap.min.js"></script> |
44 | 49 | <script type="text/javascript" src="js/lib/bootbox.js"></script> |
45 | 50 | <script type="text/javascript" src="js/lib/app.js"></script> |
51 | + <script type="text/javascript" src="js/proxy/metadata.js"></script> | |
46 | 52 | <script type="text/javascript" src="js/proxy/auth.js"></script> |
47 | 53 | <script type="text/javascript" src="js/controller/login.js"></script> |
48 | 54 | </body> |
49 | -</html> | |
50 | 55 | \ No newline at end of file |
56 | +</html> | ... | ... |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/menu.html
1 | 1 | <nav class="navbar navbar-default" role="navigation"> |
2 | - <div class="container-fluid"> | |
3 | - <div class="navbar-header"> | |
4 | - <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | |
5 | - <span class="sr-only">Toggle navigation</span> | |
6 | - <span class="icon-bar"></span> | |
7 | - <span class="icon-bar"></span> | |
8 | - <span class="icon-bar"></span> | |
9 | - </button> | |
10 | - <a class="navbar-brand" href="home.html">Bookmark</a> | |
11 | - </div> | |
12 | - <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | |
13 | - <ul class="nav navbar-nav"> | |
14 | - <li class="dropdown"> | |
15 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-th-list"></span> Bookmark<b class="caret"></b></a> | |
16 | - <ul class="dropdown-menu"> | |
17 | - <li><a href="bookmark-edit.html"><span class="glyphicon glyphicon glyphicon-edit"></span> Novo</a></li> | |
18 | - <li><a href="bookmark-list.html"><span class="glyphicon glyphicon-list-alt"></span> Listar</a></li> | |
19 | - </ul> | |
20 | - </li> | |
21 | - </ul> | |
22 | - <ul class="nav navbar-nav navbar-right"> | |
23 | - <li id="username"></li> | |
24 | - <li><a id="logout" href="#">Sair</a></li> | |
25 | - </ul> | |
26 | - </div> | |
27 | - </div> | |
28 | -</nav> | |
29 | 2 | \ No newline at end of file |
3 | + <div class="container-fluid"> | |
4 | + <div class="navbar-header"> | |
5 | + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | |
6 | + <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> | |
7 | + </button> | |
8 | + <a class="navbar-brand" href="home.html">Bookmark</a> | |
9 | + </div> | |
10 | + <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | |
11 | + <ul class="nav navbar-nav"> | |
12 | + <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-th-list"></span> | |
13 | + Bookmark<b class="caret"></b></a> | |
14 | + <ul class="dropdown-menu"> | |
15 | + <li><a href="bookmark-edit.html"><span class="glyphicon glyphicon glyphicon-edit"></span> Novo</a></li> | |
16 | + <li><a href="bookmark-list.html"><span class="glyphicon glyphicon-list-alt"></span> Listar</a></li> | |
17 | + </ul></li> | |
18 | + </ul> | |
19 | + <ul class="nav navbar-nav navbar-right"> | |
20 | + <li id="username"></li> | |
21 | + <li><a id="logout" href="#">Sair</a></li> | |
22 | + </ul> | |
23 | + </div> | |
24 | + </div> | |
25 | +</nav> | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Metadata.java
0 → 100644
... | ... | @@ -0,0 +1,48 @@ |
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.util; | |
38 | + | |
39 | +public final class Metadata { | |
40 | + | |
41 | + private Metadata() { | |
42 | + } | |
43 | + | |
44 | + public static String getVersion() { | |
45 | + ResourceBundle bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle")); | |
46 | + return bundle.getString("version"); | |
47 | + } | |
48 | +} | ... | ... |
impl/core/src/main/resources/demoiselle-core-bundle.properties
... | ... | @@ -33,6 +33,7 @@ |
33 | 33 | # ou escreva para a Fundação do Software Livre (FSF) Inc., |
34 | 34 | # 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. |
35 | 35 | |
36 | +version=${project.version} | |
36 | 37 | engine-on=Iniciando o Demoiselle Framework ${project.version} |
37 | 38 | resource-not-found=Arquivo {0} n\u00E3o foi encontrado |
38 | 39 | key-not-found=A chave {0} n\u00E3o foi encontrada | ... | ... |
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/MetadataREST.java
0 → 100644
... | ... | @@ -0,0 +1,46 @@ |
1 | +package br.gov.frameworkdemoiselle.internal.implementation; | |
2 | + | |
3 | +import static javax.ws.rs.core.MediaType.TEXT_HTML; | |
4 | + | |
5 | +import java.util.ResourceBundle; | |
6 | + | |
7 | +import javax.inject.Inject; | |
8 | +import javax.ws.rs.GET; | |
9 | +import javax.ws.rs.Path; | |
10 | +import javax.ws.rs.PathParam; | |
11 | +import javax.ws.rs.Produces; | |
12 | + | |
13 | +import br.gov.frameworkdemoiselle.NotFoundException; | |
14 | +import br.gov.frameworkdemoiselle.util.Metadata; | |
15 | + | |
16 | +@Path("metadata") | |
17 | +public class MetadataREST { | |
18 | + | |
19 | + @Inject | |
20 | + private ResourceBundle bundle; | |
21 | + | |
22 | + @GET | |
23 | + @Path("demoiselle/version") | |
24 | + @Produces("text/plain") | |
25 | + public String getDemoiselleVersion() { | |
26 | + return Metadata.getVersion(); | |
27 | + } | |
28 | + | |
29 | + @GET | |
30 | + @Path("version") | |
31 | + @Produces("text/plain") | |
32 | + public String getAppVersion() { | |
33 | + return bundle.getString("application.version"); | |
34 | + } | |
35 | + | |
36 | + @GET | |
37 | + @Path("message/{key}") | |
38 | + @Produces(TEXT_HTML) | |
39 | + public String getMessage(@PathParam("key") String key) throws Exception { | |
40 | + if (!bundle.containsKey(key)) { | |
41 | + throw new NotFoundException(); | |
42 | + } | |
43 | + | |
44 | + return bundle.getString(key); | |
45 | + } | |
46 | +} | ... | ... |
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/util/Cache.java
0 → 100644
... | ... | @@ -0,0 +1,58 @@ |
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.util; | |
38 | + | |
39 | +import static java.lang.annotation.ElementType.METHOD; | |
40 | +import static java.lang.annotation.ElementType.TYPE; | |
41 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
42 | + | |
43 | +import java.lang.annotation.Inherited; | |
44 | +import java.lang.annotation.Retention; | |
45 | +import java.lang.annotation.Target; | |
46 | + | |
47 | +import javax.enterprise.util.Nonbinding; | |
48 | +import javax.interceptor.InterceptorBinding; | |
49 | + | |
50 | +@Inherited | |
51 | +@InterceptorBinding | |
52 | +@Target({ METHOD, TYPE }) | |
53 | +@Retention(RUNTIME) | |
54 | +public @interface Cache { | |
55 | + | |
56 | + @Nonbinding | |
57 | + String value(); | |
58 | +} | ... | ... |
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/util/CacheInterceptor.java
0 → 100644
... | ... | @@ -0,0 +1,66 @@ |
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.util; | |
38 | + | |
39 | +import java.io.Serializable; | |
40 | + | |
41 | +import javax.interceptor.AroundInvoke; | |
42 | +import javax.interceptor.Interceptor; | |
43 | +import javax.interceptor.InvocationContext; | |
44 | +import javax.servlet.http.HttpServletResponse; | |
45 | + | |
46 | +/** | |
47 | + * Intercepts calls with {@code @ValidatePayload} annotations. | |
48 | + * | |
49 | + * @author SERPRO | |
50 | + */ | |
51 | +@Interceptor | |
52 | +@Cache(value = "") | |
53 | +public class CacheInterceptor implements Serializable { | |
54 | + | |
55 | + private static final long serialVersionUID = 1L; | |
56 | + | |
57 | + @AroundInvoke | |
58 | + public Object manage(final InvocationContext ic) throws Exception { | |
59 | + Object result = ic.proceed(); | |
60 | + | |
61 | + HttpServletResponse response = Beans.getReference(HttpServletResponse.class); | |
62 | + response.setHeader("Cache-Control", ic.getMethod().getAnnotation(Cache.class).value()); | |
63 | + | |
64 | + return result; | |
65 | + } | |
66 | +} | ... | ... |
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/util/ValidatePayloadInterceptor.java
... | ... | @@ -54,8 +54,8 @@ import javax.validation.ValidatorFactory; |
54 | 54 | * |
55 | 55 | * @author SERPRO |
56 | 56 | */ |
57 | -@ValidatePayload | |
58 | 57 | @Interceptor |
58 | +@ValidatePayload | |
59 | 59 | public class ValidatePayloadInterceptor implements Serializable { |
60 | 60 | |
61 | 61 | private static final long serialVersionUID = 1L; | ... | ... |