Am 25.05.2006 um 09:40 schrieb Allen Gilliland:
public interface RequestMapper {
  String map(HttpServletRequest request);
}
So, map could return null if it does not want to change anything or a path relative to some webapp base where the request should be routed to. (If you need more info about the path, you can make that it's own class as well).

I considered that option and it's definitely a valid approach. The main reason why I didn't move forward with it is that it seems somewhat desirable to let a RequestMapper handle the response as well. That way you can force certain return codes when there is a mapping error, rather than being at the mercy of the RequestMappingFilter.

It's definitely a cleaner approach, which is what I like about it.

After letting it sink in a bit, it seems this can be folded into the following:

public interface RequestMapper {
  IRequestRoute map(IRequestRoute route, HttpServletRequest request)
}

public interface IRequestRoute {

  String getRollerPath();

  ...// whatever roller needs
}

public class RouteFactory {

public static IRequestRoute forwardTo(String path, IRequestRoute previous);

public static IRequestRoute answerWith(int status, String description,
    Map headers, IRequestRoute previous);
}

Cheers, Stefan

Reply via email to