×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Karthick Bala
Added: Jul 25, 2014 10:03 AM
Views: 3
Tags: zf
  1.     public static String getPortalName(HttpServletRequest hsr) {
  2.         String requestURI = hsr.getRequestURI();
  3.  
  4.         int firstSlashIDX = requestURI.indexOf('/');
  5.         int secondSlashIDX = requestURI.indexOf('/', firstSlashIDX + 1);
  6.  
  7.         if (secondSlashIDX == -1) {
  8.             secondSlashIDX = requestURI.length();
  9.         }
  10.  
  11.         return requestURI.substring(firstSlashIDX + 1, secondSlashIDX);
  12.     }