|
From: Bill B. <bb...@re...> - 2008-08-25 21:54:37
|
1) Do you have @Path on your class file? You must have at least
@Path("/") to identify the class as a root resource. Otherwise it gets
ignored.
2) Do you see any stack traces on the server that would help me debug
the problem?
3) Do you have any filters/valves that read the input stream or call
HttpServletRequest.getParameter()? This would screw up the input stream
and Resteasy would not be able to read in the map
4) Any way you could mail me a small test case that reproduces the problem?
5) Can I see your web.xml?
Pranav Parikh wrote:
> Hi,
>
> Thanks a ton for the advice. I upgraded to the version Beta 5. But this
> time, I ran into a new problem. On submitting the form,control never
> goes into the method. It throws the HTTP 404 error "The requested
> resource () is not available".
>
> My code is as follows:
>
> @POST
> @Path("/submitform")
> @ProduceMime("text/plain")
> public String submitForm(MultivaluedMap<String,String> form){
>
> logger.info <http://logger.info>("In submitform "+form);
> return "Submit form called"; // just checking to see if the
> control goes in
>
> }
>
> It will be a great help if you can suggest something about this.
>
>
> Thanks & Regards,
> Pranav
>
>
>
> On Thu, Aug 14, 2008 at 9:05 PM, Bill Burke <bb...@re...
> <mailto:bb...@re...>> wrote:
>
> I've implemented a simple test injecting HttpServletRequest using
> Resteasy Beta 5. I can't reproduce your problem and it works fine
> for me so I don't know what to tell you. Are you using Beta 5?
>
>
> FYI A better way to do this would be:
>
> @ConsumeMime("application/x-www-form-urlencoded")
> public String submitForm(MultivaluedMap<String, String> form) {
> ...
> }
>
> You don't need the @ConsumeMime unless your resource can have
> different data formats posted to it other than form.
>
>
>
>
>
> Pranav Parikh wrote:
>
> Hi,
>
> I'm a beginner in REST.I dont know if this is a right place to
> post this message but I could not find any other place so
> posting it here.
>
> I'm implementing RESTful Web services for my application. I'm
> facing a few problems when submitting the HTML form using the
> HTTP POST method. I'm not able to retrieve the form parameters I
> submit using the POST method. The "request" object is always null.
>
> My servlet code is as follows
>
> import javax.servlet.http.HttpServletRequest;
> import javax.ws.rs.POST;
> import javax.ws.rs.Path;
> import javax.ws.rs.ProduceMime;
> import javax.ws.rs.core.Context;
>
> @POST
> @Path("/submitform")
> @ProduceMime("text/plain")
> public String submitForm(@Context HttpServletRequest request){
> logger.info <http://logger.info>
> <http://logger.info>("In submitform"+request);
>
> if(request!=null){ // the control never goes inside if
> String name = request.getParameter("name");
> String surname = request.getParameter("surname");
> logger.info <http://logger.info>
> <http://logger.info>("Name::"+name+",Surname::"+surname);
>
> return "Name::"+name+",Surname::"+surname;
> }
> return "request is null"; // This gets returned always
> }
>
> My HTML looks like
>
> <html>
> <title>A Test Page
> </title>
> <form method="post" name="form1"
> action="https://localhost:8443/rest/submitform/">
> <table>
> <tr>
> <td>Name::
> </td>
> <td>
> <input type=text name="name" value="">
> </td>
> </tr>
> <tr>
> <td>Surname::
> </td>
> <td>
> <input type=text name="surname" value="">
> </td>
> </tr>
> <tr>
> <td align=center colspan=2>
> <input type=submit name="submit" value="submit">
> </td> </tr>
> </table>
> </form>
> </html>
>
> Any kind help will be appreciated.
>
> Thanks,
> Pranav Parikh
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere
> in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> <mailto:Res...@li...>
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|