public RedirectHandler(final String location) { ExchangeAttributeParser parser = ExchangeAttributes.parser(getClass().getClassLoader()); attribute = parser.parse(location); }
public static ExchangeAttributeParser parser(final ClassLoader classLoader, ExchangeAttributeWrapper ... wrappers) { return new ExchangeAttributeParser(classLoader, Arrays.asList(wrappers)); }
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); }
if (c == '%' || c == '$') { if (pos != i) { attributes.add(wrap(parseSingleToken(valueString.substring(pos, i)))); pos = i; attributes.add(wrap(new ConstantExchangeAttribute("%"))); pos = i + 1; state = 0; } else { attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0; attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0; attributes.add(wrap(new ConstantExchangeAttribute("$"))); pos = i + 1; state = 0; } else { attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0; attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0;
if (c == '%' || c == '$') { if (pos != i) { attributes.add(wrap(parseSingleToken(valueString.substring(pos, i)))); pos = i; attributes.add(wrap(new ConstantExchangeAttribute("%"))); pos = i + 1; state = 0; } else { attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0; attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0; attributes.add(wrap(new ConstantExchangeAttribute("$"))); pos = i + 1; state = 0; } else { attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0; attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0;
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, final ClassLoader classLoader) { this.next = next; ExchangeAttributeParser parser = ExchangeAttributes.parser(classLoader); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); this.preCommit = false; }
if (c == '%' || c == '$') { if (pos != i) { attributes.add(wrap(parseSingleToken(valueString.substring(pos, i)))); pos = i; attributes.add(wrap(new ConstantExchangeAttribute("%"))); pos = i + 1; state = 0; } else { attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0; attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0; attributes.add(wrap(new ConstantExchangeAttribute("$"))); pos = i + 1; state = 0; } else { attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0; attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); pos = i + 1; state = 0;
public static ExchangeAttributeParser parser(final ClassLoader classLoader) { return new ExchangeAttributeParser(classLoader, Collections.<ExchangeAttributeWrapper>emptyList()); }
/** * 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) { this.next = next; ExchangeAttributeParser parser = ExchangeAttributes.parser(getClass().getClassLoader()); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); this.preCommit = false; }
public static ExchangeAttributeParser parser(final ClassLoader classLoader, ExchangeAttributeWrapper ... wrappers) { return new ExchangeAttributeParser(classLoader, Arrays.asList(wrappers)); }
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, boolean preCommit) { this.next = next; this.preCommit = preCommit; ExchangeAttributeParser parser = ExchangeAttributes.parser(getClass().getClassLoader()); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); }
public static ExchangeAttributeParser parser(final ClassLoader classLoader) { return new ExchangeAttributeParser(classLoader, Collections.<ExchangeAttributeWrapper>emptyList()); }
/** * 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) { this.next = next; ExchangeAttributeParser parser = ExchangeAttributes.parser(classLoader); this.attribute = parser.parseSingleToken(attribute); this.value = parser.parse(value); this.preCommit = false; }
public static ExchangeAttributeParser parser(final ClassLoader classLoader, ExchangeAttributeWrapper ... wrappers) { return new ExchangeAttributeParser(classLoader, Arrays.asList(wrappers)); }
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, 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); }