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

David people commented on CXF-2154:
-----------------------------------

Ok here is a simple test case..


Here is the Class

package cxf.rest;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;


public class TestRest {
        
        
            @POST 
            @Path("/testRest/") 
            @Consumes(MediaType.APPLICATION_FORM_URLENCODED) 
            @Produces("text/xml") 
            public Response updateStatus(MultivaluedMap<String, String> params) 
throws Exception { 
                System.out.println(params); 
                return Response.ok(params.getFirst("status")).build(); 
            } 
        } 





Here is the Spring config

<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:jaxws="http://cxf.apache.org/jaxws";
        xmlns:jaxrs="http://cxf.apache.org/jaxrs";
        xmlns:soap="http://cxf.apache.org/bindings/soap";
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                            
http://www.springframework.org/schema/beans/spring-beans.xsd
                            http://cxf.apache.org/jaxws
                            http://cxf.apache.org/schemas/jaxws.xsd
                            http://cxf.apache.org/jaxrs
                                                
http://cxf.apache.org/schemas/jaxrs.xsd";>
        
        
        <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
        <import 
resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"/>
        <import 
resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
        <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />


            <jaxrs:server id="JaxRS-Server" address="/">
       
            <jaxrs:serviceBeans>
                 <ref bean="testRest"/>
            </jaxrs:serviceBeans>
           </jaxrs:server>
    
    
           <bean id="testRest" class="cxf.rest.TestRest">
           </bean>

</beans>



Here is the test html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>
    <form method="POST" 
action="http://localhost:8080/webapp/webservice/testRest"; >
      <input type="text" value="open" name="status"/> 
      <input type="text" value="testing123" name="test1"/> 
      <input type="submit"/> 

        </form>
 </BODY>
</HTML>




Here is the tomcat output
{}


And here is what displays on IE 7
The XML page cannot be displayed 
Cannot view XML input using style sheet. Please correct the error and then 
click the Refresh button, or try again later. 


--------------------------------------------------------------------------------

XML document must have a top level element. Error processing resource 
'http://localhost:8080/webapp/webservice/testRest'. 


I'm beginning to think this is a classpath problem with a bad jar somewhere....

Many thanks....

> Cannot get Form values from MultivaluedMap
> ------------------------------------------
>
>                 Key: CXF-2154
>                 URL: https://issues.apache.org/jira/browse/CXF-2154
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.2
>         Environment: Windows XP Java 1.6 tomcat
>            Reporter: David people
>
> Hi,
>    I'm trying to get All the form fields from a a form which is posted to the 
> restful web service.
>     <form method="POST" 
> action="http://localhost:8080/webapp/webservice/customerservice/temp"; >
>              <input type="text" value="hello" name="param1"/>
>              <input type="text" value="hfsello" name="param2"/>
>              <input type="submit"/>
>     </form>
> I have the following method
> @POST
> @Path("/temp")
> @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
> public String temp(MultivaluedMap<String, String> params){
>      System.out.println("Params = "+params);
>      return "<done>"+params+"</done>";
> }
> The output is always empty, the size of the params object is zero.
> The very same method used to work in a previous version of CXF.
> Is there a new way to use MultivaluedMap?
> Thanks...

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

Reply via email to