test_class.declarator: apiServer
test_class.modifier: @Mock
test_class.original_string: @Mock
      ApiServer apiServer;
test_class.type: ApiServer
test_class.var_name: apiServer
test_class.declarator: request
test_class.modifier: @Mock
test_class.original_string: @Mock
      HttpServletRequest request;
test_class.type: HttpServletRequest
test_class.var_name: request
test_class.declarator: response
test_class.modifier: @Mock
test_class.original_string: @Mock
      HttpServletResponse response;
test_class.type: HttpServletResponse
test_class.var_name: response
test_class.declarator: accountService
test_class.modifier: @Mock
test_class.original_string: @Mock
      AccountService accountService;
test_class.type: AccountService
test_class.var_name: accountService
test_class.declarator: authManager
test_class.modifier: @Mock
test_class.original_string: @Mock
      APIAuthenticationManager authManager;
test_class.type: APIAuthenticationManager
test_class.var_name: authManager
test_class.declarator: authenticator
test_class.modifier: @Mock
test_class.original_string: @Mock
      APIAuthenticator authenticator;
test_class.type: APIAuthenticator
test_class.var_name: authenticator
test_class.declarator: user
test_class.modifier: @Mock
test_class.original_string: @Mock
      User user;
test_class.type: User
test_class.var_name: user
test_class.declarator: account
test_class.modifier: @Mock
test_class.original_string: @Mock
      Account account;
test_class.type: Account
test_class.var_name: account
test_class.declarator: session
test_class.modifier: @Mock
test_class.original_string: @Mock
      HttpSession session;
test_class.type: HttpSession
test_class.var_name: session
test_class.declarator: managementServer
test_class.modifier: @Mock
test_class.original_string: @Mock
      ManagementServer managementServer;
test_class.type: ManagementServer
test_class.var_name: managementServer
test_class.declarator: responseWriter
test_class.original_string: StringWriter responseWriter;
test_class.type: StringWriter
test_class.var_name: responseWriter
test_class.declarator: servlet
test_class.original_string: ApiServlet servlet;
test_class.type: ApiServlet
test_class.var_name: servlet
test_class.file: cosmic-core/server/src/test/java/com/cloud/api/ApiServletTest.java
test_class.identifier: ApiServletTest
test_case.body: @Test
      public void getClientAddressWithHttpXForwardedFor() {
          Mockito.when(request.getHeader(Mockito.eq("HTTP_X_FORWARDED_FOR"))).thenReturn("192.168.1.1");
          Assert.assertEquals("192.168.1.1", ApiServlet.getClientAddress(request));
      }
test_case.class_method_signature: ApiServletTest.getClientAddressWithHttpXForwardedFor()
test_case.full_signature: @Test public void getClientAddressWithHttpXForwardedFor()
test_case.identifier: getClientAddressWithHttpXForwardedFor
test_case.invocations: thenReturn when getHeader eq assertEquals getClientAddress
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getClientAddressWithHttpXForwardedFor()
focal_class.declarator: s_logger = LoggerFactory.getLogger(ApiServlet.class.getName())
focal_class.modifier: public static final
focal_class.original_string: public static final Logger s_logger = LoggerFactory.getLogger(ApiServlet.class.getName());
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.declarator: s_clientAddressHeaders = Collections
              .unmodifiableList(Arrays.asList("X-Forwarded-For",
                      "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR", "Remote_Addr"))
focal_class.modifier: private final static
focal_class.original_string: private final static List<String> s_clientAddressHeaders = Collections
              .unmodifiableList(Arrays.asList("X-Forwarded-For",
                      "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR", "Remote_Addr"));
focal_class.type: List<String>
focal_class.var_name: s_clientAddressHeaders
focal_class.declarator: _apiServer
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      ApiServerService _apiServer;
focal_class.type: ApiServerService
focal_class.var_name: _apiServer
focal_class.declarator: _accountMgr
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      AccountService _accountMgr;
focal_class.type: AccountService
focal_class.var_name: _accountMgr
focal_class.declarator: _entityMgr
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      EntityManager _entityMgr;
focal_class.type: EntityManager
focal_class.var_name: _entityMgr
focal_class.declarator: _managedContext
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      ManagedContext _managedContext;
focal_class.type: ManagedContext
focal_class.var_name: _managedContext
focal_class.declarator: _authManager
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      APIAuthenticationManager _authManager;
focal_class.type: APIAuthenticationManager
focal_class.var_name: _authManager
focal_class.file: cosmic-core/server/src/main/java/com/cloud/api/ApiServlet.java
focal_class.identifier: ApiServlet
focal_class.class_method_signature: ApiServlet.ApiServlet()
focal_class.full_signature: public  ApiServlet()
focal_class.identifier: ApiServlet
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  ApiServlet()
focal_class.class_method_signature: ApiServlet.init(final ServletConfig config)
focal_class.full_signature: @Override public void init(final ServletConfig config)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (final ServletConfig config)
focal_class.return: void
focal_class.signature: void init(final ServletConfig config)
focal_class.class_method_signature: ApiServlet.doGet(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.full_signature: @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.identifier: doGet
focal_class.modifiers: @Override protected
focal_class.parameters: (final HttpServletRequest req, final HttpServletResponse resp)
focal_class.return: void
focal_class.signature: void doGet(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.class_method_signature: ApiServlet.doPost(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.full_signature: @Override protected void doPost(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.identifier: doPost
focal_class.modifiers: @Override protected
focal_class.parameters: (final HttpServletRequest req, final HttpServletResponse resp)
focal_class.return: void
focal_class.signature: void doPost(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.class_method_signature: ApiServlet.processRequest(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.full_signature: private void processRequest(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.identifier: processRequest
focal_class.modifiers: private
focal_class.parameters: (final HttpServletRequest req, final HttpServletResponse resp)
focal_class.return: void
focal_class.signature: void processRequest(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.class_method_signature: ApiServlet.processRequestInContext(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.full_signature:  void processRequestInContext(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.identifier: processRequestInContext
focal_class.parameters: (final HttpServletRequest req, final HttpServletResponse resp)
focal_class.return: void
focal_class.signature: void processRequestInContext(final HttpServletRequest req, final HttpServletResponse resp)
focal_class.class_method_signature: ApiServlet.denyAuthenticationRequest(final HttpServletResponse resp, final StringBuilder auditTrailSb, final String responseType, final Map<String, Object[]> params, final
      HttpSession session)
focal_class.full_signature: private void denyAuthenticationRequest(final HttpServletResponse resp, final StringBuilder auditTrailSb, final String responseType, final Map<String, Object[]> params, final
      HttpSession session)
focal_class.identifier: denyAuthenticationRequest
focal_class.modifiers: private
focal_class.parameters: (final HttpServletResponse resp, final StringBuilder auditTrailSb, final String responseType, final Map<String, Object[]> params, final
      HttpSession session)
focal_class.return: void
focal_class.signature: void denyAuthenticationRequest(final HttpServletResponse resp, final StringBuilder auditTrailSb, final String responseType, final Map<String, Object[]> params, final
      HttpSession session)
focal_class.class_method_signature: ApiServlet.getClientAddress(final HttpServletRequest request)
focal_class.full_signature: static String getClientAddress(final HttpServletRequest request)
focal_class.identifier: getClientAddress
focal_class.modifiers: static
focal_class.parameters: (final HttpServletRequest request)
focal_class.return: String
focal_class.signature: String getClientAddress(final HttpServletRequest request)
focal_class.class_method_signature: ApiServlet.utf8Fixup(final HttpServletRequest req, final Map<String, Object[]> params)
focal_class.full_signature:  void utf8Fixup(final HttpServletRequest req, final Map<String, Object[]> params)
focal_class.identifier: utf8Fixup
focal_class.parameters: (final HttpServletRequest req, final Map<String, Object[]> params)
focal_class.return: void
focal_class.signature: void utf8Fixup(final HttpServletRequest req, final Map<String, Object[]> params)
focal_class.class_method_signature: ApiServlet.getCorrectIPAddress(final String ip)
focal_class.full_signature: private static String getCorrectIPAddress(final String ip)
focal_class.identifier: getCorrectIPAddress
focal_class.modifiers: private static
focal_class.parameters: (final String ip)
focal_class.return: String
focal_class.signature: String getCorrectIPAddress(final String ip)
focal_class.class_method_signature: ApiServlet.decodeUtf8(final String value)
focal_class.full_signature: private String decodeUtf8(final String value)
focal_class.identifier: decodeUtf8
focal_class.modifiers: private
focal_class.parameters: (final String value)
focal_class.return: String
focal_class.signature: String decodeUtf8(final String value)
focal_class.superclass: extends HttpServlet
focal_method.body: static String getClientAddress(final HttpServletRequest request) {
          for (final String header : s_clientAddressHeaders) {
              final String ip = getCorrectIPAddress(request.getHeader(header));
              if (ip != null) {
                  return ip;
              }
          }
  
          return request.getRemoteAddr();
      }
focal_method.class_method_signature: ApiServlet.getClientAddress(final HttpServletRequest request)
focal_method.full_signature: static String getClientAddress(final HttpServletRequest request)
focal_method.identifier: getClientAddress
focal_method.invocations: getCorrectIPAddress getHeader getRemoteAddr
focal_method.modifiers: static
focal_method.parameters: (final HttpServletRequest request)
focal_method.return: String
focal_method.signature: String getClientAddress(final HttpServletRequest request)