You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Guy Dumais (JIRA)" <ji...@apache.org> on 2010/11/18 20:20:16 UTC

[jira] Created: (CXF-3135) WadlGenerator does not respect Consumes annotation

WadlGenerator does not respect Consumes annotation
--------------------------------------------------

                 Key: CXF-3135
                 URL: https://issues.apache.org/jira/browse/CXF-3135
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.3.0
         Environment: any
            Reporter: Guy Dumais
            Priority: Minor


{{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
{code}
 if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
            sb.append("<request>");
            if (isFormRequest(ori)) {
                handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
            } else {
                for (Parameter p : ori.getParameters()) {        
                    handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
                }
            }
            sb.append("</request>");
 }
{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-3135) WadlGenerator does not respect Consumes annotation

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12933767#action_12933767 ] 

Sergey Beryozkin commented on CXF-3135:
---------------------------------------

Can you please provide more information ? I have a test confirming @Consumes is checked.

Just post here a sample class resource with a single method only which uses @Consumes, as well as a sample (JAXB) bean - if this method does expect some XML.


> WadlGenerator does not respect Consumes annotation
> --------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Priority: Minor
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-3135) WadlGenerator does not respect Consumes annotation

Posted by "Guy Dumais (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12933899#action_12933899 ] 

Guy Dumais commented on CXF-3135:
---------------------------------

Thanks for the additional feedback.  Let me review the case I've stumbled upon yesterday and update the description accordingly.

> WadlGenerator does not respect Consumes annotation
> --------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Priority: Minor
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CXF-3135) WadlGenerator does not respect Consumes annotation

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12933860#action_12933860 ] 

Sergey Beryozkin edited comment on CXF-3135 at 11/19/10 11:49 AM:
------------------------------------------------------------------

Hope you appreciate that I can not just change it to 'true' just because it seems like the right thing to do.

As you can see from the code, a check is done if a current method is supposed to handle form submissions or not. If yes then it uses 'false' which alongside with some other parameters indicate to handleRepresentation() that in this case request parameters have to be shown as parameters of the representation which exactly what needs to be done per the WADL spec, where form parameters are shown as query parameters. This is actually a broken way to convey it and will be refactored but this is the way I did id awhile back.

So can you elaborate please on what exactly do you mean that @Consumes is not checked ? If you show me a method signature then it will help. It does not be the signature from the production code, but just needs to show the same annotations that you use in the real case. 


      was (Author: sergey_beryozkin):
    Hope you appreciate that I can not just change it to 'true' just because it seems like the right thing to do.

As you can see from the code, a check is done if a current method is supposed to handle form submissions or not. If yes then it uses 'false' which alongside with some other parameters indicate to handleRepresentation() that in this case request parameters have to be shown as parameters of the representation which exactly what needs to be done per the WADL spec, where form parameters are shown as query parameters. This is actually a broken way to convey it and will be refactored but this is the way I did id awhile back.

So can you elaborate please on what exactly do you that @Consumes is not checked ? If you show me a method signature then it will help. It does not be the signature from the production code, but just needs to show the same annotations that you use in the real case. 

  
> WadlGenerator does not respect Consumes annotation
> --------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Priority: Minor
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-3135) WadlGenerator does not respect Consumes annotation

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin updated CXF-3135:
----------------------------------

    Component/s: JAX-RS

> WadlGenerator does not respect Consumes annotation
> --------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Priority: Minor
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CXF-3135) WadlGenerator does not respect Consumes annotation

Posted by "Guy Dumais (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12934503#action_12934503 ] 

Guy Dumais edited comment on CXF-3135 at 11/22/10 11:28 AM:
------------------------------------------------------------

Here is the example I was concerned with.  It seems that these two methods should generate the same *mediaType attribute* in the request representation element but there are not:
{code}
@Service("wadlTest")
@Path("/resource")
@Description("Shouldn't these two cases give the same representation")
public class WadlTest {
	org.apache.cxf.jaxrs.model.wadl.WadlGenerator wadl;
	
	@POST
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	@Produces(MediaType.APPLICATION_JSON)
	@Description("using MultiValuedMap gives application/x-www-form-urlencoded")
	public String postWithMultiValued(MultivaluedMap<String, String> formParams) {
		String stringParam = formParams.getFirst("stringParam");
		long longParam = Long.parseLong(formParams.getFirst("longParam"));
		return "{}";
	}
	
