Join endpoint and path with sensible / behaviour.

@param endpoint the endpoint
@param path the destination (path)
@return the joined endpoint + destination.
543808
public static String join(String endpoint, String path) {
        if (endpoint == null || endpoint.isEmpty())
            return path;
        if (path == null || path.isEmpty())
            return endpoint;

        if (StringUtils.endsWith(endpoint, "/") && path.startsWith("/")) {
            return endpoint + path.substring(1);
        } else if (StringUtils.endsWith(endpoint, "/") ^ path.startsWith("/")) {
            return endpoint + path;
        }
        return endpoint + "/" + path;
    }
199905
public PactDslRequestWithPath path(String path) {
        return new PactDslRequestWithPath(consumerPactBuilder, consumerName, providerName, pactDslWithState.state,
          description, path, requestMethod, requestHeaders, query, requestBody, requestMatchers, requestGenerators,
          defaultRequestValues, defaultResponseValues);
    }
339460
public EndpointOverride getPath(int pathId, String clientUUID, String[] filters) throws Exception {
        EndpointOverride endpoint = null;
        PreparedStatement statement = null;
        ResultSet results = null;

        try (Connection sqlConnection = sqlService.getConnection()) {
            String queryString = this.getPathSelectString();
            queryString += " AND " + Constants.DB_TABLE_PATH + "." + Constants.GENERIC_ID + "=" + pathId + ";";
            statement = sqlConnection.prepareStatement(queryString);
            statement.setString(1, clientUUID);

            results = statement.executeQuery();

            if (results.next()) {
                endpoint = this.getEndpointOverrideFromResultSet(results);
                endpoint.setFilters(filters);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (results != null) {
                    results.close();
                }
            } catch (Exception e) {
            }
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }

        return endpoint;
    }
143410
def rest(path, params)
      endpoints = (params.delete(:only) || [:index, :show, :create, :update, :destroy]).to_a
      endpoints = endpoints - params.delete(:except).to_a
      endpoints.each do |endpoint|
        self.send(('restful_' + endpoint.to_s).to_sym, path, params)
      end
    end
778607
@Override
    public Session connectToServer(Endpoint endpoint, ClientEndpointConfig endpointConfig, URI path) throws DeploymentException, IOException {

        if (endpoint == null || path == null) {
            throw new IllegalArgumentException();
        }
        ClientConnector x = new ClientConnector();
        return x.connectClass(endpoint, path, endpointConfig, this);
    }
895426
@SuppressWarnings("unchecked")
    public <A extends Comparable<?>> ComparablePath<A> get(ComparablePath<A> path) {
        ComparablePath<A> newPath = getComparable(toString(path), (Class<A>) path.getType());
        return addMetadataOf(newPath, path);
    }
764468
def join_path(path):
    """"""

    if isinstance(path, str):
        return path

    return os.path.join(*path)
1201544
@Override
    public Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointConfig endpointConfig, URI path) throws DeploymentException, IOException {

        Object theObject = null;

        if (endpointClass == null || path == null) {
            throw new IllegalArgumentException();
        }

        if (!(Endpoint.class.isAssignableFrom(endpointClass))) {
            DeploymentException e = new DeploymentException("Class " + endpointClass.getName() + " does not extend Endpoint");
            String msg = Tr.formatMessage(tc, "client.invalid.endpointclass", endpointClass.toString(), e.getMessage());
            Tr.error(tc, "client.invalid.endpointclass", endpointClass.toString(), e.getMessage());
            throw new DeploymentException(msg, e);
        }

        ClientConnector x = new ClientConnector();

        try {
            theObject = getEndpointInstance(endpointClass);
        } catch (DeploymentException e) {
            String msg = Tr.formatMessage(tc, "client.connection.error", endpointClass.toString(), e.getMessage());
            Tr.error(tc, "client.connection.error", endpointClass.toString(), e.getMessage());
            throw new DeploymentException(msg, e);
        }

        return x.connectClass(theObject, path, endpointConfig, this);
    }
551518
public static String joinPaths(String prefix, String path, boolean generatedPath) {

		String result = null;
		if (generatedPath) {
			result = joinDomainToPath(prefix, path);
		} else {
			result = joinPaths(prefix, path);
		}
		return result;
	}
68899
@ConfigArg(0)
  public void setPath(PathImpl path)
  {
    if (path.getPath().endsWith(".jar")
        || path.getPath().endsWith(".zip")) {
      path = JarPath.create(path);
    }

    _path = path;
  }
678468
def _create_path(self, *args):
        """"""
        args = filter(None, args)
        path = self.endpoint + '/'.join(args)
        return path
