restlet和ajax,Restlet,CLAP,Ajax和块超时

开发者在使用RESTlet构建服务器时遇到问题:通过Ajax从网页请求JAR中的.js文件时,返回内容被截断,仅获取前7737个字节。尝试关闭CLAP分块编码和静态文件处理,但问题依然存在。寻求解决这个问题的方法和可能的原因分析。
摘要由CSDN通过智能技术生成

我们正在使用RESTlet为我们的项目做一个小的REST服务器.我们在继承自的类中设置了一堆路由Application:

public static void createRestServer(ApplicationContext appCtx, String propertiesPath) throws Exception {

// Create a component

Component component = new Component();

component.getServers().add(Protocol.HTTP, 8081);

component.getClients().add(Protocol.FILE);

component.getClients().add(Protocol.CLAP);

Context context = component.getContext().createChildContext();

RestServer application = new RestServer(context);

application.getContext().getParameters().add("useForwardedForHeader", "true");

application.getContext().getAttributes().put("appCtx", appCtx);

application.getContext().getAttributes().put("file", propertiesPath);

// Attach the application to the component and start it

component.getDefaultHost().attach(application);

component.start();

}

private RestServer(Context context) {

super(context);

}

public synchronized Restlet createInboundRoot() {

Router router = new Router(getContext());

// we then have a bunch of these

router.attach("/accounts/{accountId}", AccountFetcher.class); //LIST Account level

// blah blah blah

// finally some stuff for static files:

//

Directory directory = new Directory(getContext(),

LocalReference.createClapReference(LocalReference.CLAP_CLASS, "/"));

directory.setIndexName("index.html");

router.attach("/", directory);

return router;

}

问题:如果我通过Ajax从网页请求JAR中的.js文件(也通过此JAR中的CLAP加载),它将只返回该文件的前7737个字节然后挂起.我无法让它返回文件的其余部分.它总是在完全相同的字节数后挂起.它有效50次.

任何想法为什么它挂?我可以关闭CLAP和静态文件的分块编码(我们所有的都非常小).

这让我们疯了.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值