小编Imr*_*han的帖子

Project facet Java version 1.7 is not supported

When i update my java I found the issue "Project facet Java version 1.7 is not supported" To resolve this issue follow the steps.

  1. Go to Ecllipse , right click on your project folder
  2. select the properties
  3. now select Project Facets ,here you will see java, click on the version and change the higher version to lower or as per your requirement .

在此输入图像描述

java eclipse project facets

34
推荐指数
2
解决办法
5万
查看次数

将列表总结为流的限制

如何获取记录,计数总和应该在限制内。在下面的示例中,Records对象包含 recordId 和计数,我想根据计数的总和应该小于或等于我的限制条件来获取记录数据。

public class Records {
    private int recordID;
    private int count;

    public Records(int recordID, int count) {
        this.recordID = recordID;
        this.count = count;
    }

    public int getRecordID() {
        return recordID;
    }

    public void setRecordID(int recordID) {
        this.recordID = recordID;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }
}


public static void main(String[] args) {
    
    final List<Records> recordList = new ArrayList<>();
    
    recordList.add(new Records(100, 10));
    recordList.add(new Records(501, 20));
    recordList.add(new …
Run Code Online (Sandbox Code Playgroud)

java java-8 java-stream

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

如何使用ContainerRequestContext从HTTP请求获取JSESSIONID?

我在请求中有以下HTTP标头,我想从中提取JSESSIONID它:

Accept=application/json
Accept-Encoding=gzip
deflate,Accept-Language=en-us
Connection=keep-alive
Content-Length=0
Content-Type=application/json
Cookie=JSESSIONID=ss0ox8w99o9142b73rssvc0r
Host=localhost:8080
User-Agent=NFA_QA/34 CFNetwork/720.5.7 Darwin/14.5.0 (x86_64)
Run Code Online (Sandbox Code Playgroud)

我使用ContainerRequestContext如下:

@Override
public void filter(final ContainerRequestContext requestContext) throws IOException {
    System.out.println("***HEADER VALUE**: " + requestContext.getHeaderString("Cookie"));
}
Run Code Online (Sandbox Code Playgroud)

获得结果:

JSESSIONID=zv71od6l2fd41hv6yf0980khy
Run Code Online (Sandbox Code Playgroud)

和:

@Override
public void filter(final ContainerRequestContext requestContext) throws IOException {
    Map<String, javax.ws.rs.core.Cookie> clientCookie = requestContext.getCookies();
    System.out.println("Client Cookie Map: " + clientCookie);
}
Run Code Online (Sandbox Code Playgroud)

获得结果:

Clinet Cookie Map: {JSESSIONID=JSESSIONID=1of1x5u1s1l4hdxfg2azlep42}
Run Code Online (Sandbox Code Playgroud)

JSESSIONID从请求中提取的最佳方法是什么?

java rest jax-rs

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

标签 统计

java ×3

eclipse ×1

facets ×1

java-8 ×1

java-stream ×1

jax-rs ×1

project ×1

rest ×1