RestService.java revision 21dcdac963f79c098a5ea1a2c5c5e109429c9786
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2015 ForgeRock AS. All rights reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
/**
* External REST connectivity
*
*/
enabled = true)
@Properties({
public class RestService implements SingletonResourceProvider {
/**
* Setup logging for the {@link RestService}.
*/
// Keys in the JSON configuration
// public static final String CONFIG_X = "X";
// Keys in the request parameters to override config
}
}
public Promise<ResourceResponse, ResourceException> patchInstance(Context context, PatchRequest request) {
}
public Promise<ResourceResponse, ResourceException> readInstance(Context context, ReadRequest request) {
}
public Promise<ResourceResponse, ResourceException> updateInstance(Context context, UpdateRequest request) {
}
public Promise<ActionResponse, ResourceException> actionInstance(Context context, ActionRequest request) {
try {
throw new BadRequestException("Invalid action call on "
+ " : missing post body to define what to invoke.");
}
// Whether the data type DATE_FORMAT to return to the caller should be inferred, or is explicitly defined
if (contentType != null) {
} else {
// Default
}
try {
if (extraHeaders == null) {
}
} else {
}
}
try {
// TODO: media type arg?
} else {
}
} catch (ResourceException e) {
throw e;
if (responseEntity != null
&& !(responseEntity instanceof EmptyRepresentation)) {
}
final ResourceException exception =
+ " request: " + e.getMessage(), e);
}
throw exception;
}
try {
return Promises.newResultPromise(
} else {
}
} catch (ResourceException e) {
throw e;
}
} else {
try {
if (respHeaders != null) {
}
}
return Promises.newResultPromise(
}
}
} catch (ResourceException e) {
return e.asPromise();
} finally {
}
}
} catch (ResourceException e) {
return e.asPromise();
} catch (Exception e) {
}
}
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
private void setAttributes(Request request, Map<String, Object> attributes, Map<String, Object> headers) {
if (extraHeaders == null) {
}
}
// attributes.put("request.clientInfo.acceptedMediaTypes",
// new Preference(new MediaType(entry.getValue())));
}
// attributes.put("request.clientInfo.acceptedCharacterSets",
// new Preference(new CharacterSet(headerValue)));
}
// attributes.put("request.clientInfo.acceptedEncodings",
// new Preference(new Encoding(headerValue)));
}
// attributes.put("request.clientInfo.acceptedLanguages",
// new Preference(new Language(headerValue)));
if (i > -1) {
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
}
// [HTTP Connectors]
}
}
try {
} catch (URISyntaxException e) {
}
} else {
long index =
long size =
- index + 1;
}
}
try {
} catch (ParseException e) {
}
}
try {
} catch (ParseException e) {
}
try {
} catch (URISyntaxException e) {
}
}
try {
} catch (ParseException e) {
}
}
try {
} catch (ParseException e) {
}
try {
} catch (ParseException e) {
}
try {
} catch (ParseException e) {
}
Range r;
} else {
}
}
try {
} catch (URISyntaxException e) {
}
// [HTTP Connectors]
// return "message.recipientsInfo";
try {
}
}
} catch (Exception e) {
}
}
} else {
// Custom headers
}
}
}
}
if (n.endsWith("q")) {
} else {
}
}
}
}
// TODO use the
if (!_authenticate.isNull()) {
}
}
// Prepare the request
}
}
return cr;
}
}