class UserService {

    @GET
    @Path( "/{username}" )
    public Response getUser( @PathParam( "username" ) String username, @Context HttpServletRequest req )
    {
        Principal principal = req.getUserPrincipal();
        if ( principal == null || !principal.getName().equals( username ) )
        {
            return output.notFound();
        }

        LoginContext loginContext = getLoginContextFromUserPrincipal( principal );
        UserManager userManager = userManagerSupplier.getUserManager( loginContext.subject(), false );

        try
        {
            User user = userManager.getUser( username );
            return output.ok( new AuthorizationRepresentation( user ) );
        }
        catch ( InvalidArgumentsException e )
        {
            return output.notFound();
        }
    }

    public  UserService( @Context UserManagerSupplier userManagerSupplier, @Context InputFormat input, @Context OutputFormat
            output );

}