package de.sekmi.li2b2.services;

import java.io.InputStream;
import java.util.logging.Logger;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;


@Path("/webclient")
public class Webclient {
	private static final Logger log = Logger.getLogger(Webclient.class.getName());

	@GET
	@Path("{path: .*}")
	public Response test(@PathParam("path") String path){
		if( path.equals("i2b2_config_data.js") ){
			// send test config data
			return Response.ok(getClass().getResourceAsStream("/i2b2_config_data.js")).build();
		}

		InputStream in = getClass().getResourceAsStream("/webclient/"+path);
		if( in == null ){
			// not found
			log.warning(path+" not found");
			return Response.status(Status.NOT_FOUND).build();
		}else{
			return Response.ok(in).build();
		}
	}
}

@@ -608,24 +608,80 @@
 )).build();%0A
+%09%09%7Delse if( path.equals(%22%22) )%7B%0A%09%09%09path = %22default.htm%22;%0A
 %09%09%7D%0A%0A%09%09Input

use url /webclient/ to display default.htm without specifying the name directly