project: Fix application.context bug at recent history
Even though the user specified application.context, recent history links on project pages do not work properly. This fix is feat by @sjstyle. See: Github issue #102
@21e7d5bcfa7ad3c39961a5107ed608456f6f5cbc
--- app/models/History.java
+++ app/models/History.java
... | ... | @@ -20,6 +20,8 @@ |
20 | 20 |
*/ |
21 | 21 |
package models; |
22 | 22 |
|
23 |
+import org.apache.commons.lang3.StringUtils; |
|
24 |
+import play.Configuration; |
|
23 | 25 |
import playRepository.Commit; |
24 | 26 |
|
25 | 27 |
import java.util.*; |
... | ... | @@ -83,7 +85,12 @@ |
83 | 85 |
} |
84 | 86 |
|
85 | 87 |
public void setUrl(String url) { |
86 |
- this.url = url; |
|
88 |
+ String contextRoot = Configuration.root().getString("application.context"); |
|
89 |
+ if(StringUtils.isBlank(contextRoot)){ |
|
90 |
+ this.url = url; |
|
91 |
+ } else { |
|
92 |
+ this.url = (contextRoot + "/" + url).replaceAll("//","/"); |
|
93 |
+ } |
|
87 | 94 |
} |
88 | 95 |
|
89 | 96 |
public String getUserPageUrl() { |
+++ app/utils/SecurityManager.java
... | ... | @@ -0,0 +1,7 @@ |
1 | +package utils; | |
2 | + | |
3 | +/** | |
4 | + * Created by doortts on 12/5/16. | |
5 | + */ | |
6 | +public class SecurityManager { | |
7 | +} |
--- conf/application.conf.default
+++ conf/application.conf.default
... | ... | @@ -6,6 +6,12 @@ |
6 | 6 |
# The name of your website |
7 | 7 |
application.siteName="Yona" |
8 | 8 |
|
9 |
+# Application Context |
|
10 |
+# ~~~~~~~~~~~~~~~~~~~ |
|
11 |
+# If you want your own application context root, you can set it. |
|
12 |
+# Don't miss first / (slash) letter! |
|
13 |
+# application.context = /myroot |
|
14 |
+ |
|
9 | 15 |
# Anonymous access |
10 | 16 |
# ~~~~~~~~~~~~~~~~ |
11 | 17 |
# This site allows anonymous access. (default: true) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?