List of usage examples for javax.servlet ServletConfig getServletContext
public ServletContext getServletContext();
From source file:org.wso2.carbon.governance.lcm.ui.clients.LifeCycleManagementServiceClient.java
public LifeCycleManagementServiceClient(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 + "LifeCycleManagementService"; try {//from w ww . j a va 2 s. co m stub = new LifeCycleManagementServiceStub(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 life cycle service client. " + axisFault.getMessage(); log.error(msg, axisFault); throw new RegistryException(msg, axisFault); } }
From source file:org.wso2.carbon.governance.taxonomy.ui.clients.TaxonomyManagementClient.java
public TaxonomyManagementClient(String cookie, ServletConfig config, HttpSession session) throws TaxonomyServicesRegistryExceptionException { String endpointURL;/* ww w . ja v a 2s . c o m*/ String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext() .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); endpointURL = backendServerURL + "TaxonomyServices"; try { stub = new TaxonomyServicesStub(configContext, endpointURL); 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 taxonomy service client. " + axisFault.getMessage(); throw new TaxonomyServicesRegistryExceptionException(msg, axisFault); } }
From source file:org.apache.stratos.status.monitor.ui.clients.HealthMonitorServiceClient.java
public HealthMonitorServiceClient(ServletConfig config, HttpSession session) throws RegistryException { String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext() .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); String epr = backendServerURL + "HealthMonitorService"; try {//from ww w . j ava 2s.com stub = new HealthMonitorServiceStub(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 HealthMonitor Services service client. " + axisFault.getMessage(); log.error(msg, axisFault); throw new RegistryException(msg, axisFault); } }
From source file:org.uberfire.server.UberfireServlet.java
@Override public void init(final ServletConfig config) throws ServletException { UberFireGeneralFactory.setServletContext(config.getServletContext()); try {// ww w. ja va 2s . c o m final String appTemplateRef = getConfig(config, "org.uberfire.template.app"); if (appTemplateRef != null) { appTemplate = compileTemplate(getFileContent(appTemplateRef)); } else { appTemplate = compileTemplate(getResourceContent("app.html.template")); } } catch (Exception ex) { final String headerRef = getConfig(config, "org.uberfire.template.header"); if (headerRef != null) { headerTemplate = compileTemplate(getFileContent(headerRef)); } else { headerTemplate = compileTemplate(getResourceContent("header.html.template")); } final String footerRef = getConfig(config, "org.uberfire.template.footer"); if (footerRef != null) { footerTemplate = compileTemplate(getFileContent(footerRef)); } else { footerTemplate = compileTemplate(getResourceContent("footer.html.template")); } userDataTemplate = compileTemplate(getResourceContent("user_data_on_html.template")); } }
From source file:io.github.benas.todolist.web.servlet.user.account.ChangePasswordServlet.java
@Override public void init(ServletConfig servletConfig) throws ServletException { ApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(servletConfig.getServletContext()); userService = applicationContext.getBean(UserService.class); resourceBundle = ResourceBundle.getBundle("todolist"); //initialize JSR 303 validator ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator();//from w w w . ja v a 2s . co m }
From source file:org.apache.stratos.register.ui.clients.TenantSelfRegistrationClient.java
public TenantSelfRegistrationClient(ServletConfig config, HttpSession session) throws RegistryException { String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext() .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); epr = backendServerURL + "TenantMgtService"; try {/*from w w w. j a v a 2 s . c o m*/ stub = new TenantMgtServiceStub(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 Add Services service client. " + axisFault.getMessage(); log.error(msg, axisFault); throw new RegistryException(msg, axisFault); } }
From source file:org.apache.stratos.account.mgt.ui.clients.UsagePlanClient.java
public UsagePlanClient(ServletConfig config, HttpSession session) throws RegistryException { String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext() .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); String epr = backendServerURL + "BillingDataAccessService"; try {//from w w w . j a va 2 s .c o m stub = new BillingDataAccessServiceStub(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 Add Services service client. " + axisFault.getMessage(); log.error(msg, axisFault); throw new RegistryException(msg, axisFault); } }
From source file:edu.cornell.mannlib.vitro.webapp.controller.freemarker.NavigationController.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); OntModel displayOntModel = (OntModel) config.getServletContext().getAttribute(DISPLAY_ONT_MODEL); this.urlPatterns = new NavigationURLPatternListener(); displayOntModel.getBaseModel().register(urlPatterns); }
From source file:net.danielkvasnicka.flower.FlowerDispatcherServlet.java
/** * Setup Spring managed resources on me/*from w w w . j a v a 2 s. c om*/ */ @Override public void init(final ServletConfig servletConfig) throws ServletException { this.servletConfig = servletConfig; this.appCtx = WebApplicationContextUtils.getWebApplicationContext(servletConfig.getServletContext()); this.appCtx.getAutowireCapableBeanFactory().autowireBeanProperties(this, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, true); }
From source file:org.apache.myfaces.custom.skin.webapp.CachingStyleSheetLoader.java
/** * Retrieves the stylesheet file from the server's temporary directory. * @param request//www .ja v a2 s .co m * @param config * @return Returns the stylesheet file. */ private File getFile(HttpServletRequest request, ServletConfig config) { String uri = request.getRequestURI(); String filename = uri.substring(uri.lastIndexOf('/') + 1); File file = null; File tempDir = (File) config.getServletContext().getAttribute("javax.servlet.context.tempdir"); if (tempDir != null && tempDir.exists()) { String absPath = tempDir.getAbsolutePath() + XhtmlConstants.STYLES_CACHE_DIRECTORY + filename; file = new File(absPath); } return file; }