重放、CLAP、Ajax 和块超时
2022-09-01 03:23:13
						我们正在使用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文件(也通过CLAP从此JAR加载),它只会返回该文件的前7737个字节,然后挂起。我无法让它返回文件的其余部分。它始终在完全相同的字节数后挂起。1/50它的工作原理。
任何想法为什么它挂?我可以关闭CLAP和静态文件的分块编码吗(我们所有的文件都很小)。
这让我们发疯。
 
					 
				 
				    		 
				    		 
				    		