| <!-- | |
| Copyright (c) 2009, 2018 Oracle 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 | |
| --> | |
| <!-- enableSecurityAdmin.jsf --> | |
| <!initPage | |
| setResourceBundle(key="i18nc" bundle="org.glassfish.common.admingui.Strings") | |
| setResourceBundle(key="help_common" bundle="org.glassfish.common.admingui.Helplinks"); | |
| /> | |
| <!composition template="/templates/default.layout" guiTitle="$resource{i18nc.domainLogs.PageTitle}" | |
| guiOnLoad="admingui.nav.selectTreeNodeWithURL('#{request.contextPath}/common/appServer/serverInstDomainAttrs.jsf');"> | |
| <!define name="content"> | |
| <sun:form id="form"> | |
| #include "/common/appServer/domainTabs.inc" | |
| #include "/common/shared/alertMsg.inc" | |
| <!-- Page Title --> | |
| <sun:title id="propertyContentPage" title="$resource{i18nc.domainLogs.PageTitle}" helpText="$resource{i18nc.domainLogs.PageHelp}"> | |
| <!facet pageButtonsTop> | |
| <sun:panelGroup id="topButtons"> | |
| <sun:button id="collectLogFiles" text="$resource{i18n.button.collectLogFiles}" | |
| onClick="return download(event);" > | |
| </sun:button> | |
| </sun:panelGroup> | |
| </facet> | |
| </sun:title> | |
| <sun:hidden id="targetName" name="targetName" value="#{targetName}"> | |
| <!afterCreate | |
| getClientId(component="$this{component}" clientId=>$page{targetNameId}); | |
| /> | |
| </sun:hidden> | |
| <sun:propertySheet id="propertySheetLogResults"> | |
| <sun:propertySheetSection id="propertSectionLogResults"> | |
| <sun:property id="clusterProp" labelAlign="left" noWrap="true" overlapLabel="false" rendered="#{requestScope.clusters.size() != 0}"> | |
| <sun:radioButton | |
| id="clusterRB" | |
| label="$resource{i18n.common.Cluster}" | |
| name="targetType" | |
| selected="#{targetType}" | |
| selectedValue="cluster" | |
| onChange="$('#{targetNameId}').value = $('#{clusterNameId}').value"/> | |
| <sun:dropDown id="clusterDropDown" selected="#{clusterName}" labels="#{requestScope.clusters}" submitForm="true"> | |
| <!afterCreate | |
| getClientId(component="$this{component}" clientId=>$page{clusterNameId}); | |
| /> | |
| <!beforeCreate | |
| /* Get the cluster list */ | |
| gf.restRequest( | |
| endpoint="#{sessionScope.REST_URL}/clusters/cluster.json" | |
| method="GET" | |
| result="#{requestScope.resp}"); | |
| setAttribute(key="clusters" value="#{requestScope.resp.data.extraProperties.childResources}"); | |
| gf.getMapKeys(Map="#{requestScope.resp.data.extraProperties.childResources}" Keys="#{requestScope.clusters}" ); | |
| /> | |
| <!command | |
| setAttribute(key="targetType" value="cluster"); | |
| setAttribute(key="targetName" value="$attribute{clusterName}"); | |
| gf.navigate(page="#{request.contextPath}/common/appServer/domainLogs.jsf"); | |
| /> | |
| </sun:dropDown> | |
| </sun:property> | |
| <sun:property id="instanceProp" labelAlign="left" noWrap="true" overlapLabel="false"> | |
| <sun:radioButton | |
| id="instanceRB" | |
| name="targetType" | |
| label="$resource{i18n.common.Instance}" | |
| selected="#{targetType}" | |
| selectedValue="instance" | |
| onChange="$('#{targetNameId}').value = $('#{instanceNameId}').value" /> | |
| <sun:dropDown id="instanceDropDown" name="instanceName" selected="#{instanceName}" labels="#{requestScope.servers}" submitForm="true"> | |
| <!afterCreate | |
| getClientId(component="$this{component}" clientId=>$page{instanceNameId}); | |
| /> | |
| <!beforeCreate | |
| /* Get the server list */ | |
| gf.listInstances(optionKeys={"standaloneonly"} optionValues={"true"}, instances="#{requestScope.servers}" ); | |
| listAdd(list="#{requestScope.servers}", value="server" index="0"); | |
| if ($attribute{targetType}=#{null}) { | |
| setAttribute(key="targetType" value="instance"); | |
| setAttribute(key="targetName" value="server"); | |
| } | |
| /> | |
| <!command | |
| setAttribute(key="targetType" value="instance"); | |
| setAttribute(key="targetName" value="$attribute{instanceName}"); | |
| gf.navigate(page="#{request.contextPath}/common/appServer/domainLogs.jsf"); | |
| /> | |
| </sun:dropDown> | |
| </sun:property> | |
| </sun:propertySheetSection> | |
| </sun:propertySheet> | |
| <sun:hidden id="helpKey" value="$resource{help_common.serverInstDomainLogs}" /> | |
| </sun:form> | |
| <f:verbatim> | |
| <script type="text/javascript"> | |
| function download(event) { | |
| if (event.preventDefault) { | |
| event.preventDefault(); | |
| } | |
| var url = '#{request.contextPath}/download/log-files-' + $('#{targetNameId}').value + '.zip?contentSourceId=LogFiles&target=' + $('#{targetNameId}').value + '&restUrl=#{sessionScope.REST_URL}'; | |
| if(location.protocol != 'https:' && | |
| navigator.appName.indexOf("Internet Explorer") != -1 && | |
| navigator.appVersion.indexOf("MSIE 10") != -1) { | |
| // bug#16542371 IE10 is super secure. Because of https community page, it throws | |
| // SEC7111: HTTPS security is compromised by http://localhost:4848/download/log-files-server.zip?contentSourceId=LogFiles&target=server&restUrl=http://localhost:4848/management/domainindex.jsf | |
| // and then iframe is loaded with res:// page, so it throws | |
| // SCRIPT5: Access is denied | |
| // for iframe.contentWindow | |
| // thus GLASSFISH-17921 is not fixed for the case, let user see raw 500 error, if any. | |
| window.location = url; | |
| } else { | |
| var iframe = $('download'); | |
| iframe.src = url; | |
| setTimeout(function() { | |
| var doc = iframe.contentWindow.document; | |
| var matches = doc.body.innerHTML.match('Exception: (.+)?</pre>'); | |
| if (matches) { | |
| matches = matches[1].match('Exception: (.+)$') || matches; | |
| alert(matches[1]); | |
| } | |
| }, 1000); | |
| return false; | |
| } | |
| } | |
| </script> | |
| <iframe id="download" src="#" style="display: none"></iframe> | |
| </f:verbatim> | |
| </define> | |
| </composition> | |