Skip to content

Commit

Permalink
Merge pull request #24151 from avpinchuk/ccx-fix-admingui
Browse files Browse the repository at this point in the history
Fix AdminGUI for GF7
  • Loading branch information
dmatej committed Nov 4, 2022
2 parents 4152739 + 3a6f53b commit 2daba85
Show file tree
Hide file tree
Showing 24 changed files with 204 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -38,6 +39,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import com.sun.jsftemplating.el.PageSessionResolver;
import org.glassfish.admingui.common.tree.FilterTreeEvent;
import org.glassfish.admingui.common.util.GuiUtil;
import org.glassfish.admingui.common.util.MiscUtil;
Expand Down Expand Up @@ -612,7 +614,7 @@ public static void setPartialRequest(HandlerContext context) {
* <p> This handler is different than JSFT's default navigate handler in
* that it forces the request to NOT be a "partial request". The
* effect is that no wrapping of the response will be done. This is
* normally done in JSF2 in order to work with the jsf.js JS code
* normally done in JSF2 in order to work with the faces.js JS code
* that handles the response. In the Admin Console, we typically do
* not use this JS, so this is not desirable behavior.</p>
*
Expand Down Expand Up @@ -825,9 +827,9 @@ public static List filterAdminObjects(HandlerContext context) {
private static String handleBareAttribute(FacesContext ctx, String url) {
// Get Page Session...
UIViewRoot root = ctx.getViewRoot();
Map<String, Serializable> pageSession = null; // PageSessionResolver.getPageSession(ctx, root);
Map<String, Serializable> pageSession = PageSessionResolver.getPageSession(ctx, root);
if (pageSession == null) {
pageSession = createPageSession(ctx, root); // PageSessionResolver.createPageSession(ctx, root);
pageSession = PageSessionResolver.createPageSession(ctx, root);
}
String request = ctx.getExternalContext().getRequestParameterMap().get("bare");
if (request != null) {
Expand All @@ -851,26 +853,6 @@ private static String handleBareAttribute(FacesContext ctx, String url) {
return url;
}

/**
* <p>
* This method will create a new "page session" <code>Map</code>. It will overwrite any existing "page session"
* <code>Map</code>, so be careful.
* </p>
*/
public static Map<String, Serializable> createPageSession(FacesContext ctx, UIViewRoot root) {
if (root == null) {
root = ctx.getViewRoot();
}
// Create it...
Map<String, Serializable> map = new HashMap<>(4);

// Store it...
root.getAttributes().put("_ps", map);

// Return it...
return map;
}

/**
* Add the name/value pair to the given url.
* @param url
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -178,7 +179,7 @@ public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject
} catch (MalformedURLException ex) {
throw new IllegalArgumentException("Unable to parse REST URL: (" + restURL + ")", ex);
}
session.setAttribute(REST_SERVER_NAME, savedClientSubject);
session.setAttribute(REST_SERVER_NAME, url.getHost());
session.setAttribute(REST_SERVER_PORT, url.getPort());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!--

Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -34,7 +35,7 @@
/>
<sun:html id="html2">
<sun:head id="propertyhead" title="JVM Report" javaScript="true" debug="false" parseOnLoad="false">
<h:outputScript name="jsf.js" library="jakarta.faces" target="head" />
<h:outputScript name="faces.js" library="jakarta.faces" target="head" />
<sun:script url="/resource/common/js/adminjsf.js" />

</sun:head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--

Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -27,7 +27,7 @@
<sun:html id="html1">
<sun:head title="$resource{i18n.restart.pageTitle}" parseOnLoad="false">
<sun:link url="/resource/css/css_ns6up.css" />
<h:outputScript name="jsf.js" library="jakarta.faces" target="body" />
<h:outputScript name="faces.js" library="jakarta.faces" target="body" />
<sun:script>
<f:verbatim>
function triggerRestart() {
Expand All @@ -37,7 +37,7 @@
render: '@none'
};
options[button.id] = button.id;
jsf.ajax.request(button, null, options);
faces.ajax.request(button, null, options);
}
</f:verbatim>
</sun:script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!--

Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand All @@ -25,7 +26,7 @@
<sun:html id="html1">
<sun:head title="$resource{i18n.shutdown.pageTitle}" parseOnLoad="false">
<sun:link url="/resource/css/css_ns6up.css" />
<h:outputScript name="jsf.js" library="jakarta.faces" target="body" />
<h:outputScript name="faces.js" library="jakarta.faces" target="body" />
<sun:script>
<f:verbatim>
function triggerShutdown() {
Expand All @@ -36,7 +37,7 @@
};

options[button.id] = button.id;
jsf.ajax.request(button, null, options);
faces.ajax.request(button, null, options);

}
</f:verbatim>
Expand Down
3 changes: 2 additions & 1 deletion appserver/admingui/common/src/main/resources/help/help.jsf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!--

Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -32,7 +33,7 @@
<sun:head title="$resource{i18n.helpWindowTitle}" debug="false" parseOnLoad="false">
<sun:link url="/resource/common/help/help.css" />
<sun:script url="/resource/common/js/adminjsf.js" />
<h:outputScript name="jsf.js" library="jakarta.faces" target="head" />
<h:outputScript name="faces.js" library="jakarta.faces" target="head" />
</sun:head>
<sun:body id="bodyTag" style="display:none;" onLoad="admingui.help.fixTreeOnclick(document.getElementById('tocTree')); admingui.help.fixTreeOnclick(document.getElementById('indexTree')); admingui.help.loadHelpPageFromContextRef('#{pageSession.contextRef}', 'helpContent'); document.getElementById('bodyTag').style.display='block';">
"<div id="menuContent" class="helpMenuBox">
Expand Down
15 changes: 8 additions & 7 deletions appserver/admingui/common/src/main/resources/js/adminjsf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
* Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -585,7 +586,7 @@ admingui.nav = {
requestTreeUpdate: function(source, event, nodeId, params, previousState) {
// Ping header to make sure header stays "fresh"
admingui.ajax.pingHeader();
jsf.ajax.request(source, event, {
faces.ajax.request(source, event, {
execute: "treeForm treeForm:update",
render: nodeId + " " + nodeId + "_children",
onevent: function(data) {
Expand Down Expand Up @@ -1086,7 +1087,7 @@ admingui.help = {

// launch the request
// Note: in help window, don't ping -- only 1 JSF page
jsf.ajax.request(tabElement, null, props);
faces.ajax.request(tabElement, null, props);

//
// Use DOM to show/hide the proper tree
Expand Down Expand Up @@ -2297,7 +2298,7 @@ admingui.ajax = {
}
// Ping header to make sure header stays "fresh"
admingui.ajax.pingHeader();
jsf.ajax.request(component, null, params);
faces.ajax.request(component, null, params);
},

defaultGetCallback: function(xmlReq, target, url) {
Expand Down Expand Up @@ -2373,7 +2374,7 @@ admingui.ajax = {
result = node.textContent;
}
if (node.getAttribute('id') === 'jakarta.faces.ViewState') {
// NOTE: see jsf.ajax.doUpdate for more info....
// NOTE: see faces.ajax.doUpdate for more info....
viewState = node.firstChild;
}
}
Expand Down Expand Up @@ -2585,7 +2586,7 @@ admingui.ajax = {
if (typeof(async) === 'undefined') {
async = true;
}
if (!(typeof(jsf) === 'undefined') && !(typeof(jsf.ajax) === 'undefined')) {
if (!(typeof(faces) === 'undefined') && !(typeof(faces.ajax) === 'undefined')) {
// Warp user's function to make easier to use
var func = function(data) {
if (data.status === 'success') {
Expand All @@ -2608,7 +2609,7 @@ admingui.ajax = {
alert("'execButton' not found! Unable to submit JSF2 Ajax Request!");
} else {
// Don't ping b/c this is from the header and therefor is a ping
jsf.ajax.request(src, null,
faces.ajax.request(src, null,
{
execute: 'execButton',
render: 'execResp',
Expand Down Expand Up @@ -2648,7 +2649,7 @@ admingui.ajax = {
execute: '@none',
render: '@none'
};
jsf.ajax.request(src, null, options);
faces.ajax.request(src, null, options);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!--

Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -121,7 +122,7 @@
</ui:event>
<sun:html id="html2">
<sun:head id="propertyhead" title="$resource{i18nc.logViewer.PageTitle}" debug="false" parseOnLoad="false">
<h:outputScript name="jsf.js" library="jakarta.faces" target="head" />
<h:outputScript name="faces.js" library="jakarta.faces" target="head" />
<sun:script url="/resource/common/js/adminjsf.js" />
</sun:head>
<sun:body onLoad="javascript: checkHiddenElements(); setFocusTableResults('#{hasResults}');" id="body3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!--

Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -36,7 +37,7 @@
</ui:event>
<sun:html id="html2">
<sun:head id="propertyhead" title="$resource{i18nc.logViewerRaw.PageTitle}" debug="false" parseOnLoad="false">
<h:outputScript name="jsf.js" library="jakarta.faces" target="head" />
<h:outputScript name="faces.js" library="jakarta.faces" target="head" />
<sun:script url="/resource/common/js/adminjsf.js" />
</sun:head>
<sun:body onLoad="javascript: logViewerRaw('/download/log/?contentSourceId=LogViewer&start=0&instanceName=#{pageSession.encodedInstanceName}&restUrl=' + encodeURIComponent('#{sessionScope.REST_URL}'))" id="body3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!--
Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -41,7 +42,7 @@
getPreference(default="#{false}", root="glassfish/layout", key="hideRight", value="#{sessionScope.hideRight}");
</ui:event>
<sun:head id="head" title="#{guiTitle}" javaScript="true" debug="false" parseOnLoad="false">
<h:outputScript name="jsf.js" library="jakarta.faces" target="head" />
<h:outputScript name="faces.js" library="jakarta.faces" target="head" />
<f:verbatim>
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/yui/reset-fonts-grids.css"/>
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/yui/assets/skins/sam/resize.css"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!--

Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand All @@ -26,7 +27,7 @@
setPartialRequest("false");
</ui:event>
<sun:head title="#{guiTitle}" javaScript="true" debug="false" parseOnLoad="false">
<h:outputScript name="jsf.js" library="jakarta.faces" target="head" />
<h:outputScript name="faces.js" library="jakarta.faces" target="head" />
<sun:script url="/resource/common/js/adminjsf.js" />
<!insert name="guiTemplateExtraHead" />
<!insert name="guiExtraHead" />
Expand Down
13 changes: 12 additions & 1 deletion appserver/admingui/war/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -132,7 +133,17 @@
<archive>
<manifestEntries>
<Glassfish-require-services>org.glassfish.api.admingui.ConsoleProvider</Glassfish-require-services>
<HK2-Import-Bundles>org.glassfish.main.admingui.console-common,org.glassfish.hk2.hk2,org.glassfish.main.admingui.console-plugin-service, jakarta.servlet-api, jakarta.servlet.jsp-api, jakarta.el-api, org.glassfish.jakarta.el, org.glassfish.jsftemplating, org.glassfish.main.admingui.dataprovider</HK2-Import-Bundles>
<HK2-Import-Bundles>
org.glassfish.main.admingui.console-common,
org.glassfish.hk2.hk2,
org.glassfish.main.admingui.console-plugin-service,
jakarta.servlet-api,
jakarta.servlet.jsp-api,
jakarta.el-api,
org.glassfish.expressly,
org.glassfish.jsftemplating,
org.glassfish.main.admingui.dataprovider
</HK2-Import-Bundles>
</manifestEntries>
</archive>
</configuration>
Expand Down
26 changes: 26 additions & 0 deletions appserver/admingui/war/src/main/webapp/WEB-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>


<!--
Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->

<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
bean-discovery-mode="all"
version="4.0">

</beans>
24 changes: 5 additions & 19 deletions appserver/admingui/war/src/main/webapp/WEB-INF/faces-config.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
Expand All @@ -17,10 +17,11 @@
-->

<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
<faces-config
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2">
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd"
version="4.0">

<application>
<locale-config>
Expand Down Expand Up @@ -57,21 +58,6 @@
</render-kit>
-->

<!--
<managed-bean>
<description></description>
<managed-bean-name>DropDown</managed-bean-name>
<managed-bean-class>com.sun.enterprise.tools.admingui.jsf.backingbean.DropDown</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
-->
<managed-bean>
<description></description>
<managed-bean-name>JavaHelpBean</managed-bean-name>
<managed-bean-class>com.sun.webui.jsf.bean.HelpBackingBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

<render-kit>
<!--
<renderer>
Expand Down
Loading

0 comments on commit 2daba85

Please sign in to comment.