src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt

changeset 199
59393c8cc557
parent 198
94f174d591ab
child 205
7725a79416f3
equal deleted inserted replaced
198:94f174d591ab 199:59393c8cc557
78 set(value) { 78 set(value) {
79 field = value 79 field = value
80 request.setAttribute(Constants.REQ_ATTR_NAVIGATION, navigationMenu) 80 request.setAttribute(Constants.REQ_ATTR_NAVIGATION, navigationMenu)
81 } 81 }
82 82
83 var redirectLocation = "" 83 var redirectLocation: String? = null
84 set(value) { 84 set(value) {
85 field = value 85 field = value
86 request.setAttribute(Constants.REQ_ATTR_REDIRECT_LOCATION, baseHref + value) 86 if (value == null) {
87 } 87 request.removeAttribute(Constants.REQ_ATTR_REDIRECT_LOCATION)
88 88 } else {
89 var feedPath = "" 89 request.setAttribute(Constants.REQ_ATTR_REDIRECT_LOCATION, baseHref + value)
90 set(value) { 90 }
91 field = value 91 }
92 request.setAttribute(Constants.REQ_ATTR_FEED_HREF, baseHref + value) 92
93 var feedPath: String? = null
94 set(value) {
95 field = value
96 if (value == null) {
97 request.removeAttribute(Constants.REQ_ATTR_FEED_HREF)
98 } else {
99 request.setAttribute(Constants.REQ_ATTR_FEED_HREF, baseHref + value)
100 }
93 } 101 }
94 102
95 /** 103 /**
96 * The view object. 104 * The view object.
97 * 105 *
113 121
114 /** 122 /**
115 * The base path of this application. 123 * The base path of this application.
116 */ 124 */
117 val baseHref get() = "${request.scheme}://${request.serverName}$portInfo${request.contextPath}/" 125 val baseHref get() = "${request.scheme}://${request.serverName}$portInfo${request.contextPath}/"
118
119 init {
120 feedPath = "feed/projects.rss"
121 }
122 126
123 private fun String.withExt(ext: String) = if (endsWith(ext)) this else plus(ext) 127 private fun String.withExt(ext: String) = if (endsWith(ext)) this else plus(ext)
124 private fun jspPath(name: String) = Constants.JSP_PATH_PREFIX.plus(name).withExt(".jsp") 128 private fun jspPath(name: String) = Constants.JSP_PATH_PREFIX.plus(name).withExt(".jsp")
125 129
126 fun param(name: String): String? = request.getParameter(name) 130 fun param(name: String): String? = request.getParameter(name)

mercurial