[英]Replace content of response in Servlet Filter
I wounder if it is possible to replace some of the content in a Servlet Filter, Using Spring Boot. 如果可以使用Spring Boot替换Servlet过滤器中的某些内容,我会很伤心。
What i want to do is in some java-script files have variables, i can replace dependent on what environment i am using. 我想做的是在某些包含变量的Java脚本文件中,我可以根据所使用的环境进行替换。
Or possible if this functionality already exists, have tried to find but been unsuccessful. 或者,如果此功能已存在,则可能试图找到但未成功。
Here is an example of modifying the entity of a response using Java Servlets. 这是一个使用Java Servlet修改响应实体的示例。 You could use the syntax
${name.of.prop}
in your javascript files, then do a string replace
with values corresponding to that name. 您可以在JavaScript文件中使用语法
${name.of.prop}
,然后用对应于该名称的值replace
字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.