Class ModelProcessorUtil
java.lang.Object
org.glassfish.jersey.server.model.internal.ModelProcessorUtil
Helper class with methods supporting processing resource model by
model processors.- Author:
- Miroslav Fuksa, Michal Gajdos
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMethod bean containing basic information about enhancing resource method. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidenhanceResource(RuntimeResource resource, ResourceModel.Builder enhancedModelBuilder, List<ModelProcessorUtil.Method> methods, boolean extended) Enhance the runtime resource referenced byresourceparameter with a list of additional methods.static ResourceModel.BuilderenhanceResourceModel(ResourceModel resourceModel, boolean subResourceModel, List<ModelProcessorUtil.Method> methods, boolean extendedFlag) EnhanceresourceModelwith a list of additional methods.getAllowedMethods(RuntimeResource resource) Return allowed methods for the givenresource.
-
Method Details
-
getAllowedMethods
Return allowed methods for the givenresource. OPTIONS and HEAD are always returned in the result.- Parameters:
resource- Resource for which resource methods should be found.- Returns:
- Set of resource methods that can be invoked on the given resource.
-
enhanceResourceModel
public static ResourceModel.Builder enhanceResourceModel(ResourceModel resourceModel, boolean subResourceModel, List<ModelProcessorUtil.Method> methods, boolean extendedFlag) EnhanceresourceModelwith a list of additional methods. TheresourceModelis traversed and for each available runtime resource URI in the modelmethodsare added. In case of method conflicts, the existing resource methods will be preserved and will not be 'overridden' by any new method from themethodslist. Overriding check takes into account media types of methods so that new resource methods with same HTTP method can be defined only for a more more specific media type.- Parameters:
resourceModel- Resource model to be enhanced.subResourceModel-trueif theresourceModelto be enhanced is a sub resource model,falseif it is application resource model.methods- List of enhancing methods.extendedFlag- This flag will initialize the propertyResourceMethod.isExtended().- Returns:
- New resource model builder enhanced by
methods.
-
enhanceResource
public static void enhanceResource(RuntimeResource resource, ResourceModel.Builder enhancedModelBuilder, List<ModelProcessorUtil.Method> methods, boolean extended) Enhance the runtime resource referenced byresourceparameter with a list of additional methods. The newmethodsare added to the runtime resource. In case of method conflicts, the existing resource methods will be preserved and will not be 'overridden' by any new method from themethodslist. Overriding check takes into account media types of methods so that new resource methods with same HTTP method can be defined only for a more more specific media type.- Parameters:
resource- Runtime resource to be enhanced.enhancedModelBuilder- Builder for the enhanced resource model to be used.methods- List of enhancing methods.extended- This flag will initialize the propertyResourceMethod.isExtended().
-