Friday, December 31, 2010

Java baseurl

PHP has a simple function baseurl() for the same functionality I didn't find an easy equivalent in Java. the one I manage to search is the following.

String requestUri = request.getRequestURI();
String requestUrl = request.getRequestURL().toString();
String baseUrl = requestUrl.replace(requestUri, "");

No comments: