Skip to content

Commit

Permalink
Replace use of jetty-server with com.sun.net.httpserver included in j…
Browse files Browse the repository at this point in the history
…dk (#581)

Replace use of jetty-server with com.sun.net.httpserver included in jdk

---------

Co-authored-by: Kumars <[email protected]>
Co-authored-by: Sunjeet Singh <[email protected]>
  • Loading branch information
3 people authored Feb 3, 2023
1 parent 1c868c5 commit 268d63b
Show file tree
Hide file tree
Showing 42 changed files with 1,749 additions and 486 deletions.
3 changes: 3 additions & 0 deletions dependencies.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
5 changes: 0 additions & 5 deletions docs/tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,6 @@ server.join();

The above call to `server.join()` will block forever. While the above code is running, you can point a browser to _http://localhost:8080_ to explore your data.

!!! warning "Jetty: Optional Dependency"
If using the `HollowExplorerUIServer`, you'll need to include a dependency on Jetty. For example, with a Gradle build you may add the dependency:

`compile 'org.eclipse.jetty:jetty-server:9.4.3.v20170317'`

### Explorer Usage

Upon opening your browser, you should see something like this:
Expand Down
2 changes: 1 addition & 1 deletion hollow-diff-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies {
implementation project(':hollow-test')
implementation 'com.google.code.gson:gson:2.8.0'

implementation 'org.eclipse.jetty:jetty-server:9.4.3.v20170317'
implementation "javax.servlet:javax.servlet-api:4.0.1"

testImplementation 'junit:junit:4.11'
}
250 changes: 250 additions & 0 deletions hollow-diff-ui/dependencies.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
{
"checkstyle": {
"com.puppycrawl.tools:checkstyle": {
"locked": "8.45.1"
}
},
"compileClasspath": {
"com.google.code.gson:gson": {
"locked": "2.8.0"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"project": true
},
"com.netflix.hollow:hollow-test": {
"project": true
},
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"javax.servlet:javax.servlet-api": {
"locked": "4.0.1"
},
"org.apache.velocity:velocity": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
}
},
"runtimeClasspath": {
"com.google.code.gson:gson": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.8.0"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-test",
"com.netflix.hollow:hollow-ui-tools"
],
"project": true
},
"com.netflix.hollow:hollow-test": {
"project": true
},
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"commons-io:commons-io": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.6"
},
"javax.servlet:javax.servlet-api": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "4.0.1"
},
"org.apache.velocity:velocity": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
}
},
"testCompileClasspath": {
"com.google.code.gson:gson": {
"locked": "2.8.0"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"project": true
},
"com.netflix.hollow:hollow-test": {
"project": true
},
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"javax.servlet:javax.servlet-api": {
"locked": "4.0.1"
},
"junit:junit": {
"locked": "4.11"
},
"org.apache.velocity:velocity": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
}
},
"testRuntimeClasspath": {
"com.google.code.gson:gson": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.8.0"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-test",
"com.netflix.hollow:hollow-ui-tools"
],
"project": true
},
"com.netflix.hollow:hollow-test": {
"project": true
},
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"commons-io:commons-io": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.6"
},
"javax.servlet:javax.servlet-api": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "4.0.1"
},
"junit:junit": {
"locked": "4.11"
},
"org.apache.velocity:velocity": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
}
},
"toolsCompileClasspath": {
"com.google.code.gson:gson": {
"locked": "2.8.0"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"project": true
},
"com.netflix.hollow:hollow-test": {
"project": true
},
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"javax.servlet:javax.servlet-api": {
"locked": "4.0.1"
},
"junit:junit": {
"locked": "4.11"
},
"org.apache.velocity:velocity": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
}
},
"toolsRuntimeClasspath": {
"com.google.code.gson:gson": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.8.0"
},
"com.netflix.hollow:hollow": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-test",
"com.netflix.hollow:hollow-ui-tools"
],
"project": true
},
"com.netflix.hollow:hollow-test": {
"project": true
},
"com.netflix.hollow:hollow-ui-tools": {
"project": true
},
"commons-codec:commons-codec": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.11"
},
"commons-io:commons-io": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "2.6"
},
"javax.servlet:javax.servlet-api": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "4.0.1"
},
"junit:junit": {
"locked": "4.11"
},
"org.apache.velocity:velocity": {
"firstLevelTransitive": [
"com.netflix.hollow:hollow-ui-tools"
],
"locked": "1.7"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
* limitations under the License.
*
*/
package com.netflix.hollow.ui.jetty;

public class OptionalDependencyException extends RuntimeException {
private static final long serialVersionUID = -6846312004135030988L;
public OptionalDependencyException(String message) { super(message); }
public OptionalDependencyException(String message, Throwable cause) { super(message, cause); }
package com.netflix.hollow.diff.ui;

import com.netflix.hollow.tools.diff.HollowDiff;
import com.netflix.hollow.ui.UIServer;

public interface DiffUIServer extends UIServer {
HollowDiffUI addDiff(String diffPath, HollowDiff diff, String fromBlobName, String toBlobName);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.netflix.hollow.diff.ui;

import com.netflix.hollow.tools.diff.HollowDiff;
import com.netflix.hollow.ui.HollowUIWebServer;
import com.netflix.hollow.ui.HttpHandlerWithServletSupport;

class DiffUIWebServer extends HollowUIWebServer implements DiffUIServer {
private final HollowDiffUIRouter router;

public DiffUIWebServer(HollowDiffUIRouter router, int port) {
super(new HttpHandlerWithServletSupport(router), port);
this.router = router;
}

public HollowDiffUI addDiff(String diffPath, HollowDiff diff, String fromBlobName, String toBlobName) {
return this.router.addDiff(diffPath, diff, fromBlobName, toBlobName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,26 @@ public HollowDiffUIRouter(String baseUrlPath) {
this.diffUIs = new LinkedHashMap<>();
}

public boolean handle(String target, HttpServletRequest req, HttpServletResponse resp) throws IOException {
String diffUIKey = getTargetRootPath(target);
public void handle(String target, HttpServletRequest request, HttpServletResponse response)
throws IOException {
doGet(request, response);
}

@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String diffUIKey = getTargetRootPath(req.getPathInfo());

if("resource".equals(diffUIKey)) {
if(serveResource(req, resp, getResourceName(target)))
return true;
if ("resource".equals(diffUIKey)) {
if (serveResource(req, resp, getResourceName(req.getPathInfo())))
return;
} else {
HollowDiffUI ui = diffUIs.get(diffUIKey);
HollowDiffUI ui = diffUIs.get(diffUIKey);

if(ui != null) {
if(ui.serveRequest(getResourceName(target), req, resp))
return true;
}
if (ui != null) {
if (ui.serveRequest(getResourceName(req.getPathInfo()), req, resp))
return;
}
}

return false;
}

public Map<String, HollowDiffUI> getDiffUIs() {
Expand Down
Loading

0 comments on commit 268d63b

Please sign in to comment.