Skip to content

Commit

Permalink
Use constants instead of hardcoded values
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Pinčuk <alexander.v.pinchuk@gmail.com>
  • Loading branch information
avpinchuk committed Feb 18, 2024
1 parent f0bce2b commit f9a70ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
* Copyright (c) 2023, 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -768,6 +768,7 @@ public class ServerTags {
public static final String ADMIN_CONSOLE_DOWNLOAD_LOCATION = "adminConsoleDownloadLocation";
public static final String IPS_ROOT = "ipsRoot";
public static final String ADMIN_CONSOLE_VERSION = "adminConsoleVersion";
public static final String ADMIN_CONSOLE_STARTUP = "adminConsoleStartup";
public static final String ADMIN_LISTENER_ID = "admin-listener";
public final static String SEC_ADMIN_LISTENER_PROTOCOL_NAME = "sec-admin-listener";
public final static String REDIRECT_PROTOCOL_NAME = "admin-http-redirect";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.sun.enterprise.config.serverbeans.Domain;
import com.sun.enterprise.config.serverbeans.SecureAdmin;
import com.sun.enterprise.config.serverbeans.ServerTags;
import com.sun.enterprise.util.SystemPropertyConstants;
import com.sun.enterprise.v3.admin.AdminConsoleConfigUpgrade;

import jakarta.inject.Inject;
Expand Down Expand Up @@ -61,6 +62,7 @@
import org.glassfish.grizzly.http.server.HttpHandler;
import org.glassfish.grizzly.http.server.Request;
import org.glassfish.grizzly.http.server.Response;
import org.glassfish.grizzly.http.util.HttpStatus;
import org.glassfish.hk2.api.PostConstruct;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.internal.data.ApplicationRegistry;
Expand Down Expand Up @@ -133,7 +135,7 @@ public final class AdminConsoleAdapter extends HttpHandler implements Adapter, P
private static final String STATUS_TOKEN = "%%%STATUS%%%";
private static final String REDIRECT_TOKEN = "%%%LOCATION%%%";
private static final String RESOURCE_PACKAGE = "com/sun/enterprise/v3/admin/adapter";
private static final String INSTALL_ROOT = "com.sun.aas.installRoot";
private static final String INSTALL_ROOT = SystemPropertyConstants.INSTALL_ROOT_PROPERTY;
static final String ADMIN_APP_NAME = ServerEnvironmentImpl.DEFAULT_ADMIN_CONSOLE_APP_NAME;
private volatile boolean isRestStarted;
private volatile boolean isRestBeingStarted;
Expand Down Expand Up @@ -477,7 +479,7 @@ public void event(@RestrictTo(EventTypes.SERVER_READY_NAME) Event<?> event) {
private void init() {
// Get loading option
// FIXME : Use ServerTags, when this is finalized.
Property loadingOptionProperty = adminService.getProperty("adminConsoleStartup");
Property loadingOptionProperty = adminService.getProperty(ServerTags.ADMIN_CONSOLE_STARTUP);
if (loadingOptionProperty != null) {
String loadingOptionValue = loadingOptionProperty.getValue();
if (loadingOptionValue != null) {
Expand Down Expand Up @@ -663,7 +665,7 @@ private synchronized InteractionResult getUserInteractionResult(GrizzlyRequest r
*
*/
private OutputBuffer getOutputBuffer(Response res) {
res.setStatus(202);
res.setStatus(HttpStatus.ACCEPTED_202);
res.setContentType("text/html");
res.setCharacterEncoding("UTF-8");
return res.getOutputBuffer();
Expand Down

0 comments on commit f9a70ec

Please sign in to comment.