File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
main/java/com/github/jknack/handlebars/springmvc
test/java/com/github/jknack/handlebars/springmvc Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -84,8 +84,9 @@ protected AbstractUrlBasedView buildView(final String viewName)
84
84
protected AbstractUrlBasedView configure (final HandlebarsView view )
85
85
throws IOException {
86
86
String url = view .getUrl ();
87
- // Remove suffix
88
- url = url .substring (0 , url .length () - getSuffix ().length ());
87
+ // Remove prefix & suffix.
88
+ url = url .substring (getPrefix ().length (), url .length ()
89
+ - getSuffix ().length ());
89
90
// Compile the template.
90
91
view .setTemplate (handlebars .compile (URI .create (url )));
91
92
return view ;
@@ -109,7 +110,7 @@ public void afterPropertiesSet() throws Exception {
109
110
new Handlebars (new SpringTemplateLoader (getApplicationContext ()));
110
111
}
111
112
TemplateLoader templateLoader = handlebars .getTemplateLoader ();
112
- // Override preffix and sufffix .
113
+ // Override prefix and suffix .
113
114
templateLoader .setPrefix (getPrefix ());
114
115
templateLoader .setSuffix (getSuffix ());
115
116
}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public void configureNoDash() throws Exception {
47
47
expect (handlebars .compile (URI .create ("home" ))).andReturn (template );
48
48
49
49
HandlebarsView view = createMock (HandlebarsView .class );
50
- expect (view .getUrl ()).andReturn ("home.hbs" );
50
+ expect (view .getUrl ()).andReturn ("/ home.hbs" );
51
51
view .setTemplate (template );
52
52
expectLastCall ();
53
53
@@ -65,7 +65,7 @@ public void configureWithDash() throws Exception {
65
65
Template template = createMock (Template .class );
66
66
67
67
Handlebars handlebars = createMock (Handlebars .class );
68
- expect (handlebars .compile (URI .create ("/ home" ))).andReturn (template );
68
+ expect (handlebars .compile (URI .create ("home" ))).andReturn (template );
69
69
70
70
HandlebarsView view = createMock (HandlebarsView .class );
71
71
expect (view .getUrl ()).andReturn ("/home.hbs" );
You can’t perform that action at this time.
0 commit comments