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 369353e Clean up deprecated code. 369353e is described below commit 369353edabadd24809ee8bb182a381eae42b85d0 Author: JamesBognar <james.bog...@salesforce.com> AuthorDate: Fri Oct 16 11:33:07 2020 -0400 Clean up deprecated code. --- .../java/org/apache/juneau/rest/RestContext.java | 13 +-- .../org/apache/juneau/rest/RestContextBuilder.java | 98 ------------------- .../org/apache/juneau/rest/RestMethodContext.java | 8 -- .../java/org/apache/juneau/rest/RestRequest.java | 16 --- .../org/apache/juneau/rest/vars/WidgetVar.java | 108 --------------------- 5 files changed, 1 insertion(+), 242 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java index 7fc6749..784dd22 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java @@ -3428,16 +3428,6 @@ public class RestContext extends BeanContext { */ public static final String REST_uriResolution = PREFIX + ".uriResolution.s"; - /** - * Configuration property: HTML Widgets. - * - * <div class='warn'> - * <b>Deprecated</b> - Use {@link HtmlDocSerializer#HTMLDOC_widgets} - * </div> - */ - @Deprecated - public static final String REST_widgets = PREFIX + ".widgets.lo"; - //------------------------------------------------------------------------------------------------------------------- // Static @@ -3599,7 +3589,6 @@ public class RestContext extends BeanContext { * @param builder The servlet configuration object. * @throws Exception If any initialization problems were encountered. */ - @SuppressWarnings("deprecation") public RestContext(RestContextBuilder builder) throws Exception { super(builder.getPropertyStore()); @@ -3635,7 +3624,7 @@ public class RestContext extends BeanContext { SwaggerVar.class, UrlVar.class, UrlEncodeVar.class, - WidgetVar.class + HtmlWidgetVar.class ) .build() ; diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java index 3229149..0474b6f 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java @@ -30,7 +30,6 @@ import org.apache.juneau.config.*; import org.apache.juneau.config.vars.*; import org.apache.juneau.cp.*; import org.apache.juneau.encoders.*; -import org.apache.juneau.html.*; import org.apache.juneau.http.*; import org.apache.juneau.http.exception.*; import org.apache.juneau.httppart.*; @@ -42,7 +41,6 @@ import org.apache.juneau.rest.annotation.*; import org.apache.juneau.rest.reshandlers.*; import org.apache.juneau.rest.util.RestUtils; import org.apache.juneau.rest.vars.*; -import org.apache.juneau.rest.widget.*; import org.apache.juneau.serializer.*; import org.apache.juneau.svl.*; import org.apache.juneau.svl.vars.*; @@ -2262,102 +2260,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon return set(REST_useClasspathResourceCaching, value); } - /** - * <i><l>RestContext</l> configuration property: </i> HTML Widgets. - * - * <div class='warn'> - * <b>Deprecated</b> - Use {@link HtmlDocSerializerBuilder#widgets(Class[])} - * </div> - * - * <p> - * Defines widgets that can be used in conjunction with string variables of the form <js>"$W{name}"</js>to quickly - * generate arbitrary replacement text. - * - * <ul class='seealso'> - * <li class='jf'>{@link RestContext#REST_widgets} - * </ul> - * - * @param values The values to add to this setting. - * @return This object (for method chaining). - * - */ - @SuppressWarnings("unchecked") - @Deprecated - @FluentSetter - public RestContextBuilder widgets(Class<? extends Widget>...values) { - return prependTo(REST_widgets, values); - } - - /** - * <i><l>RestContext</l> configuration property: </i> HTML Widgets. - * - * <div class='warn'> - * <b>Deprecated</b> - Use {@link HtmlDocSerializerBuilder#widgetsReplace(Class[])} - * </div> - * - * <p> - * Same as {@link #widgets(Class...)} but replaces any previous values. - * - * <ul class='seealso'> - * <li class='jf'>{@link RestContext#REST_widgets} - * </ul> - * - * @param values The values to set on this setting. - * @return This object (for method chaining). - */ - @SuppressWarnings("unchecked") - @Deprecated - @FluentSetter - public RestContextBuilder widgetsReplace(Class<? extends Widget>...values) { - return set(REST_widgets, values); - } - - /** - * <i><l>RestContext</l> configuration property: </i> HTML Widgets. - * - * <div class='warn'> - * <b>Deprecated</b> - Use {@link HtmlDocSerializerBuilder#widgets(HtmlWidget[])} - * </div> - * - * <p> - * Same as {@link #widgets(Class...)} except input is pre-constructed instances. - * - * <ul class='seealso'> - * <li class='jf'>{@link RestContext#REST_widgets} - * </ul> - * - * @param values The values to add to this setting. - * @return This object (for method chaining). - */ - @Deprecated - @FluentSetter - public RestContextBuilder widgets(Widget...values) { - return prependTo(REST_widgets, values); - } - - /** - * <i><l>RestContext</l> configuration property: </i> HTML Widgets. - * - * <div class='warn'> - * <b>Deprecated</b> - Use {@link HtmlDocSerializerBuilder#widgetsReplace(HtmlWidget[])} - * </div> - * - * <p> - * Same as {@link #widgets(Widget...)} except allows you to overwrite the previous value. - * - * <ul class='seealso'> - * <li class='jf'>{@link RestContext#REST_widgets} - * </ul> - * - * @param values The values to add to this setting. - * @return This object (for method chaining). - */ - @Deprecated - @FluentSetter - public RestContextBuilder widgetsReplace(Widget...values) { - return set(REST_widgets, values); - } - @Override /* ContextBuilder */ public RestContextBuilder set(String name, Object value) { super.set(name, value); 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 5d69d5c..3e37b49 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 @@ -50,7 +50,6 @@ import org.apache.juneau.http.exception.*; import org.apache.juneau.http.remote.*; import org.apache.juneau.rest.guards.*; import org.apache.juneau.rest.util.*; -import org.apache.juneau.rest.widget.*; import org.apache.juneau.serializer.*; import org.apache.juneau.svl.*; import org.apache.juneau.utils.*; @@ -560,7 +559,6 @@ public class RestMethodContext extends BeanContext implements Comparable<RestMet final OMap reqAttrs; final String defaultCharset; final long maxInput; - final Map<String,Widget> widgets; final List<MediaType> supportedAcceptTypes, supportedContentTypes; @@ -576,7 +574,6 @@ public class RestMethodContext extends BeanContext implements Comparable<RestMet final Enablement debug; final int hierarchyDepth; - @SuppressWarnings("deprecation") RestMethodContext(RestMethodContextBuilder b) throws ServletException { super(b.getPropertyStore()); @@ -744,11 +741,6 @@ public class RestMethodContext extends BeanContext implements Comparable<RestMet this.priority = getIntegerProperty(RESTMETHOD_priority, 0); - AMap<String,Widget> _widgets = AMap.of(); - for (Widget w : getInstanceArrayProperty(REST_widgets, Widget.class, new Widget[0])) - _widgets.put(w.getName(), w); - this.widgets = _widgets.unmodifiable(); - this.supportedAcceptTypes = getListProperty(REST_produces, MediaType.class, serializers.getSupportedMediaTypes()); this.supportedContentTypes = getListProperty(REST_consumes, MediaType.class, parsers.getSupportedMediaTypes()); 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 fb3c4e2..ca74e79 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 @@ -1485,22 +1485,6 @@ public final class RestRequest extends HttpServletRequestWrapper { } /** - * Returns the widgets used for resolving <js>"$W{...}"</js> string variables. - * - * <div class='warn'> - * <b>Deprecated</b> - No replacement. - * </div> - * - * @return - * The widgets used for resolving <js>"$W{...}"</js> string variables. - * Never <jk>null</jk>. - */ - @Deprecated - public Map<String,Widget> getWidgets() { - return restJavaMethod == null ? Collections.<String,Widget>emptyMap() : restJavaMethod.widgets; - } - - /** * Creates a proxy interface to retrieve HTTP parts of this request as a proxy bean. * * <h5 class='section'>Examples:</h5> diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/vars/WidgetVar.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/vars/WidgetVar.java deleted file mode 100644 index cd8f87b..0000000 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/vars/WidgetVar.java +++ /dev/null @@ -1,108 +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.vars; - -import java.util.*; - -import org.apache.juneau.html.*; -import org.apache.juneau.html.annotation.*; -import org.apache.juneau.rest.*; -import org.apache.juneau.rest.widget.*; -import org.apache.juneau.svl.*; - -/** - * HTML widget variable resolver. - * - * <div class='warn'> - * <b>Deprecated</b> - Use {@link HtmlWidgetVar} - * </div> - * - * <p> - * The format for this var is <js>"$W{widgetName}"</js>. - * - * <p> - * Widgets are simple class that produce some sort of string based on a passed-in HTTP request. - * - * <p> - * They're registered via the following mechanisms: - * <ul> - * <li>{@link HtmlDocConfig#widgets() @HtmlDocConfig(widgets)} - * </ul> - * - * <ul class='seealso'> - * <li class='link'>{@doc RestSvlVariables} - * </ul> - */ -@Deprecated -public class WidgetVar extends SimpleVar { - - private static final String SESSION_req = "req"; - private static final String SESSION_res = "res"; - - /** - * The name of this variable. - */ - public static final String NAME = "W"; - - /** - * Constructor. - */ - public WidgetVar() { - super(NAME); - } - - @Override /* Var */ - public String resolve(VarResolverSession session, String key) throws Exception { - RestRequest req = session.getSessionObject(RestRequest.class, SESSION_req, true); - RestResponse res = session.getSessionObject(RestResponse.class, SESSION_res, true); - - boolean isScript = false, isStyle = false; - - if (key.endsWith(".script")) { - key = key.substring(0, key.length() - 7); - isScript = true; - } - - if (key.endsWith(".style")) { - key = key.substring(0, key.length() - 6); - isStyle = true; - } - - HtmlWidget w = req.getWidgets().get(key); - - if (w == null) { - Map<String,Widget> widgetMap = session.getSessionObject(Map.class, "htmlWidgets", false); - if (widgetMap != null) - w = widgetMap.get(key); - } - - if (w == null) - return "unknown-widget-"+key; - - if (w instanceof Widget) { - Widget w2 = (Widget)w; - if (isScript) - return w2.getScript(req, res); - if (isStyle) - return w2.getStyle(req, res); - return w2.getHtml(req, res); - } - - return w.getHtml(session); - } - - @Override /* Var */ - public boolean canResolve(VarResolverSession session) { - return session.hasSessionObject(SESSION_req) && session.hasSessionObject(SESSION_res); - } -} \ No newline at end of file