Nuri Ensing
Nuri Ensing

Reputation: 2030

How to return Status code 401 in Java

With my java agent (IBM JVM) I receive a POST from a browser.. If I parse the content and see that the one who send it is not authorized is it then possible (next to my output) to return the HTTP Response code: 401?

Example:

 Session session = getSession();
 AgentContext agentContext = session.getAgentContext();   
 Database db = agentContext.getCurrentDatabase();
 ... 
 parse xml
 ...
 if not authorized then return response code 401 and element 
 <Status xml:lang="en-US" code="401” text="UNAUTHORIZED"> </Status>

Upvotes: 1

Views: 856

Answers (0)

Related Questions