[ 
https://issues.apache.org/jira/browse/CXF-8059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16867188#comment-16867188
 ] 

Andriy Redko commented on CXF-8059:
-----------------------------------

Hi [~victorpasqualino],

Could you please try Apache CXF 3.2.9 and confirm that issue is present / not 
present?

Thank you.

Best Regards,

    Andriy Redko

> @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
>         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
>            Priority: Major
>
> 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.3#76005)

Reply via email to