super.init();
// try to get the request processor
// the request processor can be available if it was loaded by a
// listener
// or when working with Spring
RequestProcessor requestProcessor = getRequestProcessor();
if (requestProcessor == null) {
// create the request processor
requestProcessor = createRequestProcessor();
if (requestProcessor == null) {
throw new IllegalStateException(Messages
.getMessage("restServletRequestProcessorCouldNotBeCreated")); //$NON-NLS-1$
}
storeRequestProcessorOnServletContext(requestProcessor);
}
if (requestProcessor.getConfiguration().getServletConfig() == null) {
requestProcessor.getConfiguration().setServletConfig(getServletConfig());
}
if (requestProcessor.getConfiguration().getServletContext() == null) {
requestProcessor.getConfiguration().setServletContext(getServletContext());
}
} catch (Exception e) {
// when exception occurs during the servlet initialization
// it should be marked as unavailable
logger.error(e.getMessage(), e);