/** * Capture the entire path portion of the {@link Address} into the given {@link Parameter}. * * @param param the name of the {@link Parameter} to which the entire path portion of the {@link Address} will be * bound. */ public static PathAndQuery captureIn(final String param) { PathAndQuery path = new PathAndQuery("{" + param + "}") { @Override public String toString() { return "PathAndQuery.captureIn(\"" + param + "\")"; } }; path.captureIn = param; return path; }
@Override public void setParameterStore(ParameterStore store) { if (captureIn != null) { Parameter<?> parameter = store.get(captureIn); if (parameter instanceof ConfigurableParameter<?>) ((ConfigurableParameter<?>) parameter).constrainedBy(new RegexConstraint(".*")); } if (withRequestBinding) { for (String param : getRequiredParameterNames()) { Parameter<?> parameter = store.get(param); if (parameter instanceof ConfigurableParameter<?>) ((ConfigurableParameter<?>) parameter).bindsTo(RequestBinding.parameter(param)); } withRequestBinding = true; } expression.setParameterStore(store); } }
@Override public void setParameterStore(ParameterStore store) { if (captureIn != null) { Parameter<?> parameter = store.get(captureIn); if (parameter instanceof ConfigurableParameter<?>) ((ConfigurableParameter<?>) parameter).constrainedBy(new RegexConstraint(".*")); } if (withRequestBinding) { for (String param : getRequiredParameterNames()) { Parameter<?> parameter = store.get(param); if (parameter instanceof ConfigurableParameter<?>) ((ConfigurableParameter<?>) parameter).bindsTo(RequestBinding.parameter(param)); } withRequestBinding = true; } expression.setParameterStore(store); } }
/** * Capture the entire path portion of the {@link Address} into the given {@link Parameter}. * * @param param the name of the {@link Parameter} to which the entire path portion of the {@link Address} will be * bound. */ public static PathAndQuery captureIn(final String param) { PathAndQuery path = new PathAndQuery("{" + param + "}") { @Override public String toString() { return "PathAndQuery.captureIn(\"" + param + "\")"; } }; path.captureIn = param; return path; }
@Override public void setParameterStore(ParameterStore store) { if (captureIn != null) { Parameter<?> parameter = store.get(captureIn); if (parameter instanceof ConfigurableParameter<?>) ((ConfigurableParameter<?>) parameter).constrainedBy(new RegexConstraint(".*")); } if (withRequestBinding) { for (String param : getRequiredParameterNames()) { Parameter<?> parameter = store.get(param); if (parameter instanceof ConfigurableParameter<?>) ((ConfigurableParameter<?>) parameter).bindsTo(RequestBinding.parameter(param)); } withRequestBinding = true; } expression.setParameterStore(store); } }
/** * Capture the entire path portion of the {@link Address} into the given {@link Parameter}. * * @param param the name of the {@link Parameter} to which the entire path portion of the {@link Address} will be * bound. */ public static PathAndQuery captureIn(final String param) { PathAndQuery path = new PathAndQuery("{" + param + "}") { @Override public String toString() { return "PathAndQuery.captureIn(\"" + param + "\")"; } }; path.captureIn = param; return path; }
/** * Create a {@link Condition} that compares the current {@link Address#getPathAndQuery()} to the given pattern. * <p> * The given pattern may be parameterized: * <p> * <code> * /example?{param}=foo <br> * /example/{param1}?bar={param2}&p=q <br> * ... * </code> * <p> * * @param pattern {@link ParameterizedPattern} matching the path and query. * * @see ConfigurationRuleParameterBuilder#where(String) */ public static PathAndQuery matches(final String pattern) { return new PathAndQuery(pattern) { @Override public String toString() { return "PathAndQuery.matches(\"" + pattern + "\")"; } }; }
/** * Create a {@link Condition} that compares the current {@link Address#getPathAndQuery()} to the given pattern. * <p> * The given pattern may be parameterized: * <p> * <code> * /example?{param}=foo <br> * /example/{param1}?bar={param2}&p=q <br> * ... * </code> * <p> * * @param pattern {@link ParameterizedPattern} matching the path and query. * * @see ConfigurationRuleParameterBuilder#where(String) */ public static PathAndQuery matches(final String pattern) { return new PathAndQuery(pattern) { @Override public String toString() { return "PathAndQuery.matches(\"" + pattern + "\")"; } }; }
/** * Create a {@link Condition} that compares the current {@link Address#getPathAndQuery()} to the given pattern. * <p> * The given pattern may be parameterized: * <p> * <code> * /example?{param}=foo <br> * /example/{param1}?bar={param2}&p=q <br> * ... * </code> * <p> * * @param pattern {@link ParameterizedPattern} matching the path and query. * * @see ConfigurationRuleParameterBuilder#where(String) */ public static PathAndQuery matches(final String pattern) { return new PathAndQuery(pattern) { @Override public String toString() { return "PathAndQuery.matches(\"" + pattern + "\")"; } }; }