More information regarding my previous question:
I modified the web.xml file to allow any user to call the HTTP methods but it did not change anything :
Any idea ? Thanks
I have been looking everywhere, I don't have a clue.
Is this a bug in JBoss Web ?
Let me know please, thanks.
Is that just a 405 error message that you see in the browser? Or do you even see any exception stacktrace on the server? And what happens when you remove the security constraints on your web application?
Thanks for helping jaikiran.
It is a 405 error message that i see in the browser. And also when using a comand line tool like CURL.
I do not see any exception stack trace in the server logs. It does not enter the method at all.
Initially i did not have any security contraints in the webapp and I had this error message already.
Any idea what's wrong ? I tried PUT, POST ... on that very simple method, it just prints a message.
And the class is a simple class. No servlet, ejb etc involved.
Just read one of the Jersey forum threads. Turns out, when you use that URL in the browser, it will be treated as a GET request and since your class doesn't have a @GET, it throws that method not supported error. See this http://markmail.org/thread/ycskzi3ouctkq3ik Jersey forum discussion.
Thanks very much jaikiran pai
Your suggestion on IRC was a good one :
instead of copy-pasting the URL in the browser (or using the CURL tool), I called the URL
inside an HTML form, explicity calling the POST method (with @POST in the java method), like this :
<form id="form2" action="http://localhost:8085/myWebApp/REST/MAJ" method="POST">
<input type="submit" value="Launcher POST">
It works now for the POST method. However, it does not work for the PUT method though (with @PUT in the Java method):
<form id="form2" action="http://localhost:8085/myWebApp/REST/MAJ" method="PUT">
<input type="submit" value="Launcher PUT">
Why is that ?
html "form" method attribute only supports GET and POST. So you won't be able to get PUT working with that. You might need something like the XmlHTTPRequest which you can use to to send requests to the server. See this exampe https://developer.mozilla.org/En/Using_XMLHttpRequest
got it working now
I use the XMLHttpRequest object to test PUT requests.