Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate example to StaplerRequest2 & StaplerResponse2 #620

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions core/maven-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@

<packaging>war</packaging>

<repositories>
<repository>
<id>jenkins-public</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.kohsuke.stapler</groupId>
<artifactId>stapler-jsp</artifactId>
<version>1.253</version>
<artifactId>stapler</artifactId>
<version>1928.v9115fe47607f</version>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
Expand All @@ -24,7 +31,7 @@
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<version>6.1.0</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is Jakarta EE 11, while this repository is currently on Java EE 9.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for comment, I change it in a new pull request
but to make it clear, should change the version only or the whole dependency ?
because based on that commit
994adb3
the migration is towards Jakarta EE 9, thanks🙏🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after returning to the mentioned commit, I found that I should have left the version to be 5.0.0, please tell me if I wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, this should have been left at 5.0.0 (EE 9). When the repository is upgraded to e.g. EE 10 in the future (cf. #617), we can upgrade it then.

<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -63,7 +70,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.7.v20170914</version>
<version>11.0.24</version>
<configuration>
<scanIntervalSeconds>2</scanIntervalSeconds>

Expand Down
6 changes: 3 additions & 3 deletions core/maven-example/src/main/java/example/BookStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;

/**
* Root object of this web application.
Expand Down Expand Up @@ -60,7 +60,7 @@ public Map getItems() {
* <p>
* Action methods are useful to perform some operations in Java.
*/
public void doHello( StaplerRequest request, StaplerResponse response ) throws IOException, ServletException {
public void doHello( StaplerRequest2 request, StaplerResponse2 response ) throws IOException, ServletException {
System.out.println("Hello operation");
request.setAttribute("systemTime",new Long(System.currentTimeMillis()));

Expand Down