Skip to content

Commit

Permalink
fix indent
Browse files Browse the repository at this point in the history
  • Loading branch information
shruti0085 committed Sep 26, 2024
1 parent eea4463 commit e30066e
Showing 1 changed file with 32 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,52 +110,53 @@ private void setupAuthStatusListeners() {
AuthUtils.addAuthStatusChangeListener(amazonQCommonActions.getFeedbackDialogContributionAction());
}

/**
* Sets up virtual host mapping for the given path using jetty server
* @param jsPath
* @return server launched
*/
protected Server setupVirtualServer(String jsPath) {
Server server = null;
try {
server = new Server(0);
var servletContext = new ContextHandler();
servletContext.setContextPath("/");
servletContext.addVirtualHosts(new String[]{"localhost"});

var handler = new ResourceHandler();

ResourceFactory resourceFactory = ResourceFactory.of(server);
handler.setBaseResource(resourceFactory.newResource(jsPath));
handler.setDirAllowed(true);
servletContext.setHandler(handler);

server.setHandler(servletContext);
/**
* Sets up virtual host mapping for the given path using jetty server
*
* @param jsPath
* @return server launched
*/
protected Server setupVirtualServer(String jsPath) {
Server server = null;
try {
server = new Server(0);
var servletContext = new ContextHandler();
servletContext.setContextPath("/");
servletContext.addVirtualHosts(new String[] { "localhost" });

var handler = new ResourceHandler();

ResourceFactory resourceFactory = ResourceFactory.of(server);
handler.setBaseResource(resourceFactory.newResource(jsPath));
handler.setDirAllowed(true);
servletContext.setHandler(handler);

server.setHandler(servletContext);
server.start();

return server;

} catch (Exception e) {
stopVirtualServer(server);
PluginLogger.error("Error occurred while attempting to start a virtual server for " + jsPath, e);
return null;
}
}
}

protected void stopVirtualServer(Server server) {
if(server != null) {
try {
protected void stopVirtualServer(Server server) {
if (server != null) {
try {
server.stop();
} catch (Exception e) {
} catch (Exception e) {
PluginLogger.error("Error occurred when attempting to stop the virtual server", e);
}
}
}
}

@Override
public final void setFocus() {
public final void setFocus() {
browser.setFocus();
}
}

/**
* Disposes of the resources associated with this view.
Expand Down

0 comments on commit e30066e

Please sign in to comment.