You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org> on 2019/08/14 13:30:02 UTC

[jira] [Closed] (CXF-8059) @FormParam inside @BeanParam not working

     [ https://issues.apache.org/jira/browse/CXF-8059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh closed CXF-8059.
------------------------------------

> @FormParam inside @BeanParam not working
> ----------------------------------------
>
>                 Key: CXF-8059
>                 URL: https://issues.apache.org/jira/browse/CXF-8059
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.18, 3.2.9, 3.3.2
>         Environment: Linux:
> Linux 5.1.9-arch1-1-ARCH #1 SMP PREEMPT Tue Jun 11 16:18:09 UTC 2019 x86_64 GNU/Linux
> Java:
> openjdk version "1.8.0_212"
> OpenJDK Runtime Environment (build 1.8.0_212-b01)
> OpenJDK 64-Bit Server VM (build 25.212-b01, mixed mode)
>            Reporter: Victor Machado Pasqualino
>            Assignee: Andriy Redko
>            Priority: Major
>             Fix For: 3.2.10, 3.3.3
>
>
> class UserInsert {
> 	@FormParam("name") //not work
> 	private String name;
> 	@HeaderParam("Authorization") //work
> 	private String authorization;
> 	@PathParam("id") //work
> 	private String id;
> 	@QueryParam("login") //work
> 	private String login;
> 	
> 	public void setName(String name) {
> 		this.name = name;
> 	}
> 	
> 	public void setAuthorization(String authorization) {
> 		this.authorization = authorization;
> 	}
> 	
> 	public void setId(String id) {
> 		this.id = id;
> 	}
> 	
> 	public void setLogin(String login) {
> 		this.login = login;
> 	}
> 	
> }
> @Path("user")
> interface UserResource {
> 	
> 	@Path("{id}")
> 	@POST
> 	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
> 	@Produces(MediaType.WILDCARD)
> 	Response save(@BeanParam UserInsert userInsert);
> }
> public class Main {
> 	
> 	public static void main(String[] args) {
> 		
> 		WireMockServer wireMockServer = new WireMockServer(wireMockConfig().port(8080).notifier(new ConsoleNotifier(true)));
> 		wireMockServer.start();
> 		
> 		try {
> 			UserInsert userInsert = new UserInsert();
> 			userInsert.setName("Victor Machado Pasqualino");
> 			userInsert.setAuthorization("Basic YWRtaW46YWRtaW4=");
> 			userInsert.setId("5a4cfa7d-d3bd-4483-968f-b5826ec07712");
> 			userInsert.setLogin("victorpasqualino");
> 			
> 			JAXRSClientFactoryBean jaxrsClientFactory = new JAXRSClientFactoryBean();
> 			jaxrsClientFactory.setAddress("http://localhost:8080/rest");
> 			jaxrsClientFactory.setResourceClass(UserResource.class);
> 			jaxrsClientFactory.getOutInterceptors().add(new LoggingOutInterceptor());
> 			
> 			UserResource userResource = jaxrsClientFactory.create(UserResource.class);
> 			
> 			userResource.save(userInsert);
> 		} finally {
> 			wireMockServer.stop();
> 		}
> 		
> 	}
> }
> Client Request:
> INFO: Outbound Message
> ---------------------------
> ID: 1
> Address: http://localhost:8080/rest/user/5a4cfa7d-d3bd-4483-968f-b5826ec07712?login=victorpasqualino
> Http-Method: POST
> Content-Type: application/x-www-form-urlencoded
> Headers: {Authorization=[Basic YWRtaW46YWRtaW4=], Content-Type=[application/x-www-form-urlencoded], Accept=[application/xml]}
> --------------------------------------
> Server Request:
> 2019-06-19 01:53:29.363 Request was not matched as there were no stubs registered:
> {
>   "url" : "/rest/user/5a4cfa7d-d3bd-4483-968f-b5826ec07712?login=victorpasqualino",
>   "absoluteUrl" : "http://localhost:8080/rest/user/5a4cfa7d-d3bd-4483-968f-b5826ec07712?login=victorpasqualino",
>   "method" : "POST",
>   "clientIp" : "127.0.0.1",
>   "headers" : {
>     "Authorization" : "Basic YWRtaW46YWRtaW4=",
>     "Accept" : "application/xml",
>     "Cache-Control" : "no-cache",
>     "User-Agent" : "Apache-CXF/3.1.18",
>     "Connection" : "keep-alive",
>     "Host" : "localhost:8080",
>     "Pragma" : "no-cache",
>     "Content-Length" : "0",
>     "Content-Type" : "application/x-www-form-urlencoded"
>   },
>   "cookies" : { },
>   "browserProxyRequest" : false,
>   "loggedDate" : 1560905608975,
>   "bodyAsBase64" : "",
>   "body" : "",
>   "scheme" : "http",
>   "host" : "localhost",
>   "port" : 8080,
>   "loggedDateString" : "2019-06-19T00:53:28Z",
>   "queryParams" : {
>     "login" : {
>       "key" : "login",
>       "values" : [ "victorpasqualino" ]
>     }
>   }
> }
> 2019-06-19 01:53:29.368 Request received:
> 127.0.0.1 - POST /rest/user/5a4cfa7d-d3bd-4483-968f-b5826ec07712?login=victorpasqualino
> Authorization: [Basic YWRtaW46YWRtaW4=]
> Accept: [application/xml]
> Cache-Control: [no-cache]
> User-Agent: [Apache-CXF/3.1.18]
> Connection: [keep-alive]
> Host: [localhost:8080]
> Pragma: [no-cache]
> Content-Length: [0]
> Content-Type: [application/x-www-form-urlencoded]



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)