blob: f0a0d0d1db53e8e4aaf82f4be0a4e37cc4469a07 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/*******************************************************************************
* Copyright (c) 2013 Frank Becker and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Frank Becker - initial API and implementation
*******************************************************************************/
package org.eclipse.mylyn.internal.bugzilla.rest.core;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.http.HttpStatus;
import org.eclipse.mylyn.commons.core.operations.IOperationMonitor;
import org.eclipse.mylyn.commons.repositories.http.core.CommonHttpResponse;
import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.BugzillaRestErrorResponse;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
public class BugzillaRestValidateRequest extends BugzillaRestAuthenticatedGetRequest<BugzillaRestErrorResponse> {
public BugzillaRestValidateRequest(BugzillaRestHttpClient client) {
super(client);
}
@Override
protected void doValidate(CommonHttpResponse response, IOperationMonitor monitor) throws IOException,
BugzillaRestException {
validate(response, HttpStatus.SC_BAD_REQUEST, monitor);
}
@Override
protected BugzillaRestErrorResponse parseFromJson(InputStreamReader in) {
TypeToken<BugzillaRestErrorResponse> type = new TypeToken<BugzillaRestErrorResponse>() {
};
return new Gson().fromJson(in, type.getType());
}
}
|