use of com.helger.commons.http.EHttpMethod in project ph-web by phax.
the class XServletHandlerRegistry method copyHandler.
/**
* Copy an existing handler of a certain HTTP method to another HTTP method.
* The same instance of the handler is re-used!
*
* @param eFromMethod
* Source method. May not be <code>null</code>.
* @param aToMethods
* Destination methods. May not be <code>null</code> and may not
* contain <code>null</code> values.
* @return {@link EChange#UNCHANGED} if no existing handler was found,
* {@link EChange#CHANGED} if at least one handler was copied.
* @throws IllegalStateException
* In another handler is already registered for one of the destination
* methods.
* @see #copyHandlerToAll(EHttpMethod)
*/
public EChange copyHandler(@Nonnull final EHttpMethod eFromMethod, @Nonnull @Nonempty final Set<EHttpMethod> aToMethods) {
ValueEnforcer.notNull(eFromMethod, "FromMethod");
ValueEnforcer.notEmptyNoNullValue(aToMethods, "ToMethods");
final IXServletHandler aFromHandler = getHandler(eFromMethod);
if (aFromHandler == null)
return EChange.UNCHANGED;
for (final EHttpMethod eToMethod : aToMethods) registerHandler(eToMethod, aFromHandler, false);
return EChange.CHANGED;
}
Aggregations