Search in sources :

Example 6 with Request

use of org.forgerock.json.resource.Request in project OpenAM by OpenRock.

the class SmsRequestHandler method addRoute.

private Map<SmsRouteTree, Set<RouteMatcher<Request>>> addRoute(ServiceSchema schema, RoutingMode mode, String path, RequestHandler handler, List<Pattern> ignoredRoutes, SmsRouteTree routeTree) {
    for (Pattern ignored : ignoredRoutes) {
        if (ignored.matcher(path).matches()) {
            return emptyMap();
        }
    }
    SmsRouteTree tree = routeTree == null ? this.routeTree.handles(schema.getServiceName()) : routeTree;
    RouteMatcher<Request> route = tree.addRoute(mode, path, handler);
    return Maps.newHashMap(Collections.singletonMap(tree, asSet(route)));
}
Also used : Pattern(java.util.regex.Pattern) SmsRouteTree(org.forgerock.openam.core.rest.sms.SmsRouteTree) CreateRequest(org.forgerock.json.resource.CreateRequest) DeleteRequest(org.forgerock.json.resource.DeleteRequest) QueryRequest(org.forgerock.json.resource.QueryRequest) ActionRequest(org.forgerock.json.resource.ActionRequest) ReadRequest(org.forgerock.json.resource.ReadRequest) UpdateRequest(org.forgerock.json.resource.UpdateRequest) Request(org.forgerock.json.resource.Request) PatchRequest(org.forgerock.json.resource.PatchRequest)

Aggregations

Request (org.forgerock.json.resource.Request)6 HashMap (java.util.HashMap)4 ActionRequest (org.forgerock.json.resource.ActionRequest)4 CreateRequest (org.forgerock.json.resource.CreateRequest)4 DeleteRequest (org.forgerock.json.resource.DeleteRequest)4 PatchRequest (org.forgerock.json.resource.PatchRequest)4 QueryRequest (org.forgerock.json.resource.QueryRequest)4 ReadRequest (org.forgerock.json.resource.ReadRequest)4 UpdateRequest (org.forgerock.json.resource.UpdateRequest)4 SmsRouteTree (org.forgerock.openam.core.rest.sms.SmsRouteTree)4 HashSet (java.util.HashSet)3 Set (java.util.Set)3 CollectionUtils.asSet (org.forgerock.openam.utils.CollectionUtils.asSet)3 ServiceSchema (com.sun.identity.sm.ServiceSchema)2 Map (java.util.Map)2 EntitlementException (com.sun.identity.entitlement.EntitlementException)1 ServiceManager (com.sun.identity.sm.ServiceManager)1 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)1 ArrayList (java.util.ArrayList)1 Collections.emptyMap (java.util.Collections.emptyMap)1