public SetAttributeHandler(HttpHandler next, final String attribute, final String value, final ClassLoader classLoader, boolean preCommit) { this.next = next; this.preCommit = preCommit; ExchangeAttributeParser parser = ExchangeAttributes.parser(classLoader); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); }
public RedirectHandler(final String location) { ExchangeAttributeParser parser = ExchangeAttributes.parser(getClass().getClassLoader()); attribute = parser.parse(location); }
public SetAttributeHandler(HttpHandler next, final String attribute, final String value, final ClassLoader classLoader) { this.next = next; ExchangeAttributeParser parser = ExchangeAttributes.parser(classLoader); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); this.preCommit = false; }
public RedirectHandler(final String location, final ClassLoader classLoader) { ExchangeAttributeParser parser = ExchangeAttributes.parser(classLoader); attribute = parser.parse(location); }
public SetAttributeHandler(HttpHandler next, final String attribute, final String value) { this.next = next; ExchangeAttributeParser parser = ExchangeAttributes.parser(getClass().getClassLoader()); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); this.preCommit = false; }
/** * Adds a request header to the outgoing request. If the header resolves to null or an empty string * it will not be added, however any existing header with the same name will be removed. * <p> * The attribute value will be parsed, and the resulting exchange attribute will be used to create the actual header * value. * * @param header The header name * @param attribute The header value attribute. * @return this */ @Deprecated public ProxyHandler addRequestHeader(final HttpString header, final String attribute, final ClassLoader classLoader) { requestHeaders.put(header, ExchangeAttributes.parser(classLoader).parse(attribute)); return this; }
public SetAttributeHandler(HttpHandler next, final String attribute, final String value, boolean preCommit) { this.next = next; this.preCommit = preCommit; ExchangeAttributeParser parser = ExchangeAttributes.parser(getClass().getClassLoader()); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); }
protected ExchangeAttribute getServletRequestElement(String parameter) { if ("authType".equals(parameter)) { return new SubstituteEmptyWrapper.SubstituteEmptyAttribute(AuthenticationTypeExchangeAttribute.INSTANCE,"-"); } else if ("remoteUser".equals(parameter)) { return new SubstituteEmptyWrapper.SubstituteEmptyAttribute(RemoteUserAttribute.INSTANCE,"-"); } else if ("requestedSessionId".equals(parameter)) { return parser.parse("%{REQUESTED_SESSION_ID}"); } else if ("requestedSessionIdFromCookie".equals(parameter)) { return parser.parse("%{REQUESTED_SESSION_ID_FROM_COOKIE}"); } else if ("requestedSessionIdValid".equals(parameter)) { return parser.parse("%{REQUESTED_SESSION_ID_VALID}"); } else if ("contentLength".equals(parameter)) { return new QuotingExchangeAttribute(new RequestHeaderAttribute(Headers.CONTENT_LENGTH)); } else if ("characterEncoding".equals(parameter)) { return parser.parse("%{REQUEST_CHARACTER_ENCODING}"); } else if ("locale".equals(parameter)) { return parser.parse("%{REQUEST_LOCALE}"); } else if ("protocol".equals(parameter)) { return RequestProtocolAttribute.INSTANCE; } else if ("scheme".equals(parameter)) { return RequestSchemeAttribute.INSTANCE; } else if ("secure".equals(parameter)) { return SecureExchangeAttribute.INSTANCE; } UndertowLogger.ROOT_LOGGER.extendedAccessLogCannotDecodeXParamValue(parameter); return null; }
public SetAttributeHandler(HttpHandler next, final String attribute, final String value, final ClassLoader classLoader) { this.next = next; ExchangeAttributeParser parser = ExchangeAttributes.parser(classLoader); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); this.preCommit = false; }
/** * Creates a predicate that matches the given attribute against a regex. * @param requireFullMatch If a full match is required in order to return true. * @param attribute The attribute to check against. * @param pattern The pattern to look for. */ public static Predicate regex(final String attribute, final String pattern, final ClassLoader classLoader, final boolean requireFullMatch) { return new RegularExpressionPredicate(pattern, ExchangeAttributes.parser(classLoader).parse(attribute), requireFullMatch); }
public SetAttributeHandler(HttpHandler next, final String attribute, final String value, final ClassLoader classLoader, boolean preCommit) { this.next = next; this.preCommit = preCommit; ExchangeAttributeParser parser = ExchangeAttributes.parser(classLoader); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); }
public HttpHandler create(HttpHandler next, String expression, boolean redirect) { if(redirect) { return new RedirectHandler(expression); } else { return new SetAttributeHandler(next, ExchangeAttributes.relativePath(), ExchangeAttributes.parser(getClass().getClassLoader()).parse(expression)); } }
public SetAttributeHandler(HttpHandler next, final String attribute, final String value) { this.next = next; ExchangeAttributeParser parser = ExchangeAttributes.parser(getClass().getClassLoader()); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); this.preCommit = false; }
public AccessLogHandler(final HttpHandler next, final AccessLogReceiver accessLogReceiver, final String formatString, ClassLoader classLoader, Predicate predicate) { this.next = next; this.accessLogReceiver = accessLogReceiver; this.predicate = predicate; this.formatString = handleCommonNames(formatString); this.tokens = ExchangeAttributes.parser(classLoader, new SubstituteEmptyWrapper("-")).parse(this.formatString); }
public SetAttributeHandler(HttpHandler next, final String attribute, final String value, boolean preCommit) { this.next = next; this.preCommit = preCommit; ExchangeAttributeParser parser = ExchangeAttributes.parser(getClass().getClassLoader()); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); }
return Double.valueOf(token.getToken()); } else if (type.equals(ExchangeAttribute.class)) { return attributeParser.parse(token.getToken());
return new SubstituteEmptyWrapper.SubstituteEmptyAttribute(parser.parse("%{sc," + parameter + "}"),"-"); } else if ("C".equals(token)) { return new SubstituteEmptyWrapper.SubstituteEmptyAttribute(new CookieAttribute(parameter),"-"); } else if ("R".equals(token)) { return parser.parse("%{r," + parameter + "}"); } else if ("S".equals(token)) { return new SubstituteEmptyWrapper.SubstituteEmptyAttribute(parser.parse("%{s," + parameter + "}"),"-"); } else if ("H".equals(token)) { return getServletRequestElement(parameter); } else if ("P".equals(token)) { return new SubstituteEmptyWrapper.SubstituteEmptyAttribute(parser.parse("%{rp," + parameter + "}"),"-"); } else if ("O".equals(token)) { return new QuotingExchangeAttribute(new ExchangeAttribute() {
/** * Creates a predicate that matches the given attribute against a regex. * @param requireFullMatch If a full match is required in order to return true. * @param attribute The attribute to check against. * @param pattern The pattern to look for. */ public static Predicate regex(final String attribute, final String pattern, final ClassLoader classLoader, final boolean requireFullMatch) { return new RegularExpressionPredicate(pattern, ExchangeAttributes.parser(classLoader).parse(attribute), requireFullMatch); }
/** * Creates a predicate that matches the given attribute against a regex. * @param requireFullMatch If a full match is required in order to return true. * @param attribute The attribute to check against. * @param pattern The pattern to look for. */ public static Predicate regex(final String attribute, final String pattern, final ClassLoader classLoader, final boolean requireFullMatch) { return new RegularExpressionPredicate(pattern, ExchangeAttributes.parser(classLoader).parse(attribute), requireFullMatch); }
public AccessLogHandler(final HttpHandler next, final AccessLogReceiver accessLogReceiver, final String formatString, ClassLoader classLoader, Predicate predicate) { this.next = next; this.accessLogReceiver = accessLogReceiver; this.predicate = predicate; this.formatString = handleCommonNames(formatString); this.tokens = ExchangeAttributes.parser(classLoader, new SubstituteEmptyWrapper("-")).parse(this.formatString); }