704992
public synchronized void setEndpoint(URI endpoint) {
        checkUpdatable();
        int port = endpoint.getPort();
        if (port==80||port==443) {
            if (MwsUtl.usesStandardPort(endpoint)) {
                try {
                    //some versions of apache http client cause signature errors when
                    //standard port is explicitly used, so remove that case.
                    endpoint = new URI(endpoint.getScheme(), endpoint.getHost(), 
                            endpoint.getPath(), endpoint.getFragment());
                } catch (URISyntaxException e) {
                    throw new IllegalArgumentException(e);
                }
            }
        }
        this.endpoint = endpoint;
    }
57695
@Pure
	@SuppressWarnings("checkstyle:nestedifdepth")
	List<AStarNode<ST, PT>> findPath(AStarNode<ST, PT> startPoint, PT endPoint) {
		final CloseComparator<ST, PT> cComparator = new CloseComparator<>();
		final OpenComparator<ST, PT> oComparatorWithoutRef = new OpenComparator<>();
		final List<AStarNode<ST, PT>> openList = new ArrayList<>();
		final List<AStarNode<ST, PT>> closeList = new ArrayList<>();

		openList.add(startPoint);
		fireNodeOpened(startPoint, openList);

		int idx;
		AStarNode<ST, PT> candidate;
		AStarNode<ST, PT> ocandidate;
		AStarNode<ST, PT> reachableCandidate;
		AStarNode<ST, PT> reachedCandidate;
		PT reachableNode;
		PT node;
		double gCost;
		double h1;
		boolean foundTarget = false;

		while (!foundTarget && !openList.isEmpty()) {

			ocandidate = openList.remove(0);
			fireNodeConsumed(ocandidate, openList);

			candidate = translateCandidate(endPoint, ocandidate);
			foundTarget = candidate == null;

			if (!foundTarget) {
				assert candidate != null;
				node = candidate.getGraphPoint();
				// Update the nodes that are reachable from the current candidate.
				for (final ST segment : candidate.getGraphSegments()) {
					reachableNode = segment.getOtherSidePoint(node);
					if (reachableNode != null && !reachableNode.equals(node)) {
						gCost = candidate.getCost()
								+ computeCostFor(node)
								+ computeCostFor(segment);
						h1 = estimate(reachableNode, endPoint);
						reachableCandidate = newAStarNode(reachableNode, gCost, h1, segment);

						// Reopen node if better cost
						idx = (isClosedNodeReopeningEnabled())
								? ListUtil.indexOf(closeList, cComparator, reachableCandidate)
										: -1;
						if (idx >= 0) {
							reachedCandidate = closeList.get(idx);
							if (gCost < reachedCandidate.getCost()) {
								closeList.remove(idx);
								final AStarNode<ST, PT> nn = node(
										reachableNode,
										gCost,
										h1,
										segment);
								ListUtil.add(
										openList,
										oComparatorWithoutRef,
										nn,
										true, false);
								fireNodeOpened(nn, openList);
							}
						} else {
							idx = openList.indexOf(reachableCandidate);
							if (idx >= 0) {
								// Rearrange open list if better cost
								reachedCandidate = openList.get(idx);
								if ((gCost + h1) < reachedCandidate.getPathCost()) {
									openList.remove(idx);
									final AStarNode<ST, PT> nn = node(
											reachableNode,
											gCost,
											h1,
											segment);
									ListUtil.add(openList,
											oComparatorWithoutRef,
											nn,
											true, false);
									fireNodeReopened(nn, openList);
								}
							} else {
								// Node was neither treated nor seen, add it
								final AStarNode<ST, PT> nn = node(
										reachableNode,
										gCost,
										h1,
										segment);
								ListUtil.add(openList,
										oComparatorWithoutRef,
										nn,
										true, false);
								fireNodeOpened(nn, openList);
							}
						}
					}
				}
			}

			// Refresh the close list
			idx = ListUtil.add(closeList, cComparator, ocandidate, false, true);
			fireNodeClosed(ocandidate, closeList);
			assert idx >= 0;
		}

		return closeList;
	}
883501
public void setEndpoints(java.util.Collection<Endpoint> endpoints) {
        if (endpoints == null) {
            this.endpoints = null;
            return;
        }

        this.endpoints = new java.util.ArrayList<Endpoint>(endpoints);
    }
421681
public String post(String endpoint, String params) throws IOException {
        return this.post(endpoint, params, "");
    }
661563
public OqlBuilder<T> join(final String joinMode, final String path, final String alias) {
    from = concat(from, " ", joinMode, " join ", path, " ", alias);
    return this;
  }
344565
public JoinDescription nested(EntityPath<?>... paths) {
        for (EntityPath<?> path : paths) {
            nested(J.left(path));
        }

        return this;
    }