-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JBIDE-21994 - Cannot show OpenShift 3 application via live reload
Using the server.getHost() method now that it's set to an actual route for OS servers Calling the IURLProvider delegate on the given IServer to get the module context root when building the URL to invoke from the browser, via the LiveReload proxy Also fixed 'core' dependencies, removing some 'ui' bundles
- Loading branch information
Showing
12 changed files
with
277 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
....tools.livereload.core/src/org/jboss/tools/livereload/core/internal/util/PathBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.jboss.tools.livereload.core.internal.util; | ||
|
||
/** | ||
* Convenient utility class to build URL path and make sure {@code /} separators | ||
* are properly handled. | ||
*/ | ||
public class PathBuilder { | ||
|
||
private final StringBuilder path = new StringBuilder(); | ||
|
||
/** | ||
* Constructor helper | ||
* @param pathFragment the initial path fragment to begin with | ||
* @return a new instance of the {@link PathBuilder} | ||
*/ | ||
public static PathBuilder from(final String pathFragment) { | ||
final PathBuilder pathBuilder = new PathBuilder(); | ||
return pathBuilder.path(pathFragment); | ||
} | ||
|
||
/** | ||
* Adds the given {@code pathFragment} to the current path, while making | ||
* sure that a single {@code '/'} character is used to separate the given | ||
* {@code pathFragment} from the previous ones. | ||
* | ||
* @param pathFragment | ||
* @return this {@link PathBuilder} | ||
*/ | ||
public PathBuilder path(final String pathFragment) { | ||
if (pathFragment == null) { | ||
return this; | ||
} | ||
if (!pathFragment.startsWith("/")) { | ||
if (!currentPathEndsWith('/')) { | ||
this.path.append("/").append(pathFragment); | ||
} else if (currentPathEndsWith('/')) { | ||
this.path.append(pathFragment); | ||
} | ||
} else { | ||
if (!currentPathEndsWith('/')) { | ||
this.path.append(pathFragment); | ||
} else if (currentPathEndsWith('/') && pathFragment.length() > 1) { | ||
this.path.append(pathFragment.substring(1)); | ||
} else if (this.path.toString().length() == 0) { | ||
this.path.append(pathFragment); | ||
} | ||
} | ||
return this; | ||
} | ||
|
||
private boolean currentPathEndsWith(final char lastChar) { | ||
return this.path.length() > 0 && this.path.charAt(this.path.length() - 1) == lastChar; | ||
} | ||
|
||
/** | ||
* @return a {@link String} representation of the Path | ||
*/ | ||
public String build() { | ||
return this.path.toString(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.