Mercurial > hg > mpdl-group
view software/mpdl-services-new/mpiwg-mpdl-cms-web/src/de/mpg/mpiwg/berlin/mpdl/servlets/util/ServletUtil.java @ 25:e9fe3186670c default tip
letzter Stand eingecheckt
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 21 May 2013 10:19:32 +0200 |
parents | |
children |
line wrap: on
line source
package de.mpg.mpiwg.berlin.mpdl.servlets.util; import javax.servlet.http.HttpServletRequest; import de.mpg.mpiwg.berlin.mpdl.exception.ApplicationException; public class ServletUtil { private static ServletUtil instance; public static ServletUtil getInstance() throws ApplicationException { if (instance == null) { instance = new ServletUtil(); } return instance; } public ServletUtil() { } public String getBaseUrl( HttpServletRequest request ) { if (request.getServerPort() == 80 || request.getServerPort() == 443) return request.getScheme() + "://" + request.getServerName() + request.getContextPath(); else return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); } }