You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jin-Ha Tchoe <ji...@evision.de> on 2007/05/23 20:23:23 UTC

How to generate a 401 HTTP response code on server-side?

Hi,

I'm trying to find out, how to get Axis2 to return a 401 HTTP response
code in case a user provides wrong username and/or password to our
service.
I suspect that this can be accomplished by throwing the right AxisFault,
but I found no information on the values that need to be set.
Does anybody have some information? Am I running in the wrong direction?

Regards,

Jin-Ha Tchoe

Re: [Axis2] How to generate a 401 HTTP response code on server-side?

Posted by Eran Chinthaka <ch...@opensource.lk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Before throwing AxisFault, do the following.

messageContext.setProperty(Constants.HTTP_RESPONSE_STATE,
HttpServletResponse.SC_UNAUTHORIZED);

messageContext.setProperty(Constants.HTTP_BASIC_AUTH_REALM, "put your
basic auth realm");

HTH.
Chinthaka

Jin-Ha Tchoe wrote:
> Hi,
> 
> I'm trying to find out, how to get Axis2 to return a 401 HTTP response
> code in case a user provides wrong username and/or password to our
> service.
> I suspect that this can be accomplished by throwing the right AxisFault,
> but I found no information on the values that need to be set.
> Does anybody have some information? Am I running in the wrong direction?
> 
> Regards,
> 
> Jin-Ha Tchoe

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGVIuyjON2uBzUhh8RAgUBAJ9ReqdVF+FacPhAgUpnOJysuDETewCeOLmJ
nSddxoO3FXur9UIw6Ws9AT8=
=dnxK
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org