Skip to content

Commit

Permalink
Remove deprecated APIs in spring-web
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoyanchev committed Jan 15, 2025
1 parent 00ee0ab commit 9ddbf80
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 545 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,14 +56,6 @@ public enum HttpStatus implements HttpStatusCode {
* @since 6.0.5
*/
EARLY_HINTS(103, Series.INFORMATIONAL, "Early Hints"),
/**
* {@code 103 Checkpoint}.
* @see <a href="https://code.google.com/p/gears/wiki/ResumableHttpRequestsProposal">A proposal for supporting
* resumable POST/PUT HTTP requests in HTTP/1.0</a>
* @deprecated in favor of {@link #EARLY_HINTS} which will be returned from {@code HttpStatus.valueOf(103)}
*/
@Deprecated(since = "6.0.5")
CHECKPOINT(103, Series.INFORMATIONAL, "Checkpoint"),

// 2xx Success

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -183,18 +183,6 @@ public HttpStatusCode getStatusCode() {
return this.status;
}

/**
* Return the HTTP status code of the response.
* @return the HTTP status as an int value
* @since 4.3
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}; scheduled
* for removal in 7.0
*/
@Deprecated(since = "6.0")
public int getStatusCodeValue() {
return getStatusCode().value();
}


@Override
public boolean equals(@Nullable Object other) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -112,15 +112,6 @@ public HttpStatusCode getStatusCode() {
return this.statusCode;
}

/**
* Return the raw HTTP status code value.
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
*/
@Deprecated(since = "6.0")
public int getRawStatusCode() {
return this.statusCode.value();
}

/**
* Return the HTTP status text.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,8 +50,6 @@
*/
public class ModelAndViewContainer {

private boolean ignoreDefaultModelOnRedirect = true;

private @Nullable Object view;

private final ModelMap defaultModel = new BindingAwareModelMap();
Expand All @@ -71,25 +69,6 @@ public class ModelAndViewContainer {
private boolean requestHandled = false;


/**
* By default, the content of the "default" model is used both during
* rendering and redirect scenarios. Alternatively controller methods
* can declare an argument of type {@code RedirectAttributes} and use
* it to provide attributes to prepare the redirect URL.
* <p>Setting this flag to {@code true} guarantees the "default" model is
* never used in a redirect scenario even if a RedirectAttributes argument
* is not declared. Setting it to {@code false} means the "default" model
* may be used in a redirect if the controller method doesn't declare a
* RedirectAttributes argument.
* <p>As of 6.0, this property is set to {@code true} by default.
* @deprecated as of 6.0 without a replacement; once removed, the default
* model will always be ignored on redirect
*/
@Deprecated(since = "6.0")
public void setIgnoreDefaultModelOnRedirect(boolean ignoreDefaultModelOnRedirect) {
this.ignoreDefaultModelOnRedirect = ignoreDefaultModelOnRedirect;
}

/**
* Set a view name to be resolved by the DispatcherServlet via a ViewResolver.
* Will override any pre-existing view name or View.
Expand Down Expand Up @@ -137,22 +116,13 @@ public boolean isViewReference() {
* a method argument) and {@code ignoreDefaultModelOnRedirect=false}.
*/
public ModelMap getModel() {
if (useDefaultModel()) {
if (!this.redirectModelScenario) {
return this.defaultModel;
}
else {
if (this.redirectModel == null) {
this.redirectModel = new ModelMap();
}
return this.redirectModel;
if (this.redirectModel == null) {
this.redirectModel = new ModelMap();
}
}

/**
* Whether to use the default model or the redirect model.
*/
private boolean useDefaultModel() {
return (!this.redirectModelScenario || (this.redirectModel == null && !this.ignoreDefaultModelOnRedirect));
return this.redirectModel;
}

/**
Expand Down Expand Up @@ -336,7 +306,7 @@ public String toString() {
else {
sb.append("View is [").append(this.view).append(']');
}
if (useDefaultModel()) {
if (!this.redirectModelScenario) {
sb.append("; default model ");
}
else {
Expand Down
Loading

0 comments on commit 9ddbf80

Please sign in to comment.