Project

General

Profile

« Previous | Next » 

Revision 50614

1. New rest api
2. Cors filter on web.xml
3. Remove aai

View differences:

BrokerApiImpl.java
132 132
    }
133 133

  
134 134
    @Override
135
    public EventsPage advancedShowEvents(String params) throws BrokerException, JSONException ,IOException {
136
        JSONObject json_params = new JSONObject(params);
135
    public EventsPage advancedShowEvents(String page,String size,AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException {
136
        /*JSONObject json_params = new JSONObject(params);
137 137

  
138 138
        String page = json_params.getString("page");
139 139
        String pagesize = json_params.getString("pagesize");
140 140
        String json_advQueryObject = json_params.getString("advQueryObject");
141 141

  
142 142
        ObjectMapper mapper = new ObjectMapper();
143
        AdvQueryObject advQueryObject = mapper.readValue(json_advQueryObject, AdvQueryObject.class);
143
        AdvQueryObject advQueryObject = mapper.readValue(json_advQueryObject, AdvQueryObject.class);*/
144 144

  
145 145
        final String service = "/events/{page}/{pageSize}";
146 146

  
147 147
        Map<String, Long> uriParams = new HashMap<>();
148 148
        uriParams.put("page", Long.parseLong(page));
149
        uriParams.put("pageSize", Long.parseLong(pagesize));
149
        uriParams.put("pageSize", Long.parseLong(size));
150 150

  
151 151
        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service);
152 152

  
153 153
        MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
154
        headers.add("Content-Type", "application/json");
155

  
156 154
        advQueryObject.setPage(Long.parseLong(page));
157

  
158
        HttpEntity<AdvQueryObject> entity = new HttpEntity<>(advQueryObject, headers);
159

  
155
        HttpEntity<AdvQueryObject> entity = new HttpEntity<>(advQueryObject, httpHeaders);
160 156
        ResponseEntity<EventsPage> resp;
161 157
        try {
162 158
            resp = restTemplate.exchange(
......
223 219
    }
224 220

  
225 221
    @Override
226
    public EventsPage showEvents(String params) throws BrokerException, JSONException {
222
    public EventsPage showEvents(String datasourceName,String topic,String page) throws BrokerException, JSONException {
227 223

  
228
        JSONObject json_params = new JSONObject(params);
224
        /*JSONObject json_params = new JSONObject(params);
229 225

  
230 226
        String datasourceName = json_params.getString("datasourceName");
231 227
        String topic = json_params.getString("topic");
232
        String page = json_params.getString("page");
228
        String page = json_params.getString("page");*/
233 229

  
234 230
        final String service = "/showEvents";
235 231

  

Also available in: Unified diff