当前位置:首页 > 网络编程 > WEB编程 > JSP > WebLogic的初步研究(2):结构篇

WebLogic的初步研究(2):结构篇

点击次数:28 次 发布日期:2008-11-26 16:26:50 作者:源代码网
源代码网推荐
  要学习好一套系统首先要了解它的结构,本文详细的介绍 WebLogic 的一些结构和特点:

  WebLogic的大部分配置是在 weblogic.properties 里完成的,只要仔细的研究这个文件就可以清楚得知关于 WebLogic 的一些结构和特点,下面就对 weblogic.properties 文件里的一些配置项作一些说明:

  weblogic.httpd.documentRoot=public_html/

  这就是WebLogic 的WEB 服务器的根目录,即是目录/weblogic/myserver/public_html/

  weblogic.password.system=sdfjkdshfds

  这个前文已经提到,是设置管理员密码。

  weblogic.system.listenPort=7001

  这是设置 WebLogic 的 WEB 服务器端口。

  weblogic.httpd.servlet.classpath=/weblogic/myserver/servletclasses

  设置Servlet存放的路径

  关于Servlet

  出于安全的目的,在 WebLogic 下运行的 WebLogic 最好在 weblogic.properties 里登记后才能运行,例如上文的提到Servlet http://localhost:7001/helloWorld,

  它在weblogic.properties 里的登记项是

  weblogic.httpd.register.helloWorld=examples.servlets.HelloWorldServlet

  实际上,这个 Servlet 的实际路径是

  /weblogic/myserver/servletclasses/examples/servlets/HelloWorldServlet.class

  对照一下weblogic.properties里的登记项和HelloWorldServlet.class文件的路径,应该不难找出其登记Servlet的规律吧。

  在weblogic.properties里有一下几个Servlet的登记项:

  weblogic.httpd.register.AdminEvents=admin.AdminEvents

  weblogic.httpd.register.AdminClients=admin.AdminClients

  weblogic.httpd.register.AdminConnections=admin.AdminConnections

  weblogic.httpd.register.AdminJDBC=admin.AdminJDBC

  weblogic.httpd.register.AdminLicense=admin.AdminLicense

  weblogic.httpd.register.AdminMain=admin.AdminMain

  weblogic.httpd.register.AdminProps=admin.AdminProps

  weblogic.httpd.register.AdminRealm=admin.AdminRealm

  weblogic.httpd.register.AdminThreads=admin.AdminThreads

  weblogic.httpd.register.AdminVersion=admin.AdminVersion

  这就是管理员管理 WebLogic 用的Servlet,通过URL访问http://localhost:7001/AdminMain,在弹出的身份验证对话框了输入 system 和在 weblogic.password.system= 设置的密码,就可以进入 WebLogic 的Web管理界面进行管理。

  如果是为了方便一些,不经登记就使用Servlet,那么可以在 weblogic.properties 里把

  weblogic.allow.execute.weblogic.servlet.classes=everyone

  weblogic.httpd.register.servlets=weblogic.servlet.ServletServlet

  的注释去掉,而对前面的提到的/weblogic/myserver/servletclasses/examples/servlets/HelloWorldServlet.class 的 Servlet 调用的URL是:

  http://localhost:7001/servlets/examples/servlets/HelloWorldServlet

  http://localhost:7001/servlets/examples.servlets.HelloWorldServlet

  对于初学者来说也许不明白,为何目录可以加“.”来区分,我的理解是因为通过阅读源代码得知HelloWorldServlet.class 是属于examples.servlets这个包的,所以也可以以这个URL格式调用。

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华