Back to problems

URL Request Handler Router

Object-Oriented Programming · Google · Medium

Build a small URL router that stores handler patterns and finds the right one for a concrete URL. Implement two methods: processHandler(String handler) records a handler pattern, for example /users/delete or /users/{userId}/photo/{photoId}. getHandler(String url) takes a concrete URL and returns the previously recorded handler pattern that matches it. A segment wrapped in braces, such as {userId} or {photoId}, is a placeholder that stands for exactly one URL segment of any…

Loading the rest of the question…