X Tutup
Skip to content

Commit 0077433

Browse files
committed
remove basePath
1 parent a1e8abe commit 0077433

File tree

14 files changed

+38
-41
lines changed

14 files changed

+38
-41
lines changed

src/main/java/com/raysmond/blog/WebConfig.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,8 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
4242
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView view) {
4343
CsrfToken token = (CsrfToken) request.getAttribute(CsrfToken.class.getName());
4444
if (token != null) {
45-
// add csrf token
4645
view.addObject(token.getParameterName(), token);
4746
}
48-
49-
view.addObject("basePath", request.getContextPath());
5047
}
5148
};
5249
}

src/main/resources/templates/admin/home/settings.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ block content
44
h1 Settings
55
hr
66

7-
form.settings-form(method="post",action="#{basePath}/admin/settings")
7+
form.settings-form(method="post",action="/admin/settings")
88
input(type="hidden", name='_csrf', value='#{_csrf.token}')
99
table.table.table-hover.table-bordered.settings
1010
tbody

src/main/resources/templates/admin/layout/head.jade

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ meta(name="description", content="A simple blog demo with Spring MVC.")
66
meta(name="author", content="Raysmond")
77
title #{App.getSiteName()}
88

9-
link(rel='stylesheet', type='text/css', href='#{basePath}/webjars/bootstrap/3.3.5/css/bootstrap.min.css')
10-
link(rel='stylesheet', type='text/css', href='#{basePath}/webjars/font-awesome/4.3.0-3/css/font-awesome.min.css')
11-
link(rel="stylesheet", type='text/css', href="#{basePath}/css/admin/admin.css")
9+
link(rel='stylesheet', type='text/css', href='/webjars/bootstrap/3.3.5/css/bootstrap.min.css')
10+
link(rel='stylesheet', type='text/css', href='/webjars/font-awesome/4.3.0-3/css/font-awesome.min.css')
11+
link(rel="stylesheet", type='text/css', href="/css/admin/admin.css")
1212

13-
script(src="#{basePath}/webjars/jquery/2.1.4/jquery.min.js")
14-
script(src="#{basePath}/webjars/bootstrap/3.3.5/js/bootstrap.min.js")
15-
script(src="#{basePath}/vendors/bootstrap-paginator-1.0.2/js/bootstrap-paginator.min.js")
13+
script(src="/webjars/jquery/2.1.4/jquery.min.js")
14+
script(src="/webjars/bootstrap/3.3.5/js/bootstrap.min.js")
15+
script(src="/vendors/bootstrap-paginator-1.0.2/js/bootstrap-paginator.min.js")

src/main/resources/templates/admin/layout/navbar.jade

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ nav.navbar.navbar-fixed-top.navbar-default
66
span.icon-bar
77
span.icon-bar
88
span.icon-bar
9-
a.navbar-brand(href="#{basePath}/admin")
9+
a.navbar-brand(href="/admin")
1010
span #{App.getSiteName()}
1111
.collapse.navbar-collapse#navbar
1212
ul.nav.navbar-nav
13-
li: a(href="#{basePath}/admin/posts") Posts
14-
li: a(href="#{basePath}/admin/settings") Settings
15-
li: a(href="#{basePath}/admin/users/profile") Profile
16-
li: a(href="#{basePath}/") Site Home
13+
li: a(href="/admin/posts") Posts
14+
li: a(href="/admin/settings") Settings
15+
li: a(href="/admin/users/profile") Profile
16+
li: a(href="/") Site Home
1717

1818
ul.nav.navbar-nav.navbar-right.navbar-user
1919
li
2020
a(href="javascript:$('#form').submit();") Logout
2121

22-
form#form(style="visibility: hidden", method="post", action="#{basePath}/logout")
22+
form#form(style="visibility: hidden", method="post", action="/logout")
2323
input(type="hidden", name='_csrf', value='#{_csrf.token}')
2424

src/main/resources/templates/admin/posts/edit.jade

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
extends ../layout/admin
22

33
block head
4-
script(src="#{basePath}/webjars/ace/1.2.0/src-min/ace.js")
5-
script(src="#{basePath}/webjars/ace/1.2.0/src-min/theme-github.js")
6-
script(src="#{basePath}/webjars/ace/1.2.0/src-min/mode-markdown.js")
4+
script(src="/webjars/ace/1.2.0/src-min/ace.js")
5+
script(src="/webjars/ace/1.2.0/src-min/theme-github.js")
6+
script(src="/webjars/ace/1.2.0/src-min/mode-markdown.js")
77

88
block content
99
h1 Edit Post
1010
hr
1111

