我需要在我的 REST Api 中返回 zip 文件,但我收到 MIME 媒体类型 application/zip 未找到。
@Produces({ "application/zip" })
public Response convertFile(){
.
.
.
return Response.ok(result, "application/zip").build();
}
Run Code Online (Sandbox Code Playgroud) 在B类中,我怎么知道线程的工作完成了?在属性之后,一些工人正在运行.在B班,我需要知道工人是否完成了?
public class A implements InitializingBean{
public void method1(){
...
}
@Override
public void afterPropertiesSet() throws Exception {
System.out.print("test after properties set");
// send threads to executorService
ExecutorService executorService = Executors
.newFixedThreadPool(4);
for (int i = 0; i < 4; i++) {
Worker worker = new Worker();
executorService.submit(worker);
}
}
}
public class Worker implements Callable<Void>{
@Override
public void call(){
...
}
}
public class B{
public void methodB(){
A a = new A();
a.method1();
///Here How can i know …
Run Code Online (Sandbox Code Playgroud) 是否可以为两个类定义相同的路径?
@Path("/resource")
public class ResourceA{
..
..
}
@Path("/resource")
public class ResourceB(){
..
..
}
Run Code Online (Sandbox Code Playgroud) 我可以将变量从index.html发送到app.component.ts吗?我在index.html中有这个脚本,并且我想在将查询参数删除到app.component.ts之前发送可变的url
<script type="text/javascript">
var url = window.location.toString();
if(url.indexOf("?") > 0) {
var sanitizedUrl = url.substring(0, url.indexOf("?"));
window.history.replaceState({}, document.title, sanitizedUrl);
}
</script>
Run Code Online (Sandbox Code Playgroud)