我有一个Spring Controller,它有几个RequestMappings用于不同的URI.我的servlet是"ui".servlet的基URI仅适用于尾部斜杠.我希望我的用户不必输入尾部斜杠.
此URI有效:
http://localhost/myapp/ui/
Run Code Online (Sandbox Code Playgroud)
这个没有:
http://localhost/myapp/ui
Run Code Online (Sandbox Code Playgroud)
它给了我一个HTTP状态404消息.
我的web.xml中的servlet和映射是:
<servlet>
<servlet-name>ui</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ui</servlet-name>
<url-pattern>/ui/*</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
我的控制器:
@Controller
public class UiRootController {
@RequestMapping(value={"","/"})
public ModelAndView mainPage() {
DataModel model = initModel();
model.setView("intro");
return new ModelAndView("main", "model", model);
}
@RequestMapping(value={"/other"})
public ModelAndView otherPage() {
DataModel model = initModel();
model.setView("otherPage");
return new ModelAndView("other", "model", model);
}
}
Run Code Online (Sandbox Code Playgroud) 在阅读了一些 Elasticsearch 索引调优指南后,例如如何最大化 Elasticsearch 索引性能和 elastic's Tune for indexing speed,我想看看更新 refresh_interval。
我们正在使用 AWS Elasticsearch 域(elasticsearch 6.2 版)。Cloudformation 的文档站点AWS::Elasticsearch::Domain上没有提到 refresh_interval
所以我想看看 AWS Elasticsearch 的默认设置是什么。使用 _settings API 不会显示 refresh_interval。
GET /my_index/_settings
Run Code Online (Sandbox Code Playgroud)
并且指定 refresh_interval 也不显示任何内容。
GET /my_index/_settings/index.refresh_interval
Run Code Online (Sandbox Code Playgroud)
只返回一个空对象。
{}
Run Code Online (Sandbox Code Playgroud)
如何找到 Elasticsearch 的当前 refresh_interval?
我有一个文件,其中每一行都是一个 JSON 对象。我想将文件转换为 JSON 数组。
该文件看起来像这样:
{"address":"email1@foo.bar.com", "topic":"Some topic."}
{"address":"email2@foo.bar.com", "topic":"Another topic."}
{"address":"email3@foo.bar.com", "topic":"Yet another topic."}
Run Code Online (Sandbox Code Playgroud)
我正在使用 bash 和 jq。
我试过
jq --slurp --raw-input 'split("\n")[:-1]' my_file
Run Code Online (Sandbox Code Playgroud)
但这只是将每一行视为一个字符串,创建一个 JSON 字符串数组。
[
"{\"address\":\"email1@foo.bar.com\", \"topic\":\"Some topic.\"}",
"{\"address\":\"email2@foo.bar.com\", \"topic\":\"Another topic.\"}",
"{\"address\":\"email3@foo.bar.com\", \"topic\":\"Yet another topic.\"}"
]
Run Code Online (Sandbox Code Playgroud)
我想要:
[
{"address":"email1@foo.bar.com", "topic":"Some topic."},
{"address":"email2@foo.bar.com", "topic":"Another topic."},
{"address":"email3@foo.bar.com", "topic":"Yet another topic."}
]
Run Code Online (Sandbox Code Playgroud)