Returns true or false depending on whether or not Odo can handle the request for this server/clientUUID pair

@param serverName server Name
@return true if odo can handle, false otherwise
@throws Exception exception
966622
public Boolean canHandleRequest(String serverName) throws Exception {
        // TODO: Future optimizations
        try {
            Profile[] profiles = this.getProfilesForServerName(serverName);
            if (profiles == null) {
                logger.info("No matching profiles found for path");
                return false;
            }
            for (Profile profile : profiles) {
                List<Client> clients = ClientService.getInstance().findAllClients(profile.getId());
                for (Client client : clients) {
                    if (client.getIsActive()) {
                        return true;
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return false;
    }
871019
public void start() throws Exception {
        long startTime = System.currentTimeMillis();

        HandlerCollection handlers = new HandlerCollection();
        addModulesToJetty(handlers);

        // Create the server.
        int serverPort = serverPort();
        System.out.println("**** Starting Server (" + getClass().getSimpleName() + ") on port: " + serverPort);
        server = new Server(serverPort);
        server.setHandler(handlers);
        server.start();
        long endTime = System.currentTimeMillis();
        System.out.println("******* Started in " + (endTime - startTime) + "ms");
    }
498532
def server_enabled(s_name, **connection_args):
    '''
    
    '''
    server = _server_get(s_name, **connection_args)
    return server is not None and server.get_state() == 'ENABLED'
670405
public Boolean serviceName_orderable_feature_GET(String serviceName, OvhOrderableSysFeatureEnum feature) throws IOException {
		String qPath = "/dedicated/server/{serviceName}/orderable/feature";
		StringBuilder sb = path(qPath, serviceName);
		query(sb, "feature", feature);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, Boolean.class);
	}
1169991
protected boolean processUnhandledAction( HttpServletRequest request, HttpServletResponse response, String uri )
            throws IOException, ServletException
    {
        return false;
    }
359748
public synchronized void onServerAvailable(final String id, final String role) {
        logger.debug("[onServerAvailable] id = {}, role = {}", id, role);

        Server server = getServerById(id);
        boolean isMaster = role.equals("master");
        boolean isSlave = role.equals("slave");

        if (server == null) {
            return;
        }

        if (server.isAvailable()) {
            if (server.isMaster() && isMaster) return;
            if (!server.isMaster() && isSlave) return;
        }

        if (isMaster || isSlave) {
            server.setAvailable(true);
            try {
                server.connect();
            }
            catch (Exception e) {
                logger.error("[onServerAvailable]", e);
            }
        }

        server.setAvailable(true);

        if (isMaster) {
            setWriteServer(server);
        }

        refreshServers();
    }
128041
public boolean indexExists(String name) throws IOException {
        CloseableHttpClient client = HttpClients.createDefault();
        HttpHead head = new HttpHead(String.format("http://%s:%d/%s", host, port, name));
        try {
            CloseableHttpResponse response = client.execute(head);
            return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK;
        } finally {
            head.releaseConnection();
        }
    }
235223
public boolean canCheckWar(String warName, String url, HttpClient client) {
    HttpOptions opt = new HttpOptions(url + "/" + warName);
    try {
      HttpResponse response = client.execute(opt);
      if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
        Header allowHeader[] = response.getHeaders("Allow");
        for(Header allow : allowHeader) {
          List<String> values = Arrays.asList(allow.getValue().toUpperCase().split(","));
          if(values.contains("GET")) {
            return true;
          }
        }
      }
      EntityUtils.consumeQuietly(response.getEntity());
    } catch (Exception e) {
      log.warn("Failed to check if endpoint exists.", e);
    } finally {
      opt.releaseConnection();
    }
    return false;
  }
430613
@Override
  public boolean loginHandler(String target, HttpServletRequest request, HttpServletResponse response) throws IOException {
    if (! isLoginTarget(target)) {
      return false;
    }

    if (isPageRequest(request)) {
      sendLoginForm(request, response);
    } else {
      ServletUtils.sendResponseError(response, HttpServletResponse.SC_UNAUTHORIZED, "Access denied. Please login.");
    }
    return true;
  }
876644
public boolean canPing() {
        val uidPsw = getClass().getSimpleName();
        for (val server : this.servers) {
            LOGGER.debug("Attempting to ping RADIUS server [{}] via simulating an authentication request. If the server responds "
                + "successfully, mock authentication will fail correctly.", server);
            try {
                server.authenticate(uidPsw, uidPsw);
            } catch (final TimeoutException | SocketTimeoutException e) {
                LOGGER.debug("Server [{}] is not available", server);
                continue;
            } catch (final Exception e) {
                LOGGER.debug("Pinging RADIUS server was successful. Response [{}]", e.getMessage());
            }
            return true;
        }
        return false;
    }
975391
def _handle_exception(self, exception):
        """"""
        try:
            return super(WebSocketRpcRequest, self)._handle_exception(exception)
        except Exception:
            if not isinstance(exception, (odoo.exceptions.Warning, odoo.http.SessionExpiredException, odoo.exceptions.except_orm)):
                _logger.exception("Exception during JSON request handling.")
            error = {
                    'code': 200,
                    'message': "Odoo Server Error",
                    'data': odoo.http.serialize_exception(exception)
            }
            if isinstance(exception, odoo.http.AuthenticationError):
                error['code'] = 100
                error['message'] = "Odoo Session Invalid"
            if isinstance(exception, odoo.http.SessionExpiredException):
                error['code'] = 100
                error['message'] = "Odoo Session Expired"
            return self._json_response(error=error)
1018965
public function isSelfDomain($throw = false)
    {
        if (!$domains = $this->allowDomains) {
            return true;
        }

        if (!in_array(strtolower($_SERVER['SERVER_NAME']), $domains, true) ||
            !in_array(strtolower($_SERVER['HTTP_HOST']), $domains, true)
        ) {
            if ($throw === true) {
                throw new RequestException("Invalid domain: {$_SERVER['HTTP_HOST']}");
            } else {
                if (class_exists('\rock\log\Log')) {
                    $message = BaseException::convertExceptionToString(new RequestException("Invalid domain: {$_SERVER['HTTP_HOST']}"));
                    Log::err($message);
                }
            }

            return false;
        }

        return true;
    }
528875
public boolean handshake(RequestBaratine request)
    throws Exception
  {
    Objects.requireNonNull(request);

    _request = request;

    RequestBaratineImpl req = (RequestBaratineImpl) request;
    //ResponseBaratineImpl res = (ResponseBaratineImpl) response;

    if (log.isLoggable(Level.FINE)) {
      log.fine(this + " upgrade HTTP to WebSocket");
    }

    String method = req.method();
    // String uri = req.uri();

    if (! "GET".equals(method)) {
      req.halt(METHOD_NOT_ALLOWED);

      throw new IllegalStateException(L.l("HTTP Method must be 'GET', because the WebSocket protocol requires 'GET'.\n  remote-IP: {0}",
                                          req.ip()));
    }

    String connection = req.header("Connection");
    String upgrade = req.header("Upgrade");

    if (! "websocket".equalsIgnoreCase(upgrade)) {
      req.halt(HttpStatus.BAD_REQUEST);

      throw new IllegalStateException(L.l("HTTP Upgrade header '{0}' must be 'WebSocket', because the WebSocket protocol requires an Upgrade: WebSocket header.\n  remote-IP: {1}",
                                          upgrade,
                                          req.ip()));
    }

    if (connection == null
        || connection.toLowerCase().indexOf("upgrade") < 0) {
      req.halt(HttpStatus.BAD_REQUEST);

      throw new IllegalStateException(L.l("HTTP Connection header '{0}' must be 'Upgrade', because the WebSocket protocol requires a Connection: Upgrade header.\n  remote-IP: {1}",
                                          connection,
                                          req.ip()));
    }

    String key = req.header("Sec-WebSocket-Key");

    if (key == null) {
      req.halt(HttpStatus.BAD_REQUEST);

      throw new IllegalStateException(L.l("HTTP Sec-WebSocket-Key header is required, because the WebSocket protocol requires an Origin header.\n  remote-IP: {0}",
                                          req.ip()));
    }
    else if (key.length() != 24) {
      req.halt(HttpStatus.BAD_REQUEST);

      throw new IllegalStateException(L.l("HTTP Sec-WebSocket-Key header is invalid '{0}' because it's not a 16-byte value.\n  remote-IP: {1}",
                                          key,
                                          req.ip()));
    }

    String version = req.header("Sec-WebSocket-Version");

    String requiredVersion = WebSocketConstants.VERSION;
    if (! requiredVersion.equals(version)) {
      req.halt(HttpStatus.BAD_REQUEST);

      throw new IllegalStateException(L.l("HTTP Sec-WebSocket-Version header with value '{0}' is required, because the WebSocket protocol requires an Sec-WebSocket-Version header.\n  remote-IP: {1}",
                                          requiredVersion,
                                          req.ip()));
    }

    String extensions = req.header("Sec-WebSocket-Extensions");
    boolean isMasked = true;

    if (extensions != null && extensions.indexOf("x-unmasked") >= 0) {
      isMasked = false;
    }

    ArrayList<String> serverExtensionList = new ArrayList<String>();

    if (! isMasked) {
      serverExtensionList.add("x-unmasked");
    }

    req.status(HttpStatus.SWITCHING_PROTOCOLS);//, "Switching Protocols");
    req.header("Upgrade", "websocket");
    req.header("Connection", "Upgrade");

    String accept = calculateWebSocketAccept(key);

    req.header("Sec-WebSocket-Accept", accept);

    if (serverExtensionList.size() > 0) {
      StringBuilder sb = new StringBuilder();

      for (int i = 0; i < serverExtensionList.size(); i++) {
        if (i > 0)
          sb.append(", ");

        sb.append(serverExtensionList.get(i));
      }

      req.header("Sec-WebSocket-Extensions", sb.toString());
    }

    req.length(0);

    FrameIn fIs;

    fIs = new FrameIn();

    // _fIs = fIs;

    fIs.init(null, req.requestHttp().connTcp().readStream());

    frameInput(fIs);

    // Endpoint endpoint = _endpointSkeleton.newEndpoint(_factory, paths);
    // Endpoint endpoint = wsCxt.getFactory().get();

    //WebSocketBaratine wsConn = null;;

    ConnectionWebSocketBaratine connWs
      = new ConnectionWebSocketBaratine(this,
                                     req.requestHttp());

    // order for duplex
    req.upgrade(connWs);

    req.flush();

    _outProxy = req.connHttp().outProxy();

    _outWriter = new OutWebSocketWriter();
    _service.open(this);

    ServiceRef.flushOutbox();

    return true;
  }
14527
public static boolean isRetryableServiceException(SdkBaseException exception) {
        return isAse(exception) && RETRYABLE_STATUS_CODES.contains(toAse(exception).getStatusCode());
    }
474606
private boolean handleException(final Throwable t,
                                  final HttpServletResponse resp,
                                  final boolean serverError) {
    if (serverError) {
      return true;
    }

    try {
      error(t);
      sendError(t, resp);
      return true;
    } catch (Throwable t1) {
      // Pretty much screwed if we get here
      return true;
    }
  }
600839
@Override
  public void onConnect(URI serverHost) throws IOException {
    if (!StringUtils.isEmpty(accessToken)) {
      return; //No need to be called if accessToken is active.
    }

    try {
      getLog().info("Getting Oauth2 access token.");
      OAuthClientRequest request = OAuthClientRequest.tokenLocation(serverHost.toString())
          .setGrantType(GrantType.PASSWORD)
          .setClientId(clientId)
          .setClientSecret(clientSecret)
          .setUsername(userId)
          .setPassword(password + securityToken).buildQueryMessage();
      OAuthClient client = new OAuthClient(new URLConnectionClient());
      OAuthJSONAccessTokenResponse response = client.accessToken(request, OAuth.HttpMethod.POST);

      accessToken = response.getAccessToken();
      setCurServerHost(new URI(response.getParam("instance_url")));
    } catch (OAuthProblemException e) {
      throw new NonTransientException("Error while authenticating with Oauth2", e);
    } catch (OAuthSystemException e) {
      throw new RuntimeException("Failed getting access token", e);
    } catch (URISyntaxException e) {
      throw new RuntimeException("Failed due to invalid instance url", e);
    }
  }
929404
public static boolean isRequestEntityTooLargeException(SdkBaseException exception) {
        return isAse(exception) && toAse(exception).getStatusCode() == HttpStatus.SC_REQUEST_TOO_LONG;
    }