Mercurial > hg > mpdl-group
comparison software/mpdl-services/mpiwg-mpdl-lt-web/src/de/mpg/mpiwg/berlin/mpdl/servlets/util/ServletUtil.java @ 19:4a3641ae14d2
Erstellung
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 09 Nov 2011 15:32:05 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
18:dc5e9fcb3fdc | 19:4a3641ae14d2 |
---|---|
1 package de.mpg.mpiwg.berlin.mpdl.servlets.util; | |
2 | |
3 import javax.servlet.http.HttpServletRequest; | |
4 | |
5 import de.mpg.mpiwg.berlin.mpdl.exception.ApplicationException; | |
6 | |
7 public class ServletUtil { | |
8 private static ServletUtil instance; | |
9 | |
10 public static ServletUtil getInstance() throws ApplicationException { | |
11 if (instance == null) { | |
12 instance = new ServletUtil(); | |
13 } | |
14 return instance; | |
15 } | |
16 | |
17 public ServletUtil() { | |
18 } | |
19 | |
20 public String getBaseUrl( HttpServletRequest request ) { | |
21 if (request.getServerPort() == 80 || request.getServerPort() == 443) | |
22 return request.getScheme() + "://" + request.getServerName() + request.getContextPath(); | |
23 else | |
24 return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); | |
25 } | |
26 | |
27 } |