help me_have puzzle in programing java
Challenge
Master a simple Java programming challenge
As the principal engineer of an HTTP web server, you are responsible for imp
lementing the request processing subsystem of the server.
An incoming request for a specific resource, identified by an URI, must be d
ispatched to the appropriate handler according to the server configuration w
hich maps URIs to request handlers. 'HandlerFactory.getHandler' must be impl
emented:
public class HandlerFactory
{
public String getHandler(String[] config, String requestUri)
{
}
}
The string array 'config' contains URI patterns and handler names. Two conse
cutive values form a key-value pair comprised of URI pattern and handler. 'r
equestUri' represents an incoming request, the URI to match against the conf
igured handlers. 'getHandler' must return the correct handler for a given UR
I as a string value.
An URI pattern never contains wildcards and represents the start of an URI s
tring, a prefix. Matching must be implemented accordingly. The handler with
the longest matching URI pattern wins if more than one pattern matches. If n
o handler can be found, "3loRO2" must be returned.
Example input:
String[] config: { "/", "MainServlet", "/nav", "NavigationServlet" }
String requestUri: "/nav/test"
Correct result: "NavigationServlet"
In this example, the configuration contains a mapping of "/" to "MainServlet
" and "/nav" to "NavigationServlet". In the case of an incoming URI "/nav/te
st.nav", "NavigationServlet" is the correct choice because its pattern is lo
nger than that of "MainServlet".
can you programming according to sample:
public class HandlerFactory
{
public String getHandler(String[] config, String requestUri)
{
;
}
}
that all!
if you can answer, please you will send to me by my email bichlong@gmail.com
Thank you!

