public static String determineServletContextPath ( HttpServletRequest theRequest , RestfulServer server ) { String retVal ; if ( server . getServletContext ( ) != null ) { if ( server . getServletContext ( ) . getMajorVersion ( ) >= 3 || ( server . getServletContext ( ) . getMajorVersion ( ) > 2 && server . getServletContext ( ) . getMinorVersion ( ) >= 5 ) ) { retVal = server . getServletContext ( ) . getContextPath ( ) ; } else { retVal = theRequest . getContextPath ( ) ; } } else { retVal = theRequest . getContextPath ( ) ; } retVal = StringUtils . defaultString ( retVal ) ; return retVal ; }
Determines the servlet s context path .