Jump to content
xisto Community
Sign in to follow this  
marcio

I Need Help With Java

Recommended Posts

I dont have much knowlege with java yet. Im a php programer not a java programer but i want to learn java and i need this coding to correct so that i can carry on my learning of java. So please some one just take some time to help me.

Heres what i need to do.

An incoming request for a specific resource, identified by an URI, must be dispatched to the appropriate handler according to the server configuration which maps URIs to request handlers. 'HandlerFactory.getHandler' must be implemented:

public class HandlerFactory{  public String getHandler(String[] config, String requestUri)  {  }}

The string array 'config' contains URI patterns and handler names. Two consecutive values form a key-value pair comprised of URI pattern and handler. 'requestUri' represents an incoming request, the URI to match against the configured handlers. 'getHandler' must return the correct handler for a given URI as a string value.
An URI pattern never contains wildcards and represents the start of an URI string, a prefix. Matching must be implemented accordingly. The handler with the longest matching URI pattern wins if more than one pattern matches. If no handler can be found, "BrK2jgi" 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/test.nav", "NavigationServlet" is the correct choice because its pattern is longer than that of "MainServlet".

Ok now this is what i start with and have to do as they say above.

public class HandlerFactory{  public String getHandler(String[] config, String requestUri)  {  }}

Share this post


Link to post
Share on other sites

I didnt get what you are actually asking for. And maybe.. thats the case with others and thats y u havent got a reply till yet.. Juz write the thing you want to achieve.. Plenty will write back the code and will be more than happy to explain it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.