SpringSource.org将他们的网站改为http://spring.io
有人知道如何在没有Maven/github的情况下获得最新版本吗?来自http://spring.io/projects
不确定这是否是Spring 5.0.3的一个错误或一个新功能来解决我的问题.
升级后,我收到此错误.有趣的是,此错误仅在我的本地计算机上.使用HTTPS协议的测试环境上的相同代码工作正常.
继续...
我收到此错误的原因是因为我加载生成的JSP页面的URL是/location/thisPage.jsp.评估代码request.getRequestURI()给了我结果/WEB-INF/somelocation//location/thisPage.jsp.如果我将JSP页面的URL修复为此location/thisPage.jsp,则工作正常.
所以我的问题是,我应该/从JSP代码中的路径中删除,因为这是未来需要的.或者Spring引入了一个错误,因为我的机器和测试环境之间的唯一区别是协议HTTP与HTTPS.
org.springframework.security.web.firewall.RequestRejectedException:请求被拒绝,因为URL未规范化.org.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:123)org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:194)org.springframework.security.web.FilterChainProxy .doFilter(FilterChainProxy.java:186)org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
有没有人试图distinct在他们的查询中使用Spring Data for Mongo.如果你有一个例子,请发表它.我应该在哪里以及如何包括distinct flag?
链接到Spring Data Mongo示例 -Example 4.4. Query creation from method names
// Enables the distinct flag for the query
List<Person> findDistinctPeopleByLastnameOrFirstname(String lastname, String firstname);
List<Person> findPeopleDistinctByLastnameOrFirstname(String lastname, String firstname);
Run Code Online (Sandbox Code Playgroud) 安装Mongo使用homebrew.如果我mongo在shell上键入,它会连接到test.但是当我键入ip address本地机器而不是127.0.0.1
mongo --host 192.168.1.100 --verbose
Run Code Online (Sandbox Code Playgroud)
它给了我错误信息
MongoDB shell version: 2.4.6
Fri Aug 23 15:18:27.552 versionArrayTest passed
connecting to: 192.168.1.100:27017/test
Fri Aug 23 15:18:27.579 creating new connection to:192.168.1.100:27017
Fri Aug 23 15:18:27.579 BackgroundJob starting: ConnectBG
Fri Aug 23 15:18:27.580 Error: couldn't connect to server 192.168.1.100:27017 at src/mongo/shell/mongo.js:147
Fri Aug 23 15:18:27.580 User Assertion: 12513:connect failed
Run Code Online (Sandbox Code Playgroud)
尝试mongo.conf通过评论bind_ip或通过更改IP地址来修改127.0.0.1,0.0.0.0但没有运气.这应该很简单但现在没有任何线索.用mac.
谢谢
更新:根据要求.这是按照您的建议进行更改后的工作原理.
ifconfig输出
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> …Run Code Online (Sandbox Code Playgroud) 坚持并且不知道为什么Spring Form在预先填充get Request调用时无法成功提交[给出绑定问题] loadForm,但在setupFormObject带有@ModelAttribute注释标记的方法中填充时工作正常.我可以在github中提供一个简单的例子来测试是否要求:)
以下示例
@ModelAttribute("showForm")
public ShowForm setupFormObject() {
//Instantiate showForm with data
return showForm;
}
@RequestMapping(method = RequestMethod.GET)
public ModelAndView loadForm(@RequestParam("id") String id, HttpSession session) {
ModelAndView modelAndView = new ModelAndView(nextPage);
//Instantiate showForm with data
//modelAndView.addObject("showForm", showForm);
return modelAndView;
}
@RequestMapping(method = RequestMethod.POST)
public String post(@ModelAttribute("showForm") ShowForm showForm, BindingResult result, final RedirectAttributes redirectAttrs) {
//I see changed data here in showForm when populated using @setupFormObject
//See an exception in JSP with binding …Run Code Online (Sandbox Code Playgroud) 我最近切换到OkHttp. 切换后,下面的代码进行上传。
RequestBody requestBody = new MultipartBuilder()
.type(MultipartBuilder.FORM)
.addPart(
Headers.of("Content-Disposition", "form-data; name=\"qqfile\""),
RequestBody.create(
MediaType.parse(filename),
new File(filename)))
.build();
Run Code Online (Sandbox Code Playgroud)
如果您比较图像,则第二张图像具有multipartFiles size = 0. 它应该是size = 1. 如何multipartHttpRequest正确填充使用OkHttp以使服务器接受成功上传?

控制器代码
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.springframework.http.MediaType;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.util.WebUtils;
@RequestMapping (
method = RequestMethod.POST,
value = "/upload",
produces = MediaType.APPLICATION_JSON_VALUE + ";charset=UTF-8"
)
public String upload(
HttpServletRequest request,
HttpServletResponse response
) throws IOException {
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (isMultipart) {
MultipartHttpServletRequest multipartHttpRequest …Run Code Online (Sandbox Code Playgroud) ElasticSearchTemplate在初始化期间引发异常Method threw 'java.lang.StackOverflowError' exception. Cannot evaluate org.elasticsearch.common.inject.InjectorImpl.toString()。
XML配置
<elasticsearch:transport-client id="client" cluster-nodes="localhost:9300" />
<bean name="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
<constructor-arg name="client" ref="client"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
有谁知道是什么引起了这个问题。Elastic版本5.6.3 and 5.5.0和Spring Data Elastic 3.0.1和不使用SpringBoot
搜索了大量的网站,甚至堆栈溢出,但还没有找到解决这个问题的方法.看起来很多人都遇到过这个问题,但似乎缺少一个统一的解决方案,包含了所有方面.已经花了1.5天就可以了.
我看到该方法正在被调用,但某个地方@ResponseBody没有得到正确的翻译.有人可以看看,让我知道问题是什么.我已经在github上载了代码.链接到github上的源代码
@RequestMapping(value = "/find_user", method = RequestMethod.GET)
public @ResponseBody List<String> findUser(@RequestParam("term") String name) {
log.info("Search string for user name: " + name);
List<String> users = new ArrayList<String>();
users.add("Sam");
users.add("Dan");
return users;
}
Run Code Online (Sandbox Code Playgroud)
浏览器屏幕截图下面有406响应

请注意:啊!多么痛苦 此设置适用于Spring 3.1.4,而不适用于3.2.X
我正在使用Spring Social登录我的webapp中的gmail帐户.当我实现这个功能时,一切都还可以,但今天我得到了
javax.net.ssl.SSLPeerUnverifiedException: Host name 'www.googleapis.com' does not match the certificate subject provided by the peer (CN=*.storage.googleapis.com, O=Google Inc, L=Mountain View, ST=California, C=US)
这是堆栈跟踪:
Caused by: javax.net.ssl.SSLPeerUnverifiedException: Host name 'www.googleapis.com' does not match the certificate subject provided by the peer (CN=*.storage.googleapis.com, O=Google Inc, L=Mountain View, ST=California, C=US)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname(SSLConnectionSocketFactory.java:465)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:395)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:84)
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46)
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:52)
at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:94)
at …Run Code Online (Sandbox Code Playgroud) 我尝试使用commandine更新android sdk
./sdkmanager "build-tools;25.0.3"
./sdkmanager "platforms;android-25"
Run Code Online (Sandbox Code Playgroud)
但该项目仍然抱怨,Could not find com.google.firebase:firebase-core:10.2.6.其原因是
// Getting a "Could not find" error? Make sure you have
// the latest Google Repository in the Android SDK manager`.
Run Code Online (Sandbox Code Playgroud)
有人可以指点我从命令行更新或获取Google repository命令
在文本字段中进行更改时,jQuery会调用Spring Controller.我的问题是这个查询如何发送@RequestParam到Controller方法controller/find?
如何Param在此通话中发送额外内容?
$(document).ready(function() {
$( "#id" ).autocomplete({
source: "${pageContext. request. contextPath}/controller/find.htm"
});
});
Run Code Online (Sandbox Code Playgroud)
这有效
@RequestMapping(value = "/find", method = RequestMethod.GET)
public @ResponseBody
List<String> findItem(@RequestParam("term") String id)
Run Code Online (Sandbox Code Playgroud)
但需要类似的东西
@RequestMapping(value = "/find", method = RequestMethod.GET)
public @ResponseBody
List<String> findItem(@RequestParam("term") String id, Additional param here ??)
Run Code Online (Sandbox Code Playgroud)