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

changeset 199
59393c8cc557
parent 198
94f174d591ab
child 205
7725a79416f3
     1.1 --- a/src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt	Thu May 13 19:31:09 2021 +0200
     1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt	Sat May 15 16:19:29 2021 +0200
     1.3 @@ -80,16 +80,24 @@
     1.4              request.setAttribute(Constants.REQ_ATTR_NAVIGATION, navigationMenu)
     1.5          }
     1.6  
     1.7 -    var redirectLocation = ""
     1.8 +    var redirectLocation: String? = null
     1.9          set(value) {
    1.10              field = value
    1.11 -            request.setAttribute(Constants.REQ_ATTR_REDIRECT_LOCATION, baseHref + value)
    1.12 +            if (value == null) {
    1.13 +                request.removeAttribute(Constants.REQ_ATTR_REDIRECT_LOCATION)
    1.14 +            } else {
    1.15 +                request.setAttribute(Constants.REQ_ATTR_REDIRECT_LOCATION, baseHref + value)
    1.16 +            }
    1.17          }
    1.18  
    1.19 -    var feedPath = ""
    1.20 +    var feedPath: String? = null
    1.21          set(value) {
    1.22              field = value
    1.23 -            request.setAttribute(Constants.REQ_ATTR_FEED_HREF, baseHref + value)
    1.24 +            if (value == null) {
    1.25 +                request.removeAttribute(Constants.REQ_ATTR_FEED_HREF)
    1.26 +            } else {
    1.27 +                request.setAttribute(Constants.REQ_ATTR_FEED_HREF, baseHref + value)
    1.28 +            }
    1.29          }
    1.30  
    1.31      /**
    1.32 @@ -116,10 +124,6 @@
    1.33       */
    1.34      val baseHref get() = "${request.scheme}://${request.serverName}$portInfo${request.contextPath}/"
    1.35  
    1.36 -    init {
    1.37 -        feedPath = "feed/projects.rss"
    1.38 -    }
    1.39 -
    1.40      private fun String.withExt(ext: String) = if (endsWith(ext)) this else plus(ext)
    1.41      private fun jspPath(name: String) = Constants.JSP_PATH_PREFIX.plus(name).withExt(".jsp")
    1.42  

mercurial