小编Far*_*iba的帖子

为什么找不到 MIME 媒体类型 application/zip?

我需要在我的 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)

java rest web-services media-type

6
推荐指数
1
解决办法
2万
查看次数

我怎么知道线程工作完成了?

在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)

java multithreading

5
推荐指数
1
解决办法
90
查看次数

我可以在Rest Api中为两个班级使用相同的路径吗?

是否可以为两个类定义相同的路径?

@Path("/resource")    
public class ResourceA{
..
..
}

@Path("/resource")
public class ResourceB(){
..
..
}
Run Code Online (Sandbox Code Playgroud)

java rest web-services jax-rs

4
推荐指数
1
解决办法
3497
查看次数

将变量从index.html发送到app.component.ts

我可以将变量从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)

javascript angular

1
推荐指数
1
解决办法
2838
查看次数