12-
form.post-form(method="post",action="#{basePath}/admin/posts/#{post.getId()}")
12+
form.post-form(method="post",action="/admin/posts/#{post.getId()}")
1313
.item-row
1414
input(type="hidden", name='_csrf', value='#{_csrf.token}')
1515
.item-row

src/main/resources/templates/admin/posts/index.jade

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ block content
44
h1 Posts
55
hr
66

7-
a.btn.btn-primary(href="#{basePath}/admin/posts/new") Create
7+
a.btn.btn-primary(href="/admin/posts/new") Create
88

99
.row(style="margin-top: 10px;")
1010
.col-sm-12
@@ -29,14 +29,14 @@ block content
2929
td #{post.getCreatedAt()}
3030
td #{post.getUpdatedAt()}
3131
td.operations
32-
a.btn.btn-xs.btn-info(href="#{basePath}/posts/#{post.getId()}", target:'_blank')
32+
a.btn.btn-xs.btn-info(href="/posts/#{post.getId()}", target:'_blank')
3333
i.fa.fa-eye
34-
a.btn.btn-xs.btn-primary(href="#{basePath}/admin/posts/#{post.getId()}/edit")
34+
a.btn.btn-xs.btn-primary(href="/admin/posts/#{post.getId()}/edit")
3535
i.fa.fa-edit
3636
a.btn.btn-xs.btn-danger.btn-delete(href="javascript:deletePost(#{post.id})", postId="#{post.id}")
3737
i.fa.fa-trash-o
3838

39-
form(id="form-#{post.getId()}",style="visibility: hidden", method="post", action="#{basePath}/admin/posts/#{post.getId()}/delete")
39+
form(id="form-#{post.getId()}",style="visibility: hidden", method="post", action="/admin/posts/#{post.getId()}/delete")
4040
input(type="hidden", name='_csrf', value='#{_csrf.token}')
4141
.col-sm-12
4242
div#pagination

src/main/resources/templates/admin/posts/new.jade

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
extends ../layout/admin
22

33
block head
4-
script(src="#{basePath}/webjars/ace/1.2.0/src-min/ace.js")
5-
script(src="#{basePath}/webjars/ace/1.2.0/src-min/theme-github.js")
6-
script(src="#{basePath}/webjars/ace/1.2.0/src-min/mode-markdown.js")
4+
script(src="/webjars/ace/1.2.0/src-min/ace.js")
5+
script(src="/webjars/ace/1.2.0/src-min/theme-github.js")
6+
script(src="/webjars/ace/1.2.0/src-min/mode-markdown.js")
77

88
block content
99
h1 New Post
1010
hr
1111

12-
form.post-form(method="post",action="#{basePath}/admin/posts")
12+
form.post-form(method="post",action="/admin/posts")
1313
.item-row
1414
input(type="hidden", name='_csrf', value='#{_csrf.token}')
1515
.item-row

src/main/resources/templates/admin/users/profile.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ block content
55
hr
66

77
.profile
8-
form.post-form(method="post", action="#{basePath}/admin/users/#{user.getId()}")
8+
form.post-form(method="post", action="/admin/users/#{user.getId()}")
99
input(type="hidden", name='_csrf', value='#{_csrf.token}')
1010

1111
.row

src/main/resources/templates/home/index.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ block content
1515
ul.pager
1616
if totalPages > page
1717
li.previous
18-
a.btn(href="#{basePath}/?page=#{page+1}")
18+
a.btn(href="/?page=#{page+1}")
1919
span(aria-hidden="true) ←
2020
| Older posts
2121
2222
if page > 1
2323
li.next
24-
a.btn(href="#{basePath}/?page=#{page-1}")
24+
a.btn(href="/?page=#{page-1}")
2525
|Newer posts
2626
span(aria-hidden="true) →
2727

src/main/resources/templates/layout/head.jade

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ title
1010
block title
1111
= App.getSiteName()
1212

13-
link(rel='stylesheet', type='text/css', href='#{basePath}/webjars/bootstrap/3.3.5/css/bootstrap.min.css')
14-
link(rel="stylesheet", type='text/css', href="#{basePath}/vendors/pygments/github.css")
15-
link(rel="stylesheet", type='text/css', href="#{basePath}/css/theme.css")
13+
link(rel='stylesheet', type='text/css', href='/webjars/bootstrap/3.3.5/css/bootstrap.min.css')
14+
link(rel="stylesheet", type='text/css', href="/vendors/pygments/github.css")
15+
link(rel="stylesheet", type='text/css', href="/css/theme.css")
1616

17-
script(src="#{basePath}/webjars/jquery/2.1.4/jquery.min.js")
17+
script(src="/webjars/jquery/2.1.4/jquery.min.js")

0 commit comments

Comments
 (0)
X Tutup