草庐IT

post-parameter

全部标签

java - 使用 spark 将 POST 正文解析为 java 对象

我不久前从spring迁移到spark,现在我停留在一些基本的东西上。当我发出POST请求在正文中发送数据时,我希望将JAVA对象放回Controller中..Spring我曾经做过@RequestBodyUseruser它是自动“填充”的..现在有了spark,我有了方法:request.body();但这给了我一个像这样的序列化字符串:id=7&name=Pablo+Mat%C3%ADas&lastname=Gomez&githubUsername=pablomatiasgomez那么我怎样才能得到用户DTO呢?当然,User类有属性编号姓名姓氏github用户名

java - org.springframework.dao.InvalidDataAccessApiUsageException : No value supplied for the SQL parameter

我正在使用BeanPropertySqlParameterSource和SqlParameterSource开发SpringJDBC示例。当我运行我的代码时,我看到出现以下错误。花了几个小时后,我没有找到它的解决方案。有什么问题请指点。org.springframework.dao.InvalidDataAccessApiUsageException:NovaluesuppliedfortheSQLparameter'employeeId':Invalidproperty'employeeId'ofbeanclass[com.spring.jdbc.model.Order]:Beanp

Java中的HTTP POST请求详解

HTTPPOST请求是HTTP协议中的另一种请求方法,通常用于向指定的资源提交数据,以创建或更新资源。与GET请求不同,POST请求会将请求数据包含在请求体中,而不是通过URL参数传递。这使得POST请求特别适合处理大量数据或敏感信息。在Java中,我们可以使用多种方式发送HTTPPOST请求,其中最常用的方法之一是使用java.net.HttpURLConnection类。此外,还有一些流行的第三方库,如ApacheHttpClient和OkHttp,它们提供了更强大、更灵活的功能。使用java.net.HttpURLConnection发送POST请求下面是一个使用HttpURLConne

java - 使用 response.sendRedirect 方法在 java 中发送 Post 请求

我想用java发送一个post请求。我已经看到使用HttpClient发布请求的示例。但我想使用sendRedirect方法。例如,https://processthis.com/process?name=xyz&phone=9898989898我想使用post请求来发送这些参数。因此,这些参数对任何人都是不可见的,同时我需要将我的网址重定向到该网址,response.sendRedirect("https://processthis.com/process"); 最佳答案 根据带有HTTP/1.1的RFC2616,您可以发送307

java - 解释警告 : non-varargs call of varargs method with inexact argument type for last parameter

这个问题在这里已经有了答案:WhydoIgetacompilationwarninghere(varargsmethodcallinJava)(5个答案)关闭6年前。这是我收到警告的示例代码。StringlsSQL=foMetaQuery.getSQL();StringlsNewSQL=replace(lsSQL,"''{","''{");lsNewSQL=replace(lsNewSQL,"}''","}''");lsNewSQL=replace(lsNewSQL,"}","}");lsNewSQL=MessageFormat.format(lsNewSQL,foSubstituti

java - OffsetDateTime 在 GET 方法中产生 "No injection source found for a parameter of type public javax.ws.rs.core.response"

我有以下GETREST方法:importjava.time.OffsetDateTime;importjavax.ws.rs.Consumes;importjavax.ws.rs.DELETE;importjavax.ws.rs.GET;importjavax.ws.rs.HeaderParam;importjavax.ws.rs.POST;importjavax.ws.rs.PUT;importjavax.ws.rs.Path;importjavax.ws.rs.PathParam;importjavax.ws.rs.Produces;importjavax.ws.rs.QueryP

java - 不支持 Spring Boot 405 POST 方法?

POST方法怎么可能不被SpringBootMVC支持?!我正在尝试实现一个接受实体列表的简单发布方法:这是我的代码@RestController(value="/backoffice/tags")publicclassTagsController{@RequestMapping(value="/add",method=RequestMethod.POST)publicvoidadd(@RequestBodyListkeywords){tagsService.add(keywords);}}像这样点击这个URL:http://localhost:8090/backoffice/tags

java.lang.IllegalArgumentException : FormUrlEncoded can only be specified on HTTP methods with request body (e. g., @POST)

我正在尝试通过API上的GET方法从数据库中获取数据这是我的代码APIServive.InterfacepublicinterfaceAPIService{@FormUrlEncoded@GET("Event")CallviewEvent();}EventModel.JavapublicclassEventModel{@SerializedName("nama_event")Stringnama_event;@SerializedName("jenis_event")Stringjenis_event;@SerializedName("creator")Stringcreator;@S

java - 如何使用 Apache HttpClient 在 Post 请求中对俄语文本进行编码?

Java代码如下:publicstaticvoidregister(UserInfoinfo)throwsClientProtocolException,IOException,JSONException,RegistrationException{Listparams=newArrayList();params.add(newBasicNameValuePair("name",info.getName()));params.add(newBasicNameValuePair("email",info.getEmail()));params.add(newBasicNameValueP

Java 多态性 : How can I avoid type casting input parameters?

假设我们有一个带有compare()函数的Parent接口(interface)。publicinterfaceParent{publicintcompare(ParentotherParent);}假设childChild1、Child2、Child3实现了这个接口(interface)ParentpublicclassChild1implementsParent{@Overridepublicintcompare(Parentother){Child1otherChild=(Child1)other;}}此外,我正在使用泛型代码中的其他地方。所以我需要从代码的其他部分比较两个类型为