use of javax.servlet.ServletConfig in project opennms by OpenNMS.
the class ServletHandler method init.
@Override
public void init() throws ServletException {
String name = "servlet_" + getId();
ServletConfig config = new ServletConfigImpl(name, getContext(), getInitParams());
this.servlet.init(config);
}
use of javax.servlet.ServletConfig in project opennms by OpenNMS.
the class PollerConfigServlet method reloadFiles.
/**
* <p>reloadFiles</p>
*
* @throws javax.servlet.ServletException if any.
*/
public void reloadFiles() throws ServletException {
ServletConfig config = this.getServletConfig();
try {
PollerConfigFactory.init();
pollerFactory = PollerConfigFactory.getInstance();
pollerConfig = pollerFactory.getConfiguration();
if (pollerConfig == null) {
throw new ServletException("Poller Configuration file is empty");
}
} catch (Throwable e) {
throw new ServletException(e.getMessage());
}
initPollerServices();
this.redirectSuccess = config.getInitParameter("redirect.success");
if (this.redirectSuccess == null) {
throw new ServletException("Missing required init parameter: redirect.success");
}
}
use of javax.servlet.ServletConfig in project opennms by OpenNMS.
the class ImportAssetsServlet method init.
/**
* Looks up the <code>redirect.success</code> parameter in the servlet's
* configuration. If not present, this servlet will throw an exception so it will
* be marked unavailable.
*
* @throws javax.servlet.ServletException if any.
*/
@Override
public void init() throws ServletException {
ServletConfig config = this.getServletConfig();
this.redirectSuccess = config.getInitParameter("redirect.success");
if (this.redirectSuccess == null) {
throw new UnavailableException("Require a redirect.success init parameter.");
}
this.model = new AssetModel();
}
use of javax.servlet.ServletConfig in project opennms by OpenNMS.
the class MailerServlet method init.
/**
* <p>init</p>
*
* @throws javax.servlet.ServletException if any.
*/
@Override
public void init() throws ServletException {
ServletConfig config = this.getServletConfig();
this.redirectSuccess = config.getInitParameter("redirect.success");
this.mailProgram = config.getInitParameter("mail.program");
if (this.redirectSuccess == null) {
throw new ServletException("Missing required init parameter: redirect.success");
}
if (this.mailProgram == null) {
throw new ServletException("Missing required init parameter: mail.program");
}
}
use of javax.servlet.ServletConfig in project pratilipi by Pratilipi.
the class GenericService method service.
@Override
protected final void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String requestUri = request.getRequestURI();
ServletConfig servletConfig = getServletConfig();
String prefix = servletConfig.getInitParameter("Prefix");
if (prefix != null && !prefix.isEmpty())
requestUri = requestUri.substring(prefix.length());
if (requestUri.isEmpty())
requestUri = "/";
String apiVer = request.getParameter(RequestParameter.API_VERSION.getName());
GenericApi api = apiVer == null ? ApiRegistry.getApi(requestUri) : ApiRegistry.getApi(requestUri, apiVer);
if (api == null)
super.service(request, response);
else
api.service(request, response);
}
Aggregations