webapp.java
来自「RESIN 3.2 最新源码」· Java 代码 · 共 2,683 行 · 第 1/5 页
JAVA
2,683 行
return "com/caucho/server/webapp/resin-web-xml.rnc"; } /** * Enables detailed statistics */ public void setStatisticsEnable(boolean isEnable) { _isStatisticsEnabled = isEnable; } /** * Sets the node for testing Servlet/JSP versions. */ public void setConfigNode(org.w3c.dom.Node node) { String ns = node.getNamespaceURI(); if (ns == null || ns.equals("")) { _jspState = JSP_1; } } /** * Gets the webApp directory. */ public Path getAppDir() { return _appDir; } /** * Gets the dependency container */ public DependencyContainer getInvocationDependency() { return _invocationDependency; } /** * Sets the regexp vars. */ public void setRegexp(ArrayList<String> regexp) { _regexp = regexp; } /** * Gets the regexp vars. */ public ArrayList<String> getRegexp() { return _regexp; } /** * Sets the document directory (app-dir). */ public void setDocumentDirectory(Path appDir) { setAppDir(appDir); } /** * Sets the root directory (app-dir). */ public void setRootDirectory(Path appDir) { } /** * Sets the webApp directory. */ public void setAppDir(Path appDir) { setRootDirectory(appDir); } /** * Returns the ObjectName. */ public ObjectName getObjectName() { return _controller.getObjectName(); } /** * Gets the context path */ public String getContextPath() { return _contextPath; } /** * Sets the context path */ private void setContextPath(String contextPath) { _contextPath = contextPath; if (getServletContextName() == null) setDisplayName(contextPath); } /** * Sets the servlet version. */ public void setVersion(String version) { _servletVersion = version; } /** * Returns the servlet version. */ public String getVersion() { return _servletVersion; } /** * Sets the schema location. */ public void setSchemaLocation(String location) { } public void setDistributable(boolean isDistributable) { } /** * Gets the URL */ public String getURL() { if (_parent != null) return _parent.getURL() + _contextPath; else return _contextPath; } /** * Gets the URL */ public String getHostName() { if (_parent != null) return _parent.getHostName(); else return null; } /** * Gets the URL */ public HostMXBean getHostAdmin() { if (_parent != null && _parent.getHost() != null) return _parent.getHost().getAdmin(); else return null; } /** * A user description of the web-app */ public String getDescription() { return _description; } /** * A user description of the web-app */ public void setDescription(String description) { _description = description; } /** * Sets the icon */ public void setIcon(com.caucho.config.types.Icon icon) { } /** * Sets the servlet init-param EL enabling. */ public void setAllowServletEL(boolean allow) { _servletAllowEL = allow; } /** * If true, disables getContext(). */ public void setDisableCrossContext(boolean isDisable) { _isDisableCrossContext = isDisable; } /** * Sets the old version web-app. */ public void setOldWebApp(WebApp oldWebApp, long expireTime) { _oldWebApp = oldWebApp; _oldWebAppExpireTime = expireTime; } /** * Adds a servlet configuration. */ public ServletConfigImpl createServlet() throws ServletException { ServletConfigImpl config = new ServletConfigImpl(); config.setServletContext(this); config.setAllowEL(_servletAllowEL); return config; } /** * Adds a servlet configuration. */ public void addServlet(ServletConfigImpl config) throws ServletException { config.setServletContext(this); _servletManager.addServlet(config); } /** * Returns the character encoding. */ public String getCharacterEncoding() { return _characterEncoding; } /** * Set true if strict mapping. */ public void setStrictMapping(boolean isStrict) throws ServletException { _isStrictMapping = isStrict; } /** * Get the strict mapping setting. */ public boolean getStrictMapping() { return _isStrictMapping; } /** * Lazy servlet validation. */ public void setLazyServletValidate(boolean isLazy) { _servletManager.setLazyValidate(isLazy); } public ServletMapping createServletMapping() { ServletMapping servletMapping = new ServletMapping(); servletMapping.setServletContext(this); servletMapping.setStrictMapping(getStrictMapping()); return servletMapping; } /** * Adds a servlet-mapping configuration. */ public void addServletMapping(ServletMapping servletMapping) throws ServletException { // log.fine("adding servlet mapping: " + servletMapping); servletMapping.setServletContext(this); servletMapping.init(_servletMapper); } /** * Adds a web service client. */ /* public WebServiceClient createWebServiceClient() { return new WebServiceClient(); } */ /** * Adds a servlet-regexp configuration. */ public void addServletRegexp(ServletRegexp servletRegexp) throws ServletException, ClassNotFoundException { ServletMapping mapping = new ServletMapping(); mapping.addURLRegexp(servletRegexp.getURLRegexp()); mapping.setServletName(servletRegexp.getServletName()); mapping.setServletClass(servletRegexp.getServletClass()); mapping.setServletContext(this); servletRegexp.getBuilderProgram().configure(mapping); mapping.setStrictMapping(getStrictMapping()); mapping.init(_servletMapper); //_servletMapper.addServletRegexp(mapping); } /** * Adds a filter configuration. */ public void addFilter(FilterConfigImpl config) { config.setServletContext(this); _filterManager.addFilter(config); } /** * Adds a filter-mapping configuration. */ public void addFilterMapping(FilterMapping filterMapping) throws ServletException { filterMapping.setServletContext(this); if (filterMapping.isRequest()) { _filterMapper.addFilterMapping(filterMapping); _loginFilterMapper.addFilterMapping(filterMapping); } if (filterMapping.isInclude()) _includeFilterMapper.addFilterMapping(filterMapping); if (filterMapping.isForward()) _forwardFilterMapper.addFilterMapping(filterMapping); if (filterMapping.isError()) _errorFilterMapper.addFilterMapping(filterMapping); } /** * Adds a persistence-context-ref configuration. */ public void addPersistenceContextRef(PersistenceContextRefConfig persistenceContextRefConfig) throws ServletException { // XXX: TCK ejb30/persistence/ee/packaging/web/scope, needs a test case. log.fine("WebApp adding persistence context ref: " + persistenceContextRefConfig.getPersistenceContextRefName()); String unitName = persistenceContextRefConfig.getPersistenceUnitName(); log.fine("WebApp looking up entity manager: " + AmberContainer.getPersistenceContextJndiPrefix() + unitName); Object obj = Jndi.lookup(AmberContainer.getPersistenceContextJndiPrefix() + unitName); log.fine("WebApp found entity manager: " + obj); String contextRefName = persistenceContextRefConfig.getPersistenceContextRefName(); try { Jndi.bindDeep("java:comp/env/" + contextRefName, obj); } catch (NamingException e) { throw ConfigException.create(e); } } /** * Set true if includes wrap filters. */ public void setDispatchWrapsFilters(boolean wrap) { _dispatchWrapsFilters = wrap; } /** * Get true if includes wrap filters. */ public boolean getDispatchWrapsFilters() { return _dispatchWrapsFilters; } /** * (compat) sets the directory servlet */ public void setDirectoryServlet(String className) throws Exception { ServletConfigImpl config = new ServletConfigImpl(); config.setServletName("directory"); if (className.equals("none")) config.setServletClass("com.caucho.servlets.ErrorStatusServlet"); else config.setServletClass(className); addServlet(config); } /** * Adds a welcome file list to the webApp. */ public void addWelcomeFileList(WelcomeFileList list) { ArrayList<String> fileList = list.getWelcomeFileList(); _servletMapper.setWelcomeFileList(fileList); } /** * Configures the locale encoding. */ public LocaleEncodingMappingList createLocaleEncodingMappingList() { return new LocaleEncodingMappingList(this); } /** * Sets inherit session. */ public void setInheritSession(boolean isInheritSession) { _isInheritSession = isInheritSession; } /** * Gets inherit session. */ public boolean isInheritSession() { return _isInheritSession; } /** * Configures the session manager. */ public SessionManager createSessionConfig() throws Exception { if (_isInheritSession) return new SessionManager(this); return getSessionManager(); } /** * Adds the session manager. */ public void addSessionConfig(SessionManager manager) throws ConfigException { if (_isInheritSession) { manager.close(); } } /** * Sets the cookie-http-only */ public void setCookieHttpOnly(boolean isHttpOnly) { _cookieHttpOnly = isHttpOnly; } /** * Sets the cookie-http-only */ public boolean getCookieHttpOnly() { return _cookieHttpOnly; } /** * Sets an init-param */ public InitParam createContextParam() { InitParam initParam = new InitParam(); initParam.setAllowEL(_servletAllowEL); return initParam; } /** * Sets the context param */ public void addContextParam(InitParam initParam) { HashMap<String,String> map = initParam.getParameters(); Iterator<String> iter = map.keySet().iterator(); while (iter.hasNext()) { String key = iter.next(); String value = map.get(key); setInitParameter(key, value); } } /** * Adds an error page */ public void addErrorPage(ErrorPage errorPage) { _errorPageManager.addErrorPage(errorPage); } /** * Sets the access log. */ public AccessLog createAccessLog() { return new AccessLog(); } /** * Sets the access log. */ public void setAccessLog(AbstractAccessLog log) { _accessLog = log;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?