(struts) branch 7.0.x/WW-5453-rename-velocity created (now 1b540c288)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch 7.0.x/WW-5453-rename-velocity in repository https://gitbox.apache.org/repos/asf/struts.git at 1b540c288 WW-5453 Rename VelocityManager interface and default implementation This branch includes the following new commits: new 1b540c288 WW-5453 Rename VelocityManager interface and default implementation The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
(struts) 01/01: WW-5453 Rename VelocityManager interface and default implementation
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch 7.0.x/WW-5453-rename-velocity in repository https://gitbox.apache.org/repos/asf/struts.git commit 1b540c2883f0aadc278204229113ebc55c9b3b89 Author: Kusal Kithul-Godage AuthorDate: Fri Aug 2 19:54:02 2024 +1000 WW-5453 Rename VelocityManager interface and default implementation --- .../struts2/config_browser/ShowBeansAction.java| 4 +- .../OldDecorator2NewStrutsVelocityDecorator.java | 6 +- .../struts2/sitemesh/VelocityDecoratorServlet.java | 17 +- .../struts2/sitemesh/VelocityPageFilter.java | 4 +- ...cityManager.java => StrutsVelocityManager.java} | 10 +- .../velocity/VelocityBeanSelectionProvider.java| 2 +- .../struts2/views/velocity/VelocityManager.java| 372 + .../views/velocity/VelocityManagerInterface.java | 38 --- .../views/velocity/result/VelocityResult.java | 8 +- .../velocity/template/VelocityTemplateEngine.java | 6 +- .../velocity/src/main/resources/struts-plugin.xml | 7 +- ...gerTest.java => StrutsVelocityManagerTest.java} | 64 ++-- 12 files changed, 68 insertions(+), 470 deletions(-) diff --git a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowBeansAction.java b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowBeansAction.java index 6248b6964..53f8eeebc 100644 --- a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowBeansAction.java +++ b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowBeansAction.java @@ -30,7 +30,7 @@ import org.apache.struts2.dispatcher.mapper.ActionMapper; import org.apache.struts2.dispatcher.multipart.MultiPartRequest; import org.apache.struts2.views.freemarker.FreemarkerManager; import org.apache.struts2.views.velocity.VelocityConstants; -import org.apache.struts2.views.velocity.VelocityManagerInterface; +import org.apache.struts2.views.velocity.VelocityManager; import java.util.Map; import java.util.Set; @@ -57,7 +57,7 @@ public class ShowBeansAction extends ActionNamesAction { bindings.put(ActionMapper.class.getName(), addBindings(container, ActionMapper.class, StrutsConstants.STRUTS_MAPPER_CLASS)); bindings.put(MultiPartRequest.class.getName(), addBindings(container, MultiPartRequest.class, StrutsConstants.STRUTS_MULTIPART_PARSER)); bindings.put(FreemarkerManager.class.getName(), addBindings(container, FreemarkerManager.class, StrutsConstants.STRUTS_FREEMARKER_MANAGER_CLASSNAME)); -bindings.put(VelocityManagerInterface.class.getName(), addBindings(container, VelocityManagerInterface.class, VelocityConstants.STRUTS_VELOCITY_MANAGER_CLASSNAME)); +bindings.put(VelocityManager.class.getName(), addBindings(container, VelocityManager.class, VelocityConstants.STRUTS_VELOCITY_MANAGER_CLASSNAME)); bindings.put(UrlRenderer.class.getName(), addBindings(container, UrlRenderer.class, StrutsConstants.STRUTS_URL_RENDERER)); } diff --git a/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/OldDecorator2NewStrutsVelocityDecorator.java b/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/OldDecorator2NewStrutsVelocityDecorator.java index d51745fa0..edc2737a4 100644 --- a/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/OldDecorator2NewStrutsVelocityDecorator.java +++ b/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/OldDecorator2NewStrutsVelocityDecorator.java @@ -29,7 +29,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.apache.struts2.views.velocity.VelocityManagerInterface; +import org.apache.struts2.views.velocity.VelocityManager; import org.apache.velocity.context.Context; import java.io.IOException; @@ -41,10 +41,10 @@ import java.io.PrintWriter; public class OldDecorator2NewStrutsVelocityDecorator extends OldDecorator2NewStrutsDecorator { private static final Logger LOG = LogManager.getLogger(OldDecorator2NewStrutsFreemarkerDecorator.class); -private static VelocityManagerInterface velocityManager; +private static VelocityManager velocityManager; @Inject(required = false) -public static void setVelocityManager(VelocityManagerInterface mgr) { +public static void setVelocityManager(VelocityManager mgr) { velocityManager = mgr; } diff --git a/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/VelocityDecoratorServlet.java b/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/VelocityDecoratorServlet.java index 255571aff..b05e45da0 100644 --- a/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/VelocityDecoratorServlet.java +++ b/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/VelocityDecoratorServlet.java @@ -27,24 +27,23 @@ import com.opens
(struts-site) 01/01: Revert "WW-5391 Update VelocityManager extension interface"
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch revert-229-WW-5391-velocity-ext in repository https://gitbox.apache.org/repos/asf/struts-site.git commit 495664a21353563547e80a23c96431b938048f1e Author: Kusal Kithul-Godage AuthorDate: Fri Aug 2 20:01:15 2024 +1000 Revert "WW-5391 Update VelocityManager extension interface" --- source/plugins/plugins-architecture.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/plugins/plugins-architecture.md b/source/plugins/plugins-architecture.md index 75f4210a8..3d0f30905 100644 --- a/source/plugins/plugins-architecture.md +++ b/source/plugins/plugins-architecture.md @@ -80,7 +80,7 @@ The following extension points are available in Struts 2: | struts.mapper.class | Determines the ActionMapping from a request and a URI from an ActionMapping | singleton | org.apache.struts2.dispatcher.mapper.ActionMapper| | struts.multipart.parser | Parses a multipart request (file upload) | per request | org.apache.struts2.dispatcher.multipart.MultiPartRequest | | struts.freemarker.manager.classname | Loads and processes Freemarker templates | singleton | org.apache.struts2.views.freemarker.FreemarkerManager| -| struts.velocity.manager.classname | Loads and processes Velocity templates | singleton | org.apache.struts2.views.velocity.VelocityManagerInterface | +| struts.velocity.manager.classname | Loads and processes Velocity templates | singleton | org.apache.struts2.views.velocity.VelocityManager | | struts.actionValidatorManager | Main interface for validation managers (regular and annotation based). Handles both the loading of configuration and the actual validation (since 2.1) | singleton | com.opensymphony.xwork2.validator.ActionValidatorManager | | struts.valueStackFactory| Creates value stacks (since 2.1) | singleton | com.opensymphony.xwork2.util.ValueStackFactory | | struts.reflectionProvider | Provides reflection services, key place to plug in a custom expression language (since 2.1) | singleton | com.opensymphony.xwork2.reflection.ReflectionProvider| @@ -319,7 +319,7 @@ public class VelocityBeanSelectionProvider extends AbstractBeanSelectionProvider @Override public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException { -alias(VelocityManagerInterface.class, VelocityConstants.STRUTS_VELOCITY_MANAGER_CLASSNAME, builder, props); +alias(VelocityManager.class, VelocityConstants.STRUTS_VELOCITY_MANAGER_CLASSNAME, builder, props); } }
(struts-site) branch revert-229-WW-5391-velocity-ext created (now 495664a21)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch revert-229-WW-5391-velocity-ext in repository https://gitbox.apache.org/repos/asf/struts-site.git at 495664a21 Revert "WW-5391 Update VelocityManager extension interface" This branch includes the following new commits: new 495664a21 Revert "WW-5391 Update VelocityManager extension interface" The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
(struts-site) branch asf-staging updated: Updates stage by Jenkins
This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-staging in repository https://gitbox.apache.org/repos/asf/struts-site.git The following commit(s) were added to refs/heads/asf-staging by this push: new 489eb76e2 Updates stage by Jenkins 489eb76e2 is described below commit 489eb76e21abe00a52f9dc956fce23d81ba1ee4f Author: jenkins AuthorDate: Fri Aug 2 10:05:30 2024 + Updates stage by Jenkins --- .../ajax-client-side-validation.html | 84 ++--- content/core-developers/csp-interceptor.html | 4 +- content/plugins/json/index.html| 12 +-- content/plugins/json/json-ajax-validation.html | 86 +++--- content/plugins/plugins-architecture.html | 4 +- content/security/index.html| 2 +- .../ajax-and-javascript-recipes.html | 78 ++-- content/tag-developers/ajax-div-template.html | 12 +-- content/tag-developers/ajax-event-system.html | 4 +- 9 files changed, 143 insertions(+), 143 deletions(-) diff --git a/content/core-developers/ajax-client-side-validation.html b/content/core-developers/ajax-client-side-validation.html index 2a86ffe19..c6a0790ce 100644 --- a/content/core-developers/ajax-client-side-validation.html +++ b/content/core-developers/ajax-client-side-validation.html @@ -509,21 +509,21 @@ It takes care of hiding validation errors that might be present, submit the form * * @param event onSubmit event */ -function ajaxFormValidation(event) { -event.preventDefault(); -_removeValidationErrors(); -var _form = $(event.target); -var _formData = _form.serialize(true); +function ajaxFormValidation(event) { +event.preventDefault(); +_removeValidationErrors(); +var _form = $(event.target); +var _formData = _form.serialize(true); // prepare visual feedback // you may want to use other elements here -var originalButton = _form.find('.btn-primary'); +var originalButton = _form.find('.btn-primary'); // note: jQuery returns an array-like object -if (originalButton && originalButton.length && originalButton.length > 0) { -originalButton.hide(); -var feedbackElement = $('').insertAfter(originalButton); +if (originalButton && originalButton.length && originalButton.length > 0) { +originalButton.hide(); +var feedbackElement = $('').insertAfter(originalButton); var restoreFunction = function() { -originalButton.show(); -feedbackElement.remove(); +originalButton.show(); +feedbackElement.remove(); } } var options = { @@ -531,48 +531,48 @@ It takes care of hiding validation errors that might be present, submit the form async: true, processData: false, type: 'POST', -success: function (response, statusText, xhr) { -if (response.location) { +success: function (response, statusText, xhr) { +if (response.location) { // no validation errors // action has been executed and sent a redirect URL wrapped as JSON // cannot use a normal http-redirect (status-code 3xx) as this would be followed by browsers and would not be available here // follow JSON-redirect window.location.href = response.location; } else { -if (restoreFunction) { -restoreFunction(); +if (restoreFunction) { +restoreFunction(); } -_handleValidationResult(_form, response); +_handleValidationResult(_form, response); } }, error: function(xhr, textStatus, errorThrown) { -if (restoreFunction) { -restoreFunction(); +if (restoreFunction) { +restoreFunction(); } // struts sends status code 400 when validation errors are present -if (xhr.status === 400) { -_handleValidationResult(_form, JSON.parse(xhr.responseText)) +if (xhr.status === 400) { +_handleValidationResult(_form, JSON.parse(xhr.responseText)) } else { // a real error occurred -> show user an error message -_handleValidationResult(_form, {errors: ['Network or server error!']}) +_handleValidationResult(_form, {errors: ['Network or server error!']}) } } } // send request, after delay to make sure everybody notices the visual feedback :) -window.setTimeout(function() { +window.setTimeout(function() { var url = _form[0].action; -jQuery.ajax(url, options); +