I am developing a RESTful service which has two severs talking to each other, which may be named as external and internal. Internal registers requests to external for further processing. Only external is accessible to users.
For testing reliability my link between internal and external server, I want to simulate HTTP error as returned by external to internal. Is there any easy way to do so or I'll have to hardcode the response being sent by external to internal for testing mainly 5xx and 4xx errors.
Server I am using is JBoss if at all this info is needed.
On searching Google, I found this data for iPlanet
1. edit the obj.conf or your virtual server specific obj.conf
2. Add the following line under
Error code="200" fn="set-variable" error="503"
this would return 503 even for successful serving (which would cause 200 to be returned by the default).
I am looking for something similar for JBoss
I am not aware of a JBoss configuration that will allow you to do this outside of the application. But its easy enough to setup a Resource within your application that would simulate this behavior and remove dependency on vendor specific application server:
@GET @POST @PUT @DELETE
@Path("/echostatus/{statusCode}")
@Produces(MediaType.TEXT_PLAIN, MediaType.TEXT_HTML)
public Response echoStatus(@PathParam("statusCode") final Integer statusCode) {
return Response.status(statusCode.intValue()).build();
}