private ApiResponse buildResponseFromContext ( Context c ) { Map < String , String > fields = new HashMap <> ( ) ; fields . put ( "name" , c . getName ( ) ) ; fields . put ( "id" , Integer . toString ( c . getIndex ( ) ) ) ; fields . put ( "description" , c . getDescription ( ) ) ; fields . put ( "inScope" , Boolean . toString ( c . isInScope ( ) ) ) ; fields . put ( "excludeRegexs" , jsonEncodeList ( c . getExcludeFromContextRegexs ( ) ) ) ; fields . put ( "includeRegexs" , jsonEncodeList ( c . getIncludeInContextRegexs ( ) ) ) ; AuthenticationMethod authenticationMethod = c . getAuthenticationMethod ( ) ; if ( authenticationMethod != null ) { Pattern pattern = authenticationMethod . getLoggedInIndicatorPattern ( ) ; fields . put ( "loggedInPattern" , pattern == null ? "" : pattern . toString ( ) ) ; pattern = authenticationMethod . getLoggedOutIndicatorPattern ( ) ; fields . put ( "loggedOutPattern" , pattern == null ? "" : pattern . toString ( ) ) ; AuthenticationMethodType type = authenticationMethod . getType ( ) ; fields . put ( "authType" , type == null ? "" : type . getName ( ) ) ; } AuthorizationDetectionMethod authorizationDetectionMethod = c . getAuthorizationDetectionMethod ( ) ; if ( authorizationDetectionMethod != null ) { fields . put ( "authenticationDetectionMethodId" , String . valueOf ( authorizationDetectionMethod . getMethodUniqueIdentifier ( ) ) ) ; } fields . put ( "urlParameterParserClass" , c . getUrlParamParser ( ) . getClass ( ) . getCanonicalName ( ) ) ; fields . put ( "urlParameterParserConfig" , c . getUrlParamParser ( ) . getConfig ( ) ) ; fields . put ( "postParameterParserClass" , c . getPostParamParser ( ) . getClass ( ) . getCanonicalName ( ) ) ; fields . put ( "postParameterParserConfig" , c . getPostParamParser ( ) . getConfig ( ) ) ; return new ApiResponseSet < String > ( "context" , fields ) ; }
Builds the response describing an Context .