Class RewriteLanguageRule
java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.RewriteLanguageRule
Rule that can rewrite a request based on the
Accept-Language
header.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
protected class
Nested classes/interfaces inherited from class org.eclipse.jetty.rewrite.handler.Rule
Rule.Handler, Rule.HttpURIHandler
-
Constructor Summary
ConstructorsConstructorDescriptionRewriteLanguageRule
(boolean prefix) RewriteLanguageRule
(BiFunction<String, String, String> localizePath, BiFunction<Context, String, Resource> getResource) RewriteLanguageRule
(BiFunction<String, String, String> localizePath, BiFunction<Context, String, Resource> getResource, List<String> wildCardLanguages) RewriteLanguageRule
(List<String> wildCardLanguages) -
Method Summary
Modifier and TypeMethodDescriptionstatic Resource
getResource
(Context context, String pathInContext) static String
localizeWithPrefix
(String pathInContext, String language) static String
localizeWithSuffix
(String pathInContext, String language) matchAndApply
(Rule.Handler input) Tests whether the given inputHandler
(which wraps aRequest
) matches the rule, and if so returns an outputHandler
that applies the rule logic.protected Rule.Handler
newLanguageHandler
(Rule.Handler input, String languagePathInContext, String language) toString()
Methods inherited from class org.eclipse.jetty.rewrite.handler.Rule
isTerminating, setTerminating
-
Constructor Details
-
RewriteLanguageRule
public RewriteLanguageRule() -
RewriteLanguageRule
-
RewriteLanguageRule
public RewriteLanguageRule(boolean prefix) -
RewriteLanguageRule
public RewriteLanguageRule(BiFunction<String, String, String> localizePath, BiFunction<Context, String, Resource> getResource) -
RewriteLanguageRule
public RewriteLanguageRule(BiFunction<String, String, String> localizePath, BiFunction<Context, String, Resource> getResource, List<String> wildCardLanguages)
-
-
Method Details
-
localizeWithSuffix
-
localizeWithPrefix
-
getResource
-
matchAndApply
Description copied from class:Rule
Tests whether the given input
Handler
(which wraps aRequest
) matches the rule, and if so returns an outputHandler
that applies the rule logic.If the input does not match,
null
is returned.- Specified by:
matchAndApply
in classRule
- Parameters:
input
- the inputHandler
that wraps theRequest
- Returns:
- an output
Handler
that wraps the inputHandler
, ornull
if the rule does not match - Throws:
IOException
- if applying the rule fails
-
toString
-
getWildCardLanguages
-
newLanguageHandler
protected Rule.Handler newLanguageHandler(Rule.Handler input, String languagePathInContext, String language)
-