List of usage examples for javax.servlet ServletConfig getServletContext
public ServletContext getServletContext();
From source file:org.wso2.carbon.governance.custom.lifecycles.history.ui.clients.LifecycleServiceClient.java
public LifecycleServiceClient(String cookie, ServletConfig config, HttpSession session) throws RegistryException { String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext() .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); epr = backendServerURL + "CustomLifecyclesChecklistAdminService"; try {//from w w w . jav a 2 s . c om stub = new CustomLifecyclesChecklistAdminServiceStub(configContext, epr); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (AxisFault axisFault) { String msg = "Failed to initiate history service client. " + axisFault.getMessage(); log.error(msg, axisFault); throw new RegistryException(msg, axisFault); } }
From source file:com.netcracker.financeapp.controller.spending.SpendingServlet.java
@Override public void init(ServletConfig config) { try {//from www . ja v a 2 s. c om super.init(config); SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext()); } catch (ServletException ex) { Logger.getLogger(SpendingServlet.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:io.github.benas.todolist.web.servlet.user.account.UpdateAccountServlet.java
@Override public void init(ServletConfig servletConfig) throws ServletException { ApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(servletConfig.getServletContext()); userService = applicationContext.getBean(UserService.class); resourceBundle = ResourceBundle.getBundle("todolist"); }
From source file:org.wso2.carbon.registry.relations.ui.clients.RelationServiceClient.java
public RelationServiceClient(String cookie, ServletConfig config, HttpSession session) throws RegistryException { String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext() .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); epr = backendServerURL + "RelationAdminService"; try {/*from w ww. jav a 2 s .co m*/ stub = new RelationAdminServiceStub(configContext, epr); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (AxisFault axisFault) { String msg = "Failed to initiate comment service client. " + axisFault.getMessage(); log.error(msg, axisFault); throw new RegistryException(msg, axisFault); } }
From source file:org.wso2.carbon.governance.custom.lifecycles.history.ui.clients.WSRegistryServiceClient.java
public WSRegistryServiceClient(String cookie, ServletConfig config, HttpSession session) throws RegistryException { String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext() .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); epr = backendServerURL + "WSRegistryService"; try {// w w w. j av a 2s .c o m stub = new WSRegistryServiceStub(configContext, epr); ServiceClient client = stub._getServiceClient(); Options options = client.getOptions(); options.setManageSession(true); options.setProperty(HTTPConstants.COOKIE_STRING, cookie); stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); //Increase the time out when sending large attachments stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(1000000); } catch (AxisFault axisFault) { String msg = "Failed to initiate WSRegistry Service client. " + axisFault.getMessage(); log.error(msg, axisFault); throw new RegistryException(msg, axisFault); } }
From source file:com.enonic.cms.server.service.dwr.DwrServletWrapper.java
@Override public void init(final ServletConfig config) throws ServletException { final ConfigProperties configProperties = getConfigProperties(config.getServletContext()); final Map<String, String> params = new HashMap<String, String>(); params.put("debug", configProperties.getProperty("cms.admin.dwr.debug", "false")); params.put("crossDomainSessionSecurity", configProperties.getProperty("cms.admin.dwr.crossDomainSessionSecurity", "false")); params.put("classes", this.classes.toString()); final ServletConfig wrapper = new ServletConfig() { public String getServletName() { return config.getServletName(); }/*from w w w.j ava 2s.c o m*/ public ServletContext getServletContext() { return config.getServletContext(); } public String getInitParameter(final String name) { return params.get(name); } public Enumeration getInitParameterNames() { return Collections.enumeration(params.keySet()); } }; super.init(wrapper); }
From source file:org.impalaframework.web.integration.BaseLockingProxyServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); ModuleManagementFacade moduleManagementFacade = ImpalaServletUtils .getModuleManagementFacade(config.getServletContext()); this.frameworkLockHolder = moduleManagementFacade.getFrameworkLockHolder(); }
From source file:org.icefaces.push.server.PushServlet.java
public void init(final ServletConfig servletConfig) throws ServletException { super.init(servletConfig); servletContext = servletConfig.getServletContext(); if (LOG.isInfoEnabled()) { LOG.info(new ProductInfo()); }/*from w w w . ja v a2s . c o m*/ try { final Configuration _servletConfigConfiguration = new ServletConfigConfiguration( "org.icefaces.push.server", servletConfig); final Configuration _servletContextConfiguration = new ServletContextConfiguration("com.icesoft.faces", servletContext); pushServerMessageService = new PushServerMessageService( new MessageServiceClient("Push Server MSC", new HttpAdapter(servletContext), servletContext), scheduledThreadPoolExecutor, new ServletContextConfiguration("com.icesoft.net.messaging", servletContext)); pushServerMessageService.setUpNow(); final SessionManager _sessionManager = new SessionManager(_servletConfigConfiguration, pushServerMessageService); SessionDispatcher _sessionDispatcher = new SessionDispatcher(servletContext) { protected PseudoServlet newServer(final HttpSession httpSession, final Monitor monitor, final Authorization authorization) { return new SessionBoundServlet(servletContext, _sessionManager, scheduledThreadPoolExecutor, _servletContextConfiguration, monitor); } }; pathDispatcher.dispatchOn(".*(block\\/message)", ((HttpAdapter) pushServerMessageService.getMessageServiceClient().getMessageServiceAdapter()) .getHttpMessagingDispatcher()); pathDispatcher.dispatchOn(".*", _sessionDispatcher); pushServerMessageService.start(); } catch (Exception exception) { LOG.error("An error occurred while initializing the Push Server!", exception); } }
From source file:org.mobicents.servlet.sip.restcomm.callmanager.gateway.SipGatewayManager.java
private SipURI getLocalInterface(final ServletConfig config) { final ServletContext context = config.getServletContext(); SipURI result = null;/*from w w w .ja va 2s . c o m*/ @SuppressWarnings("unchecked") final List<SipURI> uris = (List<SipURI>) context.getAttribute(OUTBOUND_INTERFACES); for (final SipURI uri : uris) { final String transport = uri.getTransportParam(); if ("udp".equalsIgnoreCase(transport)) { result = uri; } } return result; }
From source file:ro.cs.logaudit.start.InitApplication.java
/** * Initializarea contextului. Aici se preiau nomenclatoarele ce se vor * pastra pe sesiune//w ww . j a va 2s . c o m */ public void init(ServletConfig conf) throws ServletException { logger.info("Initializare aplicatie..."); try { ServletContext sc = conf.getServletContext(); logger.info("*******************************************************"); logger.info("* *"); logger.info("* INITIATING APPLICATION AUDIT-> *"); logger.info("* *"); logger.info("*******************************************************"); logger.info(IConstant.APP_VERSION.concat("/").concat(IConstant.APP_RELEASE_DATE)); sc.setAttribute("VERSION", IConstant.APP_VERSION); sc.setAttribute("RELEASE_DATE", IConstant.APP_RELEASE_DATE); sc.setAttribute("RELEASE_YEAR", IConstant.APP_RELEASE_YEAR); //Nomenclators ListLoader.getInstance().load_nom_resultsPerPage(); ListLoader.getInstance().load_nom_module(); ListLoader.getInstance().load_nom_om_audit_events(); ListLoader.getInstance().load_nom_dm_audit_events(); ListLoader.getInstance().load_nom_cm_audit_events(); ListLoader.getInstance().load_nom_ts_audit_events(); RoleVoter rv = (RoleVoter) AuditContext.getApplicationContext().getBean("roleVoter"); // put exceptionContant bean on servletContect sc.setAttribute(IConstant.EXCEPTION_CONSTANT, ExceptionConstant.getInstance()); sc.setAttribute(IConstant.PERMISSION_CONSTANT, PermissionConstant.getInstance()); sc.setAttribute(IConstant.AUDIT_REPORT_SERVLET, ConfigParametersProvider.getConfigString("audit.report.servlet.url")); logger.info("Role Prefix: \"" + rv.getRolePrefix() + "\""); logger.info("*******************************************************"); logger.info("* *"); logger.info("* INITIATING APPLICATION END AUDIT<- *"); logger.info("* *"); logger.info("*******************************************************"); } catch (Exception ex) { logger.info("*******************************************************"); logger.info("* *"); logger.info("* ERROR INITIATING APPLICATION!!! *"); logger.info("* *"); logger.info("*******************************************************"); logger.error("", ex); } logger.info("The application was initiated!"); }