	@POST
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	@Produces(MediaType.APPLICATION_JSON)
	@Description("using FormParam gives application/json")
	public String postWithFormParam(@FormParam("stringParam") String stringParam,
			@FormParam("longParam") long longParam) {
		return "{}";
	}
}
{code}
The generated WADL with CXF 2.2.9 is 
{code:xml}
<resource path="/resource">
      <doc>Shouldn't these two cases give the same representation</doc>
      <method name="POST">
            <doc>using MultiValuedMap gives application/x-www-form-urlencoded</doc>
            <request>
                  <representation mediaType="application/x-www-form-urlencoded"/>
            </request>
            <response>
                  <!-- Primitive type : xs:string -->
                  <representation mediaType="application/json"/>
            </response>
      </method>
      <method name="POST">
            <doc>using FormParam gives application/json</doc>
            <request>
                  <representation mediaType="application/json">
                        <param name="stringParam" style="query" type="xs:string"/>
                        <param name="longParam" style="query" type="xs:long"/>
                  </representation>
            </request>
            <response>
                  <!-- Primitive type : xs:string -->
                  <representation mediaType="application/json"/>
            </response>
      </method>
</resource>
{code}

      was (Author: guyd):
    Here is the example I was concerned with.  It seems that these two methods should generate the same *request representation* element but there are not:
{code}
@Service("wadlTest")
@Path("/resource")
@Description("Shouldn't these two cases give the same representation")
public class WadlTest {
	org.apache.cxf.jaxrs.model.wadl.WadlGenerator wadl;
	
	@POST
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	@Produces(MediaType.APPLICATION_JSON)
	@Description("using MultiValuedMap gives application/x-www-form-urlencoded")
	public String postWithMultiValued(MultivaluedMap<String, String> formParams) {
		String stringParam = formParams.getFirst("stringParam");
		long longParam = Long.parseLong(formParams.getFirst("longParam"));
		return "{}";
	}
	
	@POST
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	@Produces(MediaType.APPLICATION_JSON)
	@Description("using FormParam gives application/json")
	public String postWithFormParam(@FormParam("stringParam") String stringParam,
			@FormParam("longParam") long longParam) {
		return "{}";
	}
}
{code}
The generated WADL with CXF 2.2.9 is 
{code:xml}
<resource path="/resource">
      <doc>Shouldn't these two cases give the same representation</doc>
      <method name="POST">
            <doc>using MultiValuedMap gives application/x-www-form-urlencoded</doc>
            <request>
                  <representation mediaType="application/x-www-form-urlencoded"/>
            </request>
            <response>
                  <!-- Primitive type : xs:string -->
                  <representation mediaType="application/json"/>
            </response>
      </method>
      <method name="POST">
            <doc>using FormParam gives application/json</doc>
            <request>
                  <representation mediaType="application/json">
                        <param name="stringParam" style="query" type="xs:string"/>
                        <param name="longParam" style="query" type="xs:long"/>
                  </representation>
            </request>
            <response>
                  <!-- Primitive type : xs:string -->
                  <representation mediaType="application/json"/>
            </response>
      </method>
</resource>
{code}
  
> WadlGenerator does not respect Consumes annotation
> --------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Priority: Minor
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-3135) WadlGenerator does not respect Consumes annotation for form requests

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-3135.
-----------------------------------

    Resolution: Fixed

> WadlGenerator does not respect Consumes annotation for form requests
> --------------------------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>             Fix For: 2.3.2, 2.4
>
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-3135) WadlGenerator does not respect Consumes annotation

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12933860#action_12933860 ] 

Sergey Beryozkin commented on CXF-3135:
---------------------------------------

Hope you appreciate that I can not just change it to 'true' just because it seems like the right thing to do.

As you can see from the code, a check is done if a current method is supposed to handle form submissions or not. If yes then it uses 'false' which alongside with some other parameters indicate to handleRepresentation() that in this case request parameters have to be shown as parameters of the representation which exactly what needs to be done per the WADL spec, where form parameters are shown as query parameters. This is actually a broken way to convey it and will be refactored but this is the way I did id awhile back.

So can you elaborate please on what exactly do you that @Consumes is not checked ? If you show me a method signature then it will help. It does not be the signature from the production code, but just needs to show the same annotations that you use in the real case. 


> WadlGenerator does not respect Consumes annotation
> --------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Priority: Minor
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-3135) WadlGenerator does not respect Consumes annotation

Posted by "Guy Dumais (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12934503#action_12934503 ] 

Guy Dumais commented on CXF-3135:
---------------------------------

Here is the example I was concerned with.  It seems that these two methods should generate the same *request representation* element but there are not:
{code}
@Service("wadlTest")
@Path("/resource")
@Description("Shouldn't these two cases give the same representation")
public class WadlTest {
	org.apache.cxf.jaxrs.model.wadl.WadlGenerator wadl;
	
	@POST
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	@Produces(MediaType.APPLICATION_JSON)
	@Description("using MultiValuedMap gives application/x-www-form-urlencoded")
	public String postWithMultiValued(MultivaluedMap<String, String> formParams) {
		String stringParam = formParams.getFirst("stringParam");
		long longParam = Long.parseLong(formParams.getFirst("longParam"));
		return "{}";
	}
	
	@POST
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	@Produces(MediaType.APPLICATION_JSON)
	@Description("using FormParam gives application/json")
	public String postWithFormParam(@FormParam("stringParam") String stringParam,
			@FormParam("longParam") long longParam) {
		return "{}";
	}
}
{code}
The generated WADL with CXF 2.2.9 is 
{code:xml}
<resource path="/resource">
      <doc>Shouldn't these two cases give the same representation</doc>
      <method name="POST">
            <doc>using MultiValuedMap gives application/x-www-form-urlencoded</doc>
            <request>
                  <representation mediaType="application/x-www-form-urlencoded"/>
            </request>
            <response>
                  <!-- Primitive type : xs:string -->
                  <representation mediaType="application/json"/>
            </response>
      </method>
      <method name="POST">
            <doc>using FormParam gives application/json</doc>
            <request>
                  <representation mediaType="application/json">
                        <param name="stringParam" style="query" type="xs:string"/>
                        <param name="longParam" style="query" type="xs:long"/>
                  </representation>
            </request>
            <response>
                  <!-- Primitive type : xs:string -->
                  <representation mediaType="application/json"/>
            </response>
      </method>
</resource>
{code}

> WadlGenerator does not respect Consumes annotation
> --------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Priority: Minor
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-3135) WadlGenerator does not respect Consumes annotation for form requests

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin updated CXF-3135:
----------------------------------

    Fix Version/s: 2.4
                   2.3.2
         Assignee: Sergey Beryozkin
          Summary: WadlGenerator does not respect Consumes annotation for form requests  (was: WadlGenerator does not respect Consumes annotation)

Confirmed, thanks for posting the sample output

> WadlGenerator does not respect Consumes annotation for form requests
> --------------------------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>             Fix For: 2.3.2, 2.4
>
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CXF-3135) WadlGenerator does not respect Consumes annotation

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12933860#action_12933860 ] 

Sergey Beryozkin edited comment on CXF-3135 at 11/19/10 11:50 AM:
------------------------------------------------------------------

Hope you appreciate that I can not just change it to 'true' just because it seems like the right thing to do.

As you can see from the code, a check is done if a current method is supposed to handle form submissions or not. If yes then it uses 'false' which alongside with some other parameters indicate to handleRepresentation() that in this case request parameters have to be shown as parameters of the representation which exactly what needs to be done per the WADL spec, where form parameters are shown as query parameters. This is actually a broken way to convey it and will be refactored but this is the way I did id awhile back.

So can you elaborate please on what exactly do you mean that @Consumes is not checked ? If you show me a method signature then it will help. It does not have to be the signature from the production code, but just needs to show the same annotations that you use in the real case. 


      was (Author: sergey_beryozkin):
    Hope you appreciate that I can not just change it to 'true' just because it seems like the right thing to do.

As you can see from the code, a check is done if a current method is supposed to handle form submissions or not. If yes then it uses 'false' which alongside with some other parameters indicate to handleRepresentation() that in this case request parameters have to be shown as parameters of the representation which exactly what needs to be done per the WADL spec, where form parameters are shown as query parameters. This is actually a broken way to convey it and will be refactored but this is the way I did id awhile back.

So can you elaborate please on what exactly do you mean that @Consumes is not checked ? If you show me a method signature then it will help. It does not be the signature from the production code, but just needs to show the same annotations that you use in the real case. 

  
> WadlGenerator does not respect Consumes annotation
> --------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Priority: Minor
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-3135) WadlGenerator does not respect Consumes annotation

Posted by "Guy Dumais (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12933807#action_12933807 ] 

Guy Dumais commented on CXF-3135:
---------------------------------

I can certainly do that but I feel it is just simpler to take a look at the {{WadlGenerator}} code directly.  The snippet I pasted in the description shows that {{handleRepresentation}} is called with the last parameter set to false while handling the generation of the {{<request>}} element.  That last parameter determines if the representation is for _inbound_ communication.  In this case I believe it should be _true_ not _false_.  

> WadlGenerator does not respect Consumes annotation
> --------------------------------------------------
>
>                 Key: CXF-3135
>                 URL: https://issues.apache.org/jira/browse/CXF-3135
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>         Environment: any
>            Reporter: Guy Dumais
>            Priority: Minor
>
> {{WadlGenerator}} invokes {{handleRepresentation}} with the wrong parameter when creating the {{<request>}} element.  The last parameter of {{handleRepresentation}} should be _true_ not _false_:
> {code}
>  if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
>             sb.append("<request>");
>             if (isFormRequest(ori)) {
>                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
>             } else {
>                 for (Parameter p : ori.getParameters()) {        
>                     handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
>                 }
>             }
>             sb.append("</request>");
>  }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.