Tuesday, June 05, 2007

MyJavaServer - Signup Challenge

When I tried to sign-up for MyJavaServer service, I was quiet amused by their sign-up challenge. The challenge is to write a small Java program (just to make sure that you are conversant with Java). The site then compiles your program and runs a couple of tests to validate the program. Quiet a novel way to authenticate the users.

Signup Challenge
Master a simple Java programming challenge (STATUS: NOT PASSED)

As the principal engineer of an HTTP web server, you are responsible for implementing the request processing subsystem of the server.
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, "XqAoLy" must be returned.

7 comments:

Anonymous said...

Kumar, have you code this challenge?

Rajakumar said...

I have solved this challenge.

Anonymous said...

Kumar

will you share the solution with me.

Thanks.

Rajakumar said...

I could not find the solution that I used, but should be able to help out.

Anonymous said...

can you please publish that code on this site myjavaserver one

Rajakumar said...

I will not be publishing the code to solve the MyJavaServer sign up challenge. The idea behind the challenge (that I guess) is to restrict people who are not proficient with Java. I bet the challenge is a really simple. So if you are proficient in core java and some basics of httpservlet request handling, one should get through easily.

Anonymous said...

Rajakumar, you are a stupid.