First thing's first - of course it'll compile. There's nothing wrong with
the code syntax-wise.
The real question is whether it'll perform as expected, and I imagine it
wouldn't.
However, you don't really need it. Keep this method signature (and delete
the other one):
@POST
@Consumes("application/x-www-form-urlencoded")
@Produces("text/html")
public String createNewAcc(
@FormParam("email") String emailAddr,
@FormParam("atype") String AccType,
@FormParam("somethingDifferent") String blah
)
{
...
}
Then, if you need some specific behavior based on blah, check it. If blah
wasn't sent, it'll just be null.
On Tue, Oct 4, 2011 at 19:17, Arthur Yeo <artyyeo_at_gmail.com> wrote:
> All,
>
> Is it possible for two separate POSTs to be supported under a single URI?
>
> For e.g.
> I have a URI ... say ... /newAccount
>
> And, my Jersey code looks like this ...
>
> @Stateless
> @Path("/ca")
> public class ConsumerAccountRsrc {
>
> @POST
> @Consumes("application/x-www-form-urlencoded")
> @Produces("text/html")
> public String createNewAcc(
> @FormParam("email") String emailAddr,
> @FormParam("atype") String AccType)
> {
> ...
> }
>
>
> @POST
> @Consumes("application/x-www-form-urlencoded")
> @Produces("text/html")
> public String createNewAcc(
> @FormParam("email") String emailAddr,
> @FormParam("atype") String AccType,
> @FormParam("somethingDifferent") String
> blah )
> {
> ...
> }
>
> }
>
>
> It seemed to compile but ...
>
>
> --
> Arthur Y.
> *Don't ever forget Sept. 11 !!!*
>
>