【目的】
Production使用WebSphere作为App Server,但主包方开发团队在Dev环境使用Tomcat binding to Eclipse,我更倾向于使用Mave Jetty Plugin——项目本身就是使用Maven进行依赖管理的!
【问题】
主包方开发团队要求在Tomcat的Server.xml中定义Naming Resource,用于访问WS-资源,如下:
* - server.xml * Add the following inside XML Tag <GlobalNamingResources> : <Environment name="wsPathPhq" override="false" type="java.lang.String" value="http://localhost:8080/cis2_ws/"/> <Environment name="wsPathNtn" override="false" type="java.lang.String" value="http://localhost:8080/cis2_ws/"/> <Environment name="defaultSite" override="false" type="java.lang.String" value="PHQ"/> <!-- PHQ or NTN --> <Environment name="uiOffShorePath" override="false" type="java.lang.String" value="http://localhost:8080/cis2_ui/"/> <Environment name="uiOffShoreName" override="false" type="java.lang.String" value="NTN"/>
然后在代码中使用javax.naming.InitialContext.lookup(String)进行查找。 但Jetty如何支持?
【解决方案】
在Jetty.xml中,加入如下部分:
<Configure class="org.eclipse.jetty.webapp.WebAppContext"> <New class="org.eclipse.jetty.plus.jndi.EnvEntry"> <Arg></Arg> <Arg>wsPathPhq</Arg> <Arg type="java.lang.String">http://localhost:8080/cis2_ws/</Arg> <Arg type="boolean">true</Arg> </New> ...
【参考文档】https://wiki.eclipse.org/Jetty/Feature/JNDI
Binding Objects into Jetty JNDI
You can bind four types of object into Jetty JNDI:
- An ordinary POJO instance.
- A java.naming.Reference instance.
- An object instance that implements the java.naming.Referenceable interface.
- A link between a name as referenced in
web.xml
and as referenced in the environment.
The binding for all of these object types follows the same pattern:
<New class=type of naming entry> <Arg>scope</Arg> <Arg>name to bind as</Arg> <Arg>the object to bind</Arg> </New>
Defining Naming Entries
The type of naming entry
can be:
-
"org.eclipse.jetty.plus.jndi.EnvEntry"
for <env-entry>s. -
"org.eclipse.jetty.plus.jndi.Resource"
for all other type of resources. -
"org.eclipse.jetty.plus.jndi.Transaction"
for a JTA manager. For detailed information, see the Configuring XA Transactions section. -
"org.eclipse.jetty.plus.jndi.Link"
for link between aweb.xml
resource name and a NamingEntry. For more information, see the Configuring Links section.
You can define naming entries in three places:
jetty.xml
WEB-INF/jetty-env.xml
- context xml file
相关推荐
NULL 博文链接:https://seraph115.iteye.com/blog/436300
如何在Maven中使用Jetty 如何在Ant中使用Jetty Maven和Ant的更多支持 Jetty Maven插件(Plugin) Jetty Jspc Maven插件(Plugin) Maven web应用工程原型 Ant Jetty插件(Plugin) 使用集成开发环境(IDEs) 在...
jar包版本9.4.8.v20171121,包含jetty-server-9.4.8.v20171121.jar,jetty-servlet-9.4.8.v20171121.jar,...jetty-annotations-9.4.8.v20171121.jarjetty-deploy-9.4.8.v20171121.jar,jetty-jndi-9.4.8.v20171121.jar
将改文件复制到jetty的路径下,可以启动jetty路径去测试
引入到eclipse可以直接使用Starter类运行。 包含必备jar包:jetty-6.1.26.jar,jetty-util-6.1.26,servlet的相关jar包。 jetty入门级源代码。
Jetty使用总结
Jetty9 配置使用HTTPS证书,访问你的服务器更安全,更好的配置方法。
jetty
Jetty嵌入项目代码中示例,现我有一示例项目 e:/workspace/web-demo(称为project_home),里面的Web根目录是WebContent。 在project_home建一个jetty目录,子目录如:contexts、etc、lib。 把${jetty_home}/etc...
gradle的jetty插件使用例子,详细参考:http://blog.csdn.net/xiejx618/article/details/38307289
Jetty配置支持HTTPS以及受信网站证书生成方式
jetty 服务器使用
在javaweb项目中嵌入式使用jetty作为web服务器,下载即可运行
jetty-jndi-9.2.26.v20180806.jar jetty-plus-9.2.26.v20180806.jar jetty-proxy-9.2.26.v20180806.jar jetty-quickstart-9.2.26.v20180806.jar jetty-rewrite-9.2.26.v20180806.jar jetty-schemas-3.1.jar。。。。
OSGI环境搭建-使用JETTY-9.X创建WEB应用-注册Servlet-Jetty性能调优
解决jetty8、jdk1.6环境下的ssl问题,示服务器的瞬时 Diffie-Hellman 公共密钥过弱,可以通过设置如下参数解决
自己写的jetty6在eclipse启动中配置说明
jetty是什么 jetty配置 jetty使用 jetty嵌入 jetty启动 jetty部署 jetty教程 jetty嵌入式 jetty
赠送jar包:jetty-io-9.4.43.v20210629.jar; 赠送原API文档:jetty-io-9.4.43.v20210629-javadoc.jar; 赠送源代码:jetty-io-9.4.43.v...人性化翻译,文档中的代码和结构保持不变,注释和说明精准翻译,请放心使用。