juneau-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesbog...@apache.org
Subject [juneau] branch master updated: Remove deprecated code.
Date Tue, 13 Oct 2020 19:10:58 GMT
This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 7132ee6  Remove deprecated code.
7132ee6 is described below

commit 7132ee6e58d5f7e37a995718e6ed6b6d12a14bb8
Author: JamesBognar <james.bognar@salesforce.com>
AuthorDate: Tue Oct 13 15:10:54 2020 -0400

    Remove deprecated code.
---
 .../org/apache/juneau/rest/RequestProperties.java  | 52 -------------
 .../org/apache/juneau/rest/RestMethodContext.java  | 18 +----
 .../juneau/rest/RestMethodContextBuilder.java      | 13 ----
 .../org/apache/juneau/rest/RestParamDefaults.java  | 16 +---
 .../java/org/apache/juneau/rest/RestRequest.java   | 86 +---------------------
 .../java/org/apache/juneau/rest/RestResponse.java  | 72 +-----------------
 6 files changed, 7 insertions(+), 250 deletions(-)

diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestProperties.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestProperties.java
deleted file mode 100644
index 776ef67..0000000
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestProperties.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.  See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership.
 The ASF licenses this file        *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance            *
-// * with the License.  You may obtain a copy of the License at                         
                                    *
-// *                                                                                    
                                    *
-// *  http://www.apache.org/licenses/LICENSE-2.0                                        
                                    *
-// *                                                                                    
                                    *
-// * Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an  *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the        *
-// * specific language governing permissions and limitations under the License.         
                                    *
-// ***************************************************************************************************************************
-package org.apache.juneau.rest;
-
-import org.apache.juneau.svl.*;
-
-/**
- * Encapsulates request-level properties.
- *
- * <div class='warn'>
- * 	<b>Deprecated</b> - Use {@link RequestAttributes}
- * </div>
- *
- * <p>
- * These are properties specified for a single HTTP request that extends the properties defined
on {@link RestMethodProperties}
- * and are accessible and modifiable through the following:
- * <ul>
- * 	<li class='jm'>{@link RestRequest#getProperties()}
- * 	<li class='jm'>{@link RestRequest#prop(String, Object)}
- * 	<li class='jm'>{@link RestResponse#getProperties()}
- * 	<li class='jm'>{@link RestResponse#prop(String, Object)}
- * </ul>
- *
- * <ul class='seealso'>
- * 	<li class='link'>{@doc RestConfigurableProperties}
- * </ul>
- */
-@SuppressWarnings("serial")
-@Deprecated
-public class RequestProperties extends ResolvingOMap {
-
-	/**
-	 * Constructor
-	 *
-	 * @param varResolver The request variable resolver session.
-	 * @param inner The inner properties defined on the resource context.
-	 */
-	public RequestProperties(VarResolverSession varResolver, RestMethodProperties inner) {
-		super(varResolver);
-		inner(inner);
-	}
-}
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java
index 0220546..da7881e 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java
@@ -597,8 +597,6 @@ public class RestMethodContext extends BeanContext implements Comparable<RestMet
 	private final RestMatcher[] optionalMatchers;
 	private final RestMatcher[] requiredMatchers;
 	private final RestConverter[] converters;
-	@SuppressWarnings("deprecation")
-	private final RestMethodProperties properties;
 	private final Integer priority;
 	private final RestContext context;
 	final java.lang.reflect.Method method;
@@ -806,8 +804,6 @@ public class RestMethodContext extends BeanContext implements Comparable<RestMet
 			_widgets.put(w.getName(), w);
 		this.widgets = _widgets.unmodifiable();
 
-		this.properties = b.properties;
-
 		this.supportedAcceptTypes = getListProperty(REST_produces, MediaType.class, serializers.getSupportedMediaTypes());
 		this.supportedContentTypes = getListProperty(REST_consumes, MediaType.class, parsers.getSupportedMediaTypes());
 
@@ -962,11 +958,8 @@ public class RestMethodContext extends BeanContext implements Comparable<RestMet
 			RestRequest req = call.getRestRequest();
 			RestResponse res = call.getRestResponse();
 
-			@SuppressWarnings("deprecation")
-			RequestProperties requestProperties = new RequestProperties(req.getVarResolverSession(),
properties);
-
-			req.init(this, requestProperties);
-			res.init(this, requestProperties);
+			req.init(this);
+			res.init(this);
 
 			// If the method implements matchers, test them.
 			for (RestMatcher m : requiredMatchers)
@@ -1019,11 +1012,8 @@ public class RestMethodContext extends BeanContext implements Comparable<RestMet
 		if (pm.getRemainder() != null)
 			rp.remainder(pm.getRemainder());
 
-		@SuppressWarnings("deprecation")
-		RequestProperties requestProperties = new RequestProperties(req.getVarResolverSession(),
properties);
-
-		req.init(this, requestProperties);
-		res.init(this, requestProperties);
+		req.init(this);
+		res.init(this);
 
 		context.preCall(call);
 
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContextBuilder.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContextBuilder.java
index 43fbbeb..9b5f5af 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContextBuilder.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContextBuilder.java
@@ -25,7 +25,6 @@ import java.lang.reflect.Method;
 /**
  * Builder class for {@link RestMethodContext} objects.
  */
-@SuppressWarnings("deprecation")
 public class RestMethodContextBuilder extends BeanContextBuilder {
 
 	RestContext context;
@@ -33,8 +32,6 @@ public class RestMethodContextBuilder extends BeanContextBuilder {
 
 	boolean dotAll;
 
-	RestMethodProperties properties;
-
 	RestMethodContextBuilder(Object servlet, java.lang.reflect.Method method, RestContext context)
throws RestServletException {
 		this.context = context;
 		this.method = method;
@@ -63,16 +60,6 @@ public class RestMethodContextBuilder extends BeanContextBuilder {
 
 			applyAnnotations(mi.getAnnotationList(ConfigAnnotationFilter.INSTANCE), vrs);
 
-			properties = new RestMethodProperties(context.getProperties());
-
-			if (m.properties().length > 0 || m.flags().length > 0) {
-				properties = new RestMethodProperties(properties);
-				for (Property p1 : m.properties())
-					properties.put(p1.name(), p1.value());
-				for (String p1 : m.flags())
-					properties.put(p1, true);
-			}
-
 		} catch (RestServletException e) {
 			throw e;
 		} catch (Exception e) {
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
index a57ac52..db1b7d9 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
@@ -100,8 +100,7 @@ class RestParamDefaults {
 			RequestBodyObject.class,
 			ConfigObject.class,
 			UriContextObject.class,
-			UriResolverObject.class,
-			RestRequestPropertiesObject.class
+			UriResolverObject.class
 		};
 
 		for (Class<?> c : r) {
@@ -556,19 +555,6 @@ class RestParamDefaults {
 		}
 	}
 
-	@Deprecated
-	static final class RestRequestPropertiesObject extends RestMethodParam {
-
-		protected RestRequestPropertiesObject() {
-			super(OTHER, RequestProperties.class);
-		}
-
-		@Override /* RestMethodParam */
-		public RequestProperties resolve(RestRequest req, RestResponse res) throws Exception {
-			return req.getProperties();
-		}
-	}
-
 	//-------------------------------------------------------------------------------------------------------------------
 	// Other retrievers
 	//-------------------------------------------------------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
index e0e94e2..0e34a47 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
@@ -100,8 +100,6 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	private final String method;
 	private RequestBody body;
 	private Method javaMethod;
-	@SuppressWarnings("deprecation")
-	private RequestProperties properties;
 	private BeanSession beanSession;
 	private VarResolverSession varSession;
 	private final RequestQuery queryParams;
@@ -193,10 +191,9 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	/*
 	 * Called from RestServlet after a match has been made but before the guard or method invocation.
 	 */
-	final void init(RestMethodContext rjm, @SuppressWarnings("deprecation") RequestProperties
properties) throws IOException {
+	final void init(RestMethodContext rjm) throws IOException {
 		this.restJavaMethod = rjm;
 		this.javaMethod = rjm.method;
-		this.properties = properties;
 		this.beanSession = rjm.createSession();
 		this.partParserSession = rjm.partParser.createPartSession(getParserSessionArgs());
 		this.partSerializerSession = rjm.partSerializer.createPartSession(getSerializerSessionArgs());
@@ -219,14 +216,6 @@ public final class RestRequest extends HttpServletRequestWrapper {
 		if (isDebug()) {
 			inner = CachingHttpServletRequest.wrap(inner);
 		}
-
-		String stylesheet = getQuery().getString("stylesheet");
-		if (stylesheet != null)
-			getSession().setAttribute(HTMLDOC_stylesheet, stylesheet.replace(' ', '$'));  // Prevent
SVL insertion.
-		stylesheet = (String)getSession().getAttribute("stylesheet");
-		if (stylesheet != null)
-			properties.put(HTMLDOC_stylesheet, new String[]{stylesheet});
-
 	}
 
 	RestRequest setResponse(RestResponse res) {
@@ -245,77 +234,6 @@ public final class RestRequest extends HttpServletRequestWrapper {
 	}
 
 	//-----------------------------------------------------------------------------------------------------------------
-	// Properties
-	//-----------------------------------------------------------------------------------------------------------------
-
-	/**
-	 * Retrieve the properties active for this request.
-	 *
-	 * <div class='warn'>
-	 * 	<b>Deprecated</b> - Use {@link #getAttributes()}
-	 * </div>
-	 *
-	 * <p>
-	 * This contains all resource and method level properties from the following:
-	 * <ul class='javatree'>
-	 * 	<li class='ja'>{@link Rest#properties()}
-	 * 	<li class='ja'>{@link RestMethod#properties()}
-	 * 	<li class='jm'>{@link RestContextBuilder#set(String, Object)}
-	 * </ul>
-	 *
-	 * <p>
-	 * The returned object is modifiable and allows you to override session-level properties
before
-	 * they get passed to the serializers.
-	 * <br>However, properties are open-ended, and can be used for any purpose.
-	 *
-	 * <h5 class='section'>Example:</h5>
-	 * <p class='bcode w800'>
-	 * 	<ja>@RestMethod</ja>(
-	 * 		properties={
-	 * 			<ja>@Property</ja>(name=<jsf>SERIALIZER_sortMaps</jsf>, value=<js>"false"</js>)
-	 * 		}
-	 * 	)
-	 * 	<jk>public</jk> Map doGet(RestRequest req, <ja>@Query</ja>(<js>"sortMaps"</js>)
Boolean sortMaps) {
-	 *
-	 * 		<jc>// Override value if specified through query parameter.</jc>
-	 * 		<jk>if</jk> (sortMaps != <jk>null</jk>)
-	 * 			req.getProperties().put(<jsf>SERIALIZER_sortMaps</jsf>, sortMaps);
-	 *
-	 * 		<jk>return</jk> <jsm>getMyMap</jsm>();
-	 * 	}
-	 * </p>
-	 *
-	 * <ul class='seealso'>
-	 * 	<li class='jm'>{@link #prop(String, Object)}
-	 * 	<li class='link'>{@doc RestConfigurableProperties}
-	 * </ul>
-	 *
-	 * @return The properties active for this request.
-	 */
-	@Deprecated
-	public RequestProperties getProperties() {
-		return this.properties;
-	}
-
-	/**
-	 * Shortcut for calling <c>getProperties().append(name, value);</c> fluently.
-	 *
-	 * <div class='warn'>
-	 * 	<b>Deprecated</b> - {@link RequestAttributes#put(String, Object)} or {@link
#setAttribute(String, Object)}
-	 * </div>
-	 *
-	 * @param name The property name.
-	 * @param value The property value.
-	 * @return This object (for method chaining).
-	 */
-	@Deprecated
-	public RestRequest prop(String name, Object value) {
-		this.properties.append(name, value);
-		return this;
-	}
-
-
-	//-----------------------------------------------------------------------------------------------------------------
 	// Headers
 	//-----------------------------------------------------------------------------------------------------------------
 
@@ -1706,7 +1624,6 @@ public final class RestRequest extends HttpServletRequestWrapper {
 		if (serializerSessionArgs == null)
 			serializerSessionArgs = SerializerSessionArgs
 				.create()
-				.properties(getProperties())
 				.javaMethod(getJavaMethod())
 				.locale(getLocale())
 				.timeZone(getHeaders().getTimeZone())
@@ -1727,7 +1644,6 @@ public final class RestRequest extends HttpServletRequestWrapper {
 			parserSessionArgs =
 				ParserSessionArgs
 					.create()
-					.properties(getProperties())
 					.javaMethod(getJavaMethod())
 					.locale(getLocale())
 					.timeZone(getHeaders().getTimeZone())
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
index bed181d..58dd30b 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
@@ -28,7 +28,6 @@ import org.apache.juneau.encoders.*;
 import org.apache.juneau.http.*;
 import org.apache.juneau.httppart.*;
 import org.apache.juneau.httppart.bean.*;
-import org.apache.juneau.rest.annotation.*;
 import org.apache.juneau.http.exception.*;
 import org.apache.juneau.http.header.*;
 import org.apache.juneau.rest.util.*;
@@ -64,8 +63,6 @@ public final class RestResponse extends HttpServletResponseWrapper {
 	private RestMethodContext restJavaMethod;
 	private Object output;                       // The POJO being sent to the output.
 	private boolean isNullOutput;                // The output is null (as opposed to not being
set at all)
-	@SuppressWarnings("deprecation")
-	private RequestProperties properties;                // Response properties
 	private ServletOutputStream sos;
 	private FinishableServletOutputStream os;
 	private FinishablePrintWriter w;
@@ -101,9 +98,8 @@ public final class RestResponse extends HttpServletResponseWrapper {
 	/*
 	 * Called from RestServlet after a match has been made but before the guard or method invocation.
 	 */
-	final void init(RestMethodContext rjm, @SuppressWarnings("deprecation") RequestProperties
properties) throws NotAcceptable, IOException {
+	final void init(RestMethodContext rjm) throws NotAcceptable, IOException {
 		this.restJavaMethod = rjm;
-		this.properties = properties;
 
 		if (request.isDebug())
 			setDebug();
@@ -204,72 +200,6 @@ public final class RestResponse extends HttpServletResponseWrapper {
 	}
 
 	/**
-	 * Retrieve the properties active for this request.
-	 *
-	 * <div class='warn'>
-	 * 	<b>Deprecated</b> - Use {@link RestResponse#getAttributes()}
-	 * </div>
-	 *
-	 * <p>
-	 * This contains all resource and method level properties from the following:
-	 * <ul class='javatree'>
-	 * 	<li class='ja'>{@link Rest#properties()}
-	 * 	<li class='ja'>{@link RestMethod#properties()}
-	 * 	<li class='jm'>{@link RestContextBuilder#set(String, Object)}
-	 * </ul>
-	 *
-	 * <p>
-	 * The returned object is modifiable and allows you to override session-level properties
before
-	 * they get passed to the serializers.
-	 * <br>However, properties are open-ended, and can be used for any purpose.
-	 *
-	 * <h5 class='section'>Example:</h5>
-	 * <p class='bcode w800'>
-	 * 	<ja>@RestMethod</ja>(
-	 * 		properties={
-	 * 			<ja>@Property</ja>(name=<jsf>SERIALIZER_sortMaps</jsf>, value=<js>"false"</js>)
-	 * 		}
-	 * 	)
-	 * 	<jk>public</jk> Map doGet(RestResponse res, <ja>@Query</ja>(<js>"sortMaps"</js>)
Boolean sortMaps) {
-	 *
-	 * 		<jc>// Override value if specified through query parameter.</jc>
-	 * 		<jk>if</jk> (sortMaps != <jk>null</jk>)
-	 * 			res.getProperties().put(<jsf>SERIALIZER_sortMaps</jsf>, sortMaps);
-	 *
-	 * 		<jk>return</jk> <jsm>getMyMap</jsm>();
-	 * 	}
-	 * </p>
-	 *
-	 * <ul class='seealso'>
-	 * 	<li class='jm'>{@link #prop(String, Object)}
-	 * 	<li class='link'>{@doc RestConfigurableProperties}
-	 * </ul>
-	 *
-	 * @return The properties active for this request.
-	 */
-	@Deprecated
-	public RequestProperties getProperties() {
-		return properties;
-	}
-
-	/**
-	 * Shortcut for calling <c>getProperties().append(name, value);</c> fluently.
-	 *
-	 * <div class='warn'>
-	 * 	<b>Deprecated</b> - Use {@link #attr(String,Object)}
-	 * </div>
-	 *
-	 * @param name The property name.
-	 * @param value The property value.
-	 * @return This object (for method chaining).
-	 */
-	@Deprecated
-	public RestResponse prop(String name, Object value) {
-		this.properties.append(name, value);
-		return this;
-	}
-
-	/**
 	 * Shortcut for calling <c>getRequest().getAttributes()</c>.
 	 *
 	 * @return The request attributes object.


Mime
View raw message