Created
September 21, 2009 16:33
-
-
Save qmacro/190363 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
method DERIVE_HANDLER. | |
* Loops through the patterns trying to find a match on the URL's path info | |
* If it finds one, it returns the corresponding handler class name, plus | |
* an optional list of matched strings from parentheses in the pattern | |
data: | |
l_path type char255 | |
, ls_handler type ty_handler | |
, lt_match type match_result_tab | |
, ls_match type match_result | |
, ls_submatch type submatch_result | |
. | |
field-symbols: <submatch> type any. | |
loop at handlers into ls_handler. | |
find regex ls_handler-pattern in path results lt_match. | |
if sy-subrc = 0. | |
class = ls_handler-handler. | |
read table lt_match into ls_match index 1. | |
l_path = path. | |
loop at ls_match-submatches into ls_submatch. | |
assign l_path+ls_submatch-offset(ls_submatch-length) to <submatch>. | |
append <submatch> to matches. | |
endloop. | |
exit. | |
endif. | |
endloop. | |
endmethod. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment