Package org.rootservices.otter.router
Class Engine
- java.lang.Object
-
- org.rootservices.otter.router.Engine
-
public class Engine extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Engine(Dispatcher dispatcher, Dispatcher notFoundDispatcher)
-
Method Summary
Modifier and Type Method Description protected Answerfound(MatchedLocation foundLocation, Ask ask, Answer answer)DispatchergetDispatcher()DispatchergetNotFoundDispatcher()protected java.lang.Booleanmatches(java.util.Optional<MatchedLocation> matchedLocation, MimeType contentType)protected AnswernotFound(Ask ask, Answer answer)Finds the location from the notFoundDispatcher, executes its route, then returns the answer.Answerroute(Ask ask, Answer answer)protected java.lang.BooleanunsupportedMediaType(java.util.Optional<MatchedLocation> matchedLocation, MimeType contentType)protected AnswerunSupportedMediaType(MatchedLocation foundLocation, Ask ask, Answer answer)
-
-
-
Constructor Detail
-
Engine
public Engine(Dispatcher dispatcher, Dispatcher notFoundDispatcher)
-
-
Method Detail
-
route
public Answer route(Ask ask, Answer answer) throws HaltException
- Throws:
HaltException
-
matches
protected java.lang.Boolean matches(java.util.Optional<MatchedLocation> matchedLocation, MimeType contentType)
-
unsupportedMediaType
protected java.lang.Boolean unsupportedMediaType(java.util.Optional<MatchedLocation> matchedLocation, MimeType contentType)
-
found
protected Answer found(MatchedLocation foundLocation, Ask ask, Answer answer) throws HaltException
- Throws:
HaltException
-
notFound
protected Answer notFound(Ask ask, Answer answer) throws HaltException
Finds the location from the notFoundDispatcher, executes its route, then returns the answer. This does not validate that the ask's content type matches the not found's content-type- Parameters:
ask- Ask to pass to the route runneranswer- Answer to pass to the route runner- Returns:
- An Answer from the route runner
- Throws:
HaltException- Could be thrown from the route runner.
-
unSupportedMediaType
protected Answer unSupportedMediaType(MatchedLocation foundLocation, Ask ask, Answer answer) throws HaltException
- Throws:
HaltException
-
getDispatcher
public Dispatcher getDispatcher()
-
getNotFoundDispatcher
public Dispatcher getNotFoundDispatcher()
-
-