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

Sergey Beryozkin resolved CXF-5916.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 3.1.0
                   3.0.2
                   2.7.13
         Assignee: Sergey Beryozkin

> WADL contains wrong parameter name for parameter beans
> ------------------------------------------------------
>
>                 Key: CXF-5916
>                 URL: https://issues.apache.org/jira/browse/CXF-5916
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.0.0, 3.0.1
>            Reporter: Enrico Scheider
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>             Fix For: 2.7.13, 3.0.2, 3.1.0
>
>
> I'm using auto generated wadl from jax-rs annotated service beans in 
> conjunction with cxf parameter bean extension (cool feature ;-), thx. alot). 
> Wenn accessing the auto generated wadl (url extension ?_wadl) the resulting 
> parameter names are always lower cased and do not reflect e.g. real path 
> variable names when using the parameter bean extension. Assume the following 
> example code (annotated service, sample parameter bean, relevant wadl 
> snippets)...:
> {code:title=MyService.java|borderStyle=solid}
> @Path("sample/{camelCasedVariable}")
> @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
> public class MyService {
>     @GET
>     @Path("test1/{userId}")
>     public Response test1(@PathParam("camelCasedVariable") final String 
> variable, @PathParam("userId") final String id) {
>         return Response.accepted().build();
>     }
>     @GET
>     @Path("test2/{userId}")
>     public Response test2(@PathParam("") final SampleBean bean) {
>         return Response.serverError().build();
>     }
> }
> {code}
> {code:title=SampleBean.java|borderStyle=solid}
> public class SampleBean {
>     private String camelCasedVariable;
>     private String userId;
>     public String getCamelCasedVariable() {
>         return camelCasedVariable;
>     }
>     public void setCamelCasedVariable(final String camelCasedVariable) {
>         this.camelCasedVariable = camelCasedVariable;
>     }
>     public String getUserId() {
>         return userId;
>     }
>     public void setUserId(final String userId) {
>         this.userId = userId;
>     }
> }
> {code}
> ... resulting in the following wadl snippet, shortened:
> {code:xml}
> <!-- intro, grammer,... -->
> <resources base="http://localhost:8080/services/";>
>     <resource path="/sample/{camelCasedVariable}/test1/{userId}>
>         <param name="camelCasedVariable" style="template" type="xs:string">
>         <param name="userId" style="template" type="xs:string">
>     </resource>
>     <resource path="/sample/{camelCasedVariable}/test2/{userId}>
>         <param name="camelcasedvariable" style="template" type="xs:string">
>         <param name="userid" style="template" type="xs:string">
>     </resource>
> </resources>
> {code}
> In test1 standard jax-rs annotations have been used and generated wadl part 
> is ok. In test2 cxf-parameter bean has been used, resulting in lowercased 
> variable names which seems to be incorrect. Same occurs when using parameter 
> beans in QueryParams, probably on other jax-rs variable type as well 
> (Matrix,Form etc.).
> I've checked the WadlGenerator.java class and found the following referenced 
> code snippet from InjectionUtils.java (cxf-rt-frontend), maybe this is a 
> starting hint for your analysis:
> {code:title=InjectionUtils.java|borderStyle=solid}
> //... 
> public static Map<Parameter, Class<?>> getParametersFromBeanClass(Class<?> 
> beanClass, 
>                                                                       
> ParameterType type,
>                                                                       boolean 
> checkIgnorable) {
>     // some stuff to detect public setter methods...
>    // cxf-3.0.0: line1219 | cxf.3.0.1 line 1224
>    String propertyName = methodName.substring(minLen).toLowerCase();
>   // this propertyName is used as Parameter model name later on...
>   params.put(new Parameter(type, propertyName), m.getReturnType());
> {code}
> From my point of view the propertyName should not be lowercased here.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to