`
andyjackson
  • 浏览: 57608 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

restlet学习心得——Component

阅读更多



 几天看了ajax的关于restlet的文章,受益匪浅,这里首先要表示感谢!

       在看用Component进行对application管理的时候,老是发现一个500的错误,上面显示大概是无法获得connecter对象的原因。百思不得其解,最后发现原来是我的restlet包的版本不对,改为1.1.9后马上好了。

下面顺便把配置默认Component的方法贴出来:

<context-param>
		<param-name>org.restlet.application</param-name>
		<param-value>firstResource.FirstResourceApplication</param-value>
	</context-param>

 这段代码要从web.xml中去掉,也就是不配置application,交给component去配置。

然后在web-inf文件夹下建一个restlet.xml的文件加入:

<?xml version="1.0" encoding="UTF-8"?>
<component xmlns="http://www.restlet.org/schemas/1.1/Component"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.restlet.org/schemas/1.1/Component">
	<defaultHost>
		<attach uriPattern="/customers/" targetClass="application.CustomerApplication" />
		<attach uriPattern="/orders/" targetClass="application.OrderApplication" />
		<!--
			<attach uriPattern="/efgh/{xyz}"
			targetDescriptor="clap://class/org/restlet/test/MyApplication.wadl"/>
		-->
	</defaultHost>
</component>

    更多详细的说明可以参见ajax的文章,其中还有比较详细的解说

  • 大小: 12.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics