package com.decker.Essentials;

import java.io.IOException;
import java.io.OutputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.decker.Essentials.Category.Category;
import com.decker.Essentials.User.User;


public class Center extends org.sipc.se.plugin.PluginImpl
{

    Category category;
    public Center()
    {
	super();
	this.category=Category.getInstance();
    }

    @Override
    public void getResponse(HttpServletRequest request, HttpServletResponse response)
    {
	String url = request.getRequestURI();
	String target;
	Matcher matcher=Pattern.compile("(?<=Essentials/).*").matcher(url);
	target=matcher.find()?matcher.group(0):"Default.html";
	target=target.replaceAll("\\?.*", null);
	OutputStream stream;
	try
	{
	    stream = response.getOutputStream();
	    byte[] resource=null;

	    if (target.matches(".*.exec"))
	    {		
		//dynamic generate
		User current=new User(request.getCookies());
		response.setContentType("application/json");
		resource = Command.Execute(current,request,response);
	    } else
	    {
		//static resource
		resource = ResourceManager.getInstance().getResource("Content/"+target);
	    }

	    if (resource.length == 0)
	    {
		response.setStatus(404);
	    }

	    stream.write(resource);

	} catch (IOException e)
	{

	}
	
    }

    @Override
    public String getUrl()
    {
	return "Essentials";
    }

    @Override
    public boolean onEnable()
    {
	// TODO Auto-generated method stub
	return true;
    }
}

@@ -758,23 +758,19 @@
 url);%0D%0A%09
-target=
+if(
 matcher.
@@ -779,40 +779,117 @@
 nd()
-?matcher.group(0):%22Default.html%22
+)%0D%0A%09%7B%0D%0A%09    target=matcher.group(0);%0D%0A%09%7D%0D%0A%09else %7B%0D%0A%09    target=%22Default.html%22;%0D%0A%09%7D%0D%0A%09System.out.print(target)
 ;%0D%0A%09

Change algorithm of empty sub-url