Open onek13 opened 6 years ago
any updates?
JsonResponseList
can you paste the code of JsonResponseList
@manuelarte
Please see code below.
public class JsonResponseList<T> {
private List<T> m_content;
private boolean m_first;
private boolean m_last;
private int m_number;
private int m_numberOfElements;
private int m_size;
private String m_sort;
private long m_totalElements;
private int m_totalPages;
public List<T> getContent() {
return m_content;
}
public int getNumber() {
return (m_number + 1);
}
public int getNumberOfElements() {
return m_numberOfElements;
}
public int getSize() {
return m_size;
}
public String getSort() {
return m_sort;
}
public long getTotalElements() {
return m_totalElements;
}
public int getTotalPages() {
return m_totalPages;
}
public boolean isFirst() {
return m_first;
}
public boolean isLast() {
return m_last;
}
public void setContent(List<T> content) {
m_content = content;
}
public void setFirst(boolean first) {
m_first = first;
}
public void setLast(boolean last) {
m_last = last;
}
public void setNumber(int number) {
m_number = number;
}
public void setNumberOfElements(int numberOfElements) {
m_numberOfElements = numberOfElements;
}
public void setSize(int size) {
m_size = size;
}
public void setSort(String sort) {
m_sort = sort;
}
public void setTotalElements(long totalElements) {
m_totalElements = totalElements;
}
public void setTotalPages(int totalPages) {
m_totalPages = totalPages;
}
}
I'm working on a Spring REST project and wanted to utilize catnap features.
However it seems not fully working if i use PagingAndSortingRepository though i found a work around for it.
I think would be nice if we can directly return the org.springframework.data.domain.Page from our RestControllers and still be able to do partial response filtering.
Please see details below
Sample response / expected response.
Only content from sample response above can do partial response filtering, was not able to get some fields outside the content (eg. totalPages, totalElements) using the code below
Below is the workaround code. Need to somehow copy the properties from org.springframework.data.domain.Page into my custom JsonResponseList