public static String getParam ( HttpServletRequest req , String strParam , String strDefault ) { String strParams [ ] = null ; if ( req == null ) return null ; strParams = req . getParameterValues ( strParam ) ; // Menu page if ( DBParams . URL . equals ( strParam ) ) { strParams = new String [ 1 ] ; strParams [ 0 ] = req . getRequestURL ( ) . toString ( ) ; // Special param (url). } if ( DBParams . CODEBASE . equals ( strParam ) ) { strParams = new String [ 1 ] ; strParams [ 0 ] = req . getRequestURL ( ) . toString ( ) ; // Special param (url). if ( strParams [ 0 ] . endsWith ( Constants . DEFAULT_SERVLET ) ) strParams [ 0 ] = strParams [ 0 ] . substring ( 0 , strParams [ 0 ] . length ( ) - Constants . DEFAULT_SERVLET . length ( ) ) ; if ( ! strParams [ 0 ] . endsWith ( "/" ) ) strParams [ 0 ] = strParams [ 0 ] + "/" ; // Codebase should always end with this } if ( DBParams . DOMAIN . equals ( strParam ) ) { strParams = new String [ 1 ] ; strParams [ 0 ] = req . getRequestURL ( ) . toString ( ) ; // Special param (url). return Utility . getDomainFromURL ( strParams [ 0 ] , null ) ; } if ( strParams == null ) if ( DBParams . DATATYPE . equals ( strParam ) ) { strParams = new String [ 1 ] ; strParams [ 0 ] = req . getRequestURL ( ) . toString ( ) ; // Special param (url). if ( ( strParams [ 0 ] != null ) && ( strParams [ 0 ] . lastIndexOf ( ' ' ) != - 1 ) ) { strParams [ 0 ] = strParams [ 0 ] . substring ( strParams [ 0 ] . lastIndexOf ( ' ' ) + 1 ) ; if ( strParams [ 0 ] . indexOf ( ' ' ) != - 1 ) strParams [ 0 ] = strParams [ 0 ] . substring ( 0 , strParams [ 0 ] . indexOf ( ' ' ) ) ; if ( ( ! DBParams . TABLE_PARAM . equalsIgnoreCase ( strParams [ 0 ] ) ) && ( ! DBParams . WEBSTART_PARAM . equalsIgnoreCase ( strParams [ 0 ] ) ) && ( ! DBParams . WEBSTART_APPLET_PARAM . equalsIgnoreCase ( strParams [ 0 ] ) ) && ( ! DBParams . WSDL_PARAM . equalsIgnoreCase ( strParams [ 0 ] ) ) && ( ! DBParams . IMAGE_PATH . equalsIgnoreCase ( strParams [ 0 ] ) ) ) strParams = null ; // Must be one of these } else strParams = null ; } if ( strParams == null ) return strDefault ; if ( strParams . length == 0 ) return Constants . BLANK ; if ( strParams [ 0 ] == null ) return Constants . BLANK ; return strParams [ 0 ] ; }
Get the first occurrence of this parameter .