Skip to content

Commit

Permalink
Merge branch 'master' into new-header
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik authored Feb 8, 2025
2 parents dbb67ca + 72d2b7b commit 2fdb00b
Show file tree
Hide file tree
Showing 38 changed files with 65 additions and 62 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ public static String joinPath(String... components) {
*/
public static @CheckForNull String getConsoleUrl(WithConsoleUrl withConsoleUrl) {
String consoleUrl = withConsoleUrl.getConsoleUrl();
return consoleUrl != null ? Stapler.getCurrentRequest().getContextPath() + '/' + consoleUrl : null;
return consoleUrl != null ? Stapler.getCurrentRequest2().getContextPath() + '/' + consoleUrl : null;

Check warning on line 1992 in core/src/main/java/hudson/Functions.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 1992 is only partially covered, one branch is missing
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/console/ConsoleUrlProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ default Descriptor<ConsoleUrlProvider> getDescriptor() {
* @return the URL for the console for the specified build, relative to the web server root
*/
static @NonNull String getRedirectUrl(Run<?, ?> run) {
return Stapler.getCurrentRequest().getContextPath() + '/' + run.getConsoleUrl();
return Stapler.getCurrentRequest2().getContextPath() + '/' + run.getConsoleUrl();
}

static List<ConsoleUrlProvider> all() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

/**
* Configures check interval for computer retention.
Expand Down Expand Up @@ -56,7 +56,7 @@ private void setComputerRetentionCheckInterval(int interval) throws IllegalArgum
}

@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
public boolean configure(StaplerRequest2 req, JSONObject json) throws FormException {
try {
final int interval = json.getInt("computerRetentionCheckInterval");
setComputerRetentionCheckInterval(interval);
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/model/GlobalConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public String getGlobalConfigPage() {
@Override
public boolean configure(StaplerRequest2 req, JSONObject json) throws FormException {
if (Util.isOverridden(GlobalConfiguration.class, getClass(), "configure", StaplerRequest.class, JSONObject.class)) {
return configure(StaplerRequest.fromStaplerRequest2(req), json);
return configure(req != null ? StaplerRequest.fromStaplerRequest2(req) : null, json);

Check warning on line 70 in core/src/main/java/jenkins/model/GlobalConfiguration.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 70 is only partially covered, one branch is missing
} else {
return configureImpl(req, json);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ THE SOFTWARE.
placeholder="${%Search available plugins}"
id="filter-box"
autofocus="true"
value="${request.getParameter('filter')}" />
value="${request2.getParameter('filter')}" />
</div>
<div class="jenkins-app-bar__controls">
<l:isAdmin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ THE SOFTWARE.
placeholder="${%Search installed plugins}"
id="filter-box"
autofocus="true"
value="${request.getParameter('filter')}"
value="${request2.getParameter('filter')}"
enabled="${!noPlugins}" />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/PluginManager/updates.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ THE SOFTWARE.
placeholder="${%Search plugin updates}"
id="filter-box"
autofocus="true"
value="${request.getParameter('filter')}"
value="${request2.getParameter('filter')}"
enabled="${!empty(list)}" />
</div>
<div class="jenkins-app-bar__controls">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ THE SOFTWARE.
<h1>
${%JVM Memory Usage}
</h1>
<j:set var="type" value="${request.getParameter('type') ?: 'min'}" />
<j:set var="type" value="${request2.getParameter('type') ?: 'min'}" />
<div>
${%Timespan}:
<j:choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ THE SOFTWARE.
<j:if test="${it.getPrimaryView() != null}">
<j:set var="it" value="${it.getPrimaryView()}"/>
</j:if>
<j:set var="submissionUrl" value="${request.getParameter('submissionUrl')}" defaultValue="submitDescription"/>
<j:set var="submissionUrl" value="${request2.getParameter('submissionUrl')}" defaultValue="submitDescription"/>
<j:invokeStatic className="hudson.Util" method="isSafeToRedirectTo" var="isSafeToRedirectTo">
<j:arg value="${submissionUrl}"/>
</j:invokeStatic>
<j:if test="${!isSafeToRedirectTo}">
<j:set var="submissionUrl" value="submitDescription"/>
</j:if>
<j:set var="initialDescription" value="${request.getParameter('description')}" defaultValue="${it.description}"/>
<j:set var="initialDescription" value="${request2.getParameter('description')}" defaultValue="${it.description}"/>
<l:ajax>
<form action="${submissionUrl}" method="post">
<table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ THE SOFTWARE.
<st:include page="sidepanel.jelly" />
<l:breadcrumb title="${%Changes}" />
<l:main-panel>
<j:set var="from" value="${request.getParameter('from')}"/>
<j:set var="to" value="${request.getParameter('to')}"/>
<j:set var="from" value="${request2.getParameter('from')}"/>
<j:set var="to" value="${request2.getParameter('to')}"/>
<j:set var="browser" value="${it.scm.effectiveBrowser}"/> <!-- for compatibility; newer project-changes.jelly override this -->

<h1>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/model/AllView/noJob.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ div {
section(class: "empty-state-section") {
ul(class: "empty-state-section-list") {
li(class: "content-block") {
a(href: "${rootURL}/${app.securityRealm.loginUrl}?from=${request.requestURI}",
a(href: "${rootURL}/${app.securityRealm.loginUrl}?from=${request2.requestURI}",
class: "content-block__link") {
span(_("Log in to Jenkins"))
span(class: "trailing-icon") {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/resources/hudson/model/ComputerSet/_new.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ THE SOFTWARE.
<l:main-panel>
<f:form method="post" action="doCreateItem" name="config" class="jenkins-form">
<f:entry title="${%Name}" help="${requestScope.descriptor.getHelpFile('name')}">
<f:textbox name="name" value="${request.getParameter('name')}" clazz="required" checkMessage="${%Name is mandatory}"/>
<f:textbox name="name" value="${request2.getParameter('name')}" clazz="required" checkMessage="${%Name is mandatory}"/>
</f:entry>

<!-- main body of the configuration -->
<j:set var="it" value="${null}" />
<st:include class="${requestScope.descriptor.clazz}" page="configure-entries.jelly" />

<f:bottomButtonBar>
<input type="hidden" name="type" value="${request.getParameter('mode')}"/>
<input type="hidden" name="type" value="${request2.getParameter('mode')}"/>

<f:submit value="${%Save}"/>
</f:bottomButtonBar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ THE SOFTWARE.
<j:invoke var="buildClass" on="${currentThread.contextClassLoader}" method="loadClass">
<j:arg value="hudson.model.Run" />
</j:invoke>
<j:set var="build" value="${request.findAncestorObject(buildClass)}" />
<j:set var="build" value="${request2.findAncestorObject(buildClass)}" />
<st:include page="sidepanel.jelly" it="${build}" />
<l:main-panel>
<t:buildCaption it="${build}">${title}</t:buildCaption>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ THE SOFTWARE.
<l:main-panel>
<h1>${it.job.pronoun} ${it.job.displayName}</h1>
<p class="jenkins-description">${%description}</p>
<j:set var="delay" value="${request.getParameter('delay')}" />
<j:set var="delay" value="${request2.getParameter('delay')}" />
<f:form method="post" action="build${empty(delay)?'':'?delay='+delay}" name="parameters"
tableClass="parameters" class="jenkins-form">
<j:forEach var="parameterDefinition" items="${it.parameterDefinitions}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<tr><td>
<div id="delete-error" style="display: none">
<pre>
${request.getAttribute('stackTraces')}
${request2.getAttribute('stackTraces')}
</pre>
</div>
</td></tr>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/model/View/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ THE SOFTWARE.
</l:main-panel>
<l:header>
<!-- for screen resolution detection -->
<script id="screenResolution-script" data-use-secure-cookie="${request.secure}"/>
<script id="screenResolution-script" data-use-secure-cookie="${request2.secure}"/>
<st:adjunct includes="hudson.model.View.screen-resolution"/>
</l:header>
</l:layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<j:set var="q" value="${request.getParameter('q')}"/>
<j:set var="q" value="${request2.getParameter('q')}"/>
<j:new var="h" className="hudson.Functions" /><!-- needed for printing title. -->
<l:layout title="${%Search for} '${q}'">
<l:main-panel>
Expand All @@ -48,7 +48,7 @@ THE SOFTWARE.
</j:forEach>
</ol>
<j:if test="${items.hasMoreResults()}">
<j:set var="max" value="${request.hasParameter('max')?request.getParameter('max'):100}"/>
<j:set var="max" value="${request2.hasParameter('max')?request2.getParameter('max'):100}"/>
<j:choose>
<j:when test="${max &gt; it.getMaxSearchSize()}">
<em>Only showing the first ${it.getMaxSearchSize()} results,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def f=namespace(lib.FormTagLib)
def l=namespace(lib.LayoutTagLib)
def st=namespace("jelly:stapler")

l.layout(permission:app.SYSTEM_READ, title:my.displayName, cssclass:request.getParameter('decorate'), type:"one-column") {
l.layout(permission:app.SYSTEM_READ, title:my.displayName, cssclass:request2.getParameter('decorate'), type:"one-column") {
l.main_panel {
l.app_bar(title: my.displayName)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ THE SOFTWARE.
needed to generate a session if non exists,
without it we would add ";jsessionid=" to the url which will result in a 404
-->
<j:set var="_" value="${request.getSession()}"/>
<j:set var="_" value="${request2.getSession()}"/>
<x:doctype name="html"/>
<!-- in case of error we want to surround the form elements with an error hint -->
<j:set var="inputClass" value="${data.errorMessage!=null ? 'jenkins-input--error' : ''}"/>
<j:set var="simpleDecorator" value="${h.simplePageDecorator}"/>
<j:set var="simpleDecorators" value="${h.simplePageDecorators}"/>
<html lang="${request.getLocale().toLanguageTag()}">
<html lang="${request2.getLocale().toLanguageTag()}">
<head data-rooturl="${rootURL}" data-resurl="${resURL}" data-imagesurl="${imagesURL}" resURL="${resURL}">
<title>${%Register} - Jenkins</title>
<!-- we do not want bots on this page -->
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/security/WhoAmI/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ THE SOFTWARE.

<h2>Request Headers</h2>
<table>
<j:forEach var="n" items="${request.getHeaderNames()}">
<j:forEach var="n" items="${request2.getHeaderNames()}">
<j:choose>
<j:when test="${it.isHeaderDangerous(n)}" >
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ THE SOFTWARE.
<!-- get default/common page variable -->
${h.initPageVariables(context)}
<x:doctype name="html" />
<html lang="${request.getLocale().toLanguageTag()}">
<html lang="${request2.getLocale().toLanguageTag()}">
<head data-rooturl="${rootURL}" data-resurl="${resURL}" data-imagesurl="${imagesURL}" resURL="${resURL}">
<title>${%Starting Jenkins}</title>
<!-- we do not want bots on this page -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ THE SOFTWARE.
<!-- get default/common page variable -->
${h.initPageVariables(context)}
<x:doctype name="html" />
<html lang="${request.getLocale().toLanguageTag()}">
<html lang="${request2.getLocale().toLanguageTag()}">
<head data-rooturl="${rootURL}" data-resurl="${resURL}" data-imagesurl="${imagesURL}" resURL="${resURL}">
<title>${%Restarting Jenkins}</title>
<!-- we do not want bots on this page -->
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/jenkins/agents/CloudSet/_new.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ THE SOFTWARE.
<st:include it="${requestScope.instance}" class="${requestScope.descriptor.clazz}" page="config.jelly" optional="true" />

<f:bottomButtonBar>
<input type="hidden" name="cloudDescriptorName" value="${request.getParameter('mode')}"/>
<input type="hidden" name="cloudDescriptorName" value="${request2.getParameter('mode')}"/>

<f:submit value="${%Save}"/>
</f:bottomButtonBar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<l:main-panel>
<st:include page="client-scripts" />
<form action="${app.instance.securityRealm.authenticationGatewayUrl}" method="POST">
<input type="hidden" name="from" value="${request.getParameter('from')}" />
<input type="hidden" name="from" value="${request2.getParameter('from')}" />
<div class="plugin-setup-wizard bootstrap-3">
<div class="modal fade in" style="display: block;">
<div class="modal-dialog">
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/resources/jenkins/model/Jenkins/_404.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ THE SOFTWARE.
This is the page designated by web.xml to handle 404 errors. Show a nice error message and suggest logging in if applicable.
Generally kept very similar to 'oops.jelly'.
-->
<st:statusCode value="${response.getStatus()}" />
${request.session.setAttribute('from', request.getAttribute('jakarta.servlet.error.request_uri'))}
<st:statusCode value="${response2.getStatus()}" />
${request2.session.setAttribute('from', request2.getAttribute('jakarta.servlet.error.request_uri'))}
<l:layout title="${%title(jakarta.servlet.error.message?:'Not Found')}" type="one-column">
<l:header />
<l:main-panel>
Expand All @@ -39,7 +39,7 @@ THE SOFTWARE.
</h1>
<div id="error-description" style="text-align: center">
<h2>${%title(jakarta.servlet.error.message?:'Not Found')}</h2>
<j:if test="${!request.getAttribute('jenkins.security.ResourceDomainRootAction.error')}">
<j:if test="${!request2.getAttribute('jenkins.security.ResourceDomainRootAction.error')}">
<p>
<j:choose>
<j:when test="${app.useSecurity}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ THE SOFTWARE.
<st:setHeader name="Referrer-Policy" value="same-origin" />
<st:setHeader name="Cross-Origin-Opener-Policy" value="same-origin" />
<x:doctype name="html" />
<st:statusCode value="${response.getStatus()}" />
<st:statusCode value="${response2.getStatus()}" />
<html>
<head>
<title>${%title(jakarta.servlet.error.message?:'Not Found')}</title>
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/resources/jenkins/model/Jenkins/login.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ THE SOFTWARE.
<st:setHeader name="Expires" value="0" />
<st:setHeader name="Cache-Control" value="no-cache,no-store,must-revalidate" />
<!-- needed for cli -->
<j:if test="${request.servletPath=='/' || request.servletPath==''}">
<j:if test="${request2.servletPath=='/' || request2.servletPath==''}">
${h.advertiseHeaders(response)}
<j:forEach var="pd" items="${h.pageDecorators}">
<st:include it="${pd}" page="httpHeaders.jelly" optional="true"/>
Expand All @@ -39,19 +39,19 @@ THE SOFTWARE.
needed to generate a session if non exists,
without it we would add ";jsessionid=" to the url which will result in a 404
-->
<j:set var="_" value="${request.getSession()}"/>
<j:set var="_" value="${request2.getSession()}"/>
<!-- get default/common page variable -->
${h.initPageVariables(context)}
<x:doctype name="html" />
<!-- needed for the redirect after login -->
<j:set var="from" value="${error ? request.session.getAttribute('from') : request.getParameter('from')}"/>
<j:set var="from" value="${error ? request2.session.getAttribute('from') : request2.getParameter('from')}"/>
<!-- in case of error we want to surround the form elements with an error hint -->
<j:set var="inputClass" value="${error ? 'jenkins-input--error' : ''}"/>
<j:set var="simpleDecorator" value="${h.simplePageDecorator}"/>
<j:set var="simpleDecorators" value="${h.simplePageDecorators}"/>

<!-- real deal starting here -->
<html lang="${request.getLocale().toLanguageTag()}">
<html lang="${request2.getLocale().toLanguageTag()}">
<head data-rooturl="${rootURL}" data-resurl="${resURL}" data-imagesurl="${imagesURL}" resURL="${resURL}">
<title>${%signIn} - Jenkins</title>
<!-- we do not want bots on this page -->
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/resources/jenkins/model/Jenkins/oops.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ THE SOFTWARE.
<!--
This is the page designated by web.xml and UncaughtExceptionHandler to process an exception thrown by us.
-->
<st:statusCode value="${response.getStatus()}" />
<st:statusCode value="${response2.getStatus()}" />
<l:layout title="Jenkins" type="one-column">
<l:header />
<l:main-panel>
Expand All @@ -36,12 +36,12 @@ THE SOFTWARE.
</h1>
<div id="error-description">
<h2 style="text-align: center">${%problemHappened}</h2>
<p style="text-align: center">Logging ID=${request.getAttribute('jenkins.exception.id')}</p>
<p style="text-align: center">Logging ID=${request2.getAttribute('jenkins.exception.id')}</p>
</div>
<j:if test="${app.shouldShowStackTrace()}">
<p>${%checkJIRA} ${%vote} ${%pleaseReport} ${%stackTracePlease} ${%checkML}</p>
<h2>${%Stack trace}</h2>
<pre style="margin:2em; clear:both">${h.printThrowable(request.getAttribute('jakarta.servlet.error.exception'))}</pre>
<pre style="margin:2em; clear:both">${h.printThrowable(request2.getAttribute('jakarta.servlet.error.exception'))}</pre>
</j:if>
</l:main-panel>
</l:layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@ THE SOFTWARE.
<form action="projectRelationship" method="get">
<div class="jenkins-form-item">
<label class="jenkins-form-label" for="lhs">${%upstream project}:</label>
<f:combobox id="lhs" fillUrl="fillJobNameItems" name="lhs" value="${request.getParameter('lhs')}"/>
<f:combobox id="lhs" fillUrl="fillJobNameItems" name="lhs" value="${request2.getParameter('lhs')}"/>
</div>

<div class="jenkins-form-item">
<label class="jenkins-form-label" for="rhs">${%downstream project}:</label>
<f:combobox id="rhs" fillUrl="fillJobNameItems" name="rhs" value="${request.getParameter('rhs')}"/>
<f:combobox id="rhs" fillUrl="fillJobNameItems" name="rhs" value="${request2.getParameter('rhs')}"/>
</div>
<f:submit value="${%Compare}"/>

<j:if test="${!empty(request.getParameter('lhs')) and !empty(request.getParameter('rhs'))}">
<j:set var="jl" value="${app.getItemByFullName(request.getParameter('lhs'))}"/>
<j:set var="jr" value="${app.getItemByFullName(request.getParameter('rhs'))}"/>
<j:if test="${!empty(request2.getParameter('lhs')) and !empty(request2.getParameter('rhs'))}">
<j:set var="jl" value="${app.getItemByFullName(request2.getParameter('lhs'))}"/>
<j:set var="jr" value="${app.getItemByFullName(request2.getParameter('rhs'))}"/>

<j:choose>
<j:when test="${jl==null}">
<p class="error">No such project '${request.getParameter('lhs')}'</p>
<p class="error">No such project '${request2.getParameter('lhs')}'</p>
</j:when>
<j:when test="${jr==null}">
<p class="error">No such project '${request.getParameter('rhs')}'</p>
<p class="error">No such project '${request2.getParameter('rhs')}'</p>
</j:when>
<j:otherwise>
<table width="100%">
Expand Down
Loading

0 comments on commit 2fdb00b

Please sign in to comment.