org.glassfish.jersey.server.model.internal
Class ModelProcessorUtil

java.lang.Object
  extended by org.glassfish.jersey.server.model.internal.ModelProcessorUtil

public class ModelProcessorUtil
extends Object

Helper class with methods supporting processing resource model by model processors.

Author:
Miroslav Fuksa (miroslav.fuksa at oracle.com), Michal Gajdos (michal.gajdos at oracle.com)

Nested Class Summary
static class ModelProcessorUtil.Method
          Method bean containing basic information about enhancing resource method.
 
Constructor Summary
ModelProcessorUtil()
           
 
Method Summary
static void enhanceResource(RuntimeResource resource, ResourceModel.Builder newModelBuilder, List<ModelProcessorUtil.Method> methods)
           
static ResourceModel.Builder enhanceResourceModel(ResourceModel resourceModel, boolean subResourceModel, List<ModelProcessorUtil.Method> methods)
          Enhance resourceModel by list of methods.
static Set<String> getAllowedMethods(RuntimeResource resource)
          Return allowed methods for the given resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelProcessorUtil

public ModelProcessorUtil()
Method Detail

getAllowedMethods

public static Set<String> getAllowedMethods(RuntimeResource resource)
Return allowed methods for the given resource. 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)
Enhance resourceModel by list of methods. The resourceModel is traversed and for each available endpoint URI in the model methods are added. In case of method conflicts currently existing methods will never be 'overridden' by any method from methods. Overriding check takes into account media types of methods so that new resource methods with same HTTP method can define only more specific media type.

Parameters:
resourceModel - Resource model to be enhanced.
subResourceModel - true if the resourceModel to be enhanced is a sub resource model, false if it is application resource model.
methods - List of enhancing methods.
Returns:
New resource model builder enhanced by methods.

enhanceResource

public static void enhanceResource(RuntimeResource resource,
                                   ResourceModel.Builder newModelBuilder,
                                   List<ModelProcessorUtil.Method> methods)


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.