org.glassfish.jersey.server.model
Class ResourceMethod.Builder

java.lang.Object
  extended by org.glassfish.jersey.server.model.ResourceMethod.Builder
Enclosing class:
ResourceMethod

public static final class ResourceMethod.Builder
extends Object

Resource method model builder.


Method Summary
 ResourceMethod build()
          Build the resource method model and register it with the parent Resource.Builder.
 ResourceMethod.Builder consumes(Collection<javax.ws.rs.core.MediaType> types)
          Add consumed media types supported by the component.
 ResourceMethod.Builder consumes(javax.ws.rs.core.MediaType... types)
          Add consumed media types supported by the component.
 ResourceMethod.Builder consumes(String... types)
          Add consumed media types supported by the component.
 ResourceMethod.Builder encodedParameters(boolean value)
          If set to true, the parameter values will not be automatically decoded.
 ResourceMethod.Builder handledBy(Class<?> handlerClass, Method method)
          Define a resource method handler binding.
 ResourceMethod.Builder handledBy(Class<? extends Inflector> inflectorClass)
          Define an inflector-based resource method handler binding.
 ResourceMethod.Builder handledBy(Inflector<javax.ws.rs.container.ContainerRequestContext,?> inflector)
          Define an inflector-based resource method handler binding.
 ResourceMethod.Builder handledBy(Object handlerInstance, Method method)
          Define a resource method handler binding.
 ResourceMethod.Builder handlingMethod(Method handlingMethod)
          Define a specific method of the handling class that will be executed.
 ResourceMethod.Builder httpMethod(String name)
          Set the associated HTTP method name.
 ResourceMethod.Builder managedAsync()
          Set the managed async required flag on the method model to true.
 ResourceMethod.Builder nameBindings(Annotation... nameBindings)
          Adds name bindings.
 ResourceMethod.Builder nameBindings(Class<? extends Annotation>... nameBindings)
          Adds name bindings.
 ResourceMethod.Builder nameBindings(Collection<Class<? extends Annotation>> nameBindings)
          Adds name bindings.
 ResourceMethod.Builder produces(Collection<javax.ws.rs.core.MediaType> types)
          Add produced media types supported by the component.
 ResourceMethod.Builder produces(javax.ws.rs.core.MediaType... types)
          Add produced media types supported by the component.
 ResourceMethod.Builder produces(String... types)
          Add produced media types supported by the component.
 ResourceMethod.Builder routingResponseType(Type routingResponseType)
          Define the response entity type used during the routing for selection of the resource methods.
 ResourceMethod.Builder suspended(long timeout, TimeUnit unit)
          Mark the component for suspending.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

httpMethod

public ResourceMethod.Builder httpMethod(String name)
Set the associated HTTP method name.

Parameters:
name - HTTP method name.
Returns:
updated builder object.

produces

public ResourceMethod.Builder produces(String... types)
Add produced media types supported by the component.

Parameters:
types - produced media types.
Returns:
updated builder object.

produces

public ResourceMethod.Builder produces(javax.ws.rs.core.MediaType... types)
Add produced media types supported by the component.

Parameters:
types - produced media types.
Returns:
updated builder object.

produces

public ResourceMethod.Builder produces(Collection<javax.ws.rs.core.MediaType> types)
Add produced media types supported by the component.

Parameters:
types - produced media types.
Returns:
updated builder object.

consumes

public ResourceMethod.Builder consumes(String... types)
Add consumed media types supported by the component.

Parameters:
types - consumed media types.
Returns:
updated builder object.

consumes

public ResourceMethod.Builder consumes(javax.ws.rs.core.MediaType... types)
Add consumed media types supported by the component.

Parameters:
types - consumed media types.
Returns:
updated builder object.

consumes

public ResourceMethod.Builder consumes(Collection<javax.ws.rs.core.MediaType> types)
Add consumed media types supported by the component.

Parameters:
types - consumed media types.
Returns:
updated builder object.

nameBindings

public ResourceMethod.Builder nameBindings(Collection<Class<? extends Annotation>> nameBindings)
Adds name bindings. The passed annotation types not annotated with NameBinding meta-annotation will be ignored.

Parameters:
nameBindings - collection of name binding annotation types.
Returns:
updated builder object.

nameBindings

public ResourceMethod.Builder nameBindings(Class<? extends Annotation>... nameBindings)
Adds name bindings. The passed annotation types not annotated with NameBinding meta-annotation will be ignored.

Parameters:
nameBindings - name binding annotation types.
Returns:
updated builder object.

nameBindings

public ResourceMethod.Builder nameBindings(Annotation... nameBindings)
Adds name bindings. The passed annotations not annotated with NameBinding meta-annotation will be ignored.

Parameters:
nameBindings - name binding annotations.
Returns:
updated builder object.

suspended

public ResourceMethod.Builder suspended(long timeout,
                                        TimeUnit unit)
Mark the component for suspending.

An invocation of a component (resource or sub-resource method) marked for suspending will be automatically suspended by the Jersey runtime.

Parameters:
timeout - suspend timeout value.
unit - suspend timeout time unit.
Returns:
updated builder object.

managedAsync

public ResourceMethod.Builder managedAsync()
Set the managed async required flag on the method model to true.

Returns:
updated builder object.

encodedParameters

public ResourceMethod.Builder encodedParameters(boolean value)
If set to true, the parameter values will not be automatically decoded.

Defaults to false.

Parameters:
value - true if the automatic parameter decoding should be disabled, false otherwise.
Returns:
updated builder object.
See Also:
Encoded

handledBy

public ResourceMethod.Builder handledBy(Class<?> handlerClass,
                                        Method method)
Define a resource method handler binding.

Parameters:
handlerClass - concrete resource method handler class.
method - method that will be executed as a resource method. The parameters initializes invocable definition method.
Returns:
updated builder object.

handledBy

public ResourceMethod.Builder handledBy(Object handlerInstance,
                                        Method method)
Define a resource method handler binding.

Parameters:
handlerInstance - concrete resource method handler instance.
method - handling method.
Returns:
updated builder object.

handledBy

public ResourceMethod.Builder handledBy(Inflector<javax.ws.rs.container.ContainerRequestContext,?> inflector)
Define an inflector-based resource method handler binding.

Parameters:
inflector - inflector handling the resource method.
Returns:
updated builder object.

handledBy

public ResourceMethod.Builder handledBy(Class<? extends Inflector> inflectorClass)
Define an inflector-based resource method handler binding.

Parameters:
inflectorClass - class of the inflector handling the resource method.
Returns:
updated builder object.

handlingMethod

public ResourceMethod.Builder handlingMethod(Method handlingMethod)
Define a specific method of the handling class that will be executed. If the method is not defined then the method will be equal to the method initialized by one of the handledBy() builder methods.

Parameters:
handlingMethod - specific handling method.
Returns:
updated builder object.

routingResponseType

public ResourceMethod.Builder routingResponseType(Type routingResponseType)
Define the response entity type used during the routing for selection of the resource methods. If this method is not called then the Invocable.getRoutingResponseType() will be equal to Invocable.getResponseType() which is the default configuration state.

Parameters:
routingResponseType - Routing response type.
Returns:
updated builder object.
See Also:
Invocable.getRoutingResponseType()

build

public ResourceMethod build()
Build the resource method model and register it with the parent Resource.Builder.

Returns:
new resource method model.


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