package com.decker.Essentials;

import java.io.IOException;
import java.io.OutputStream;

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 = url.substring(url.indexOf("Essentials") + "Essentials".length() + 1);
	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;
    }
}

@@ -85,16 +85,82 @@
 Stream;%0D
+%0Aimport java.util.regex.Matcher;%0D%0Aimport java.util.regex.Pattern;%0D
 %0A%0D%0Aimpor
@@ -688,78 +688,177 @@
 rget
- = url.substring(url.indexOf(%22Essentials%22) + %22Essentials%22.length() + 1
+;%0D%0A%09Matcher matcher=Pattern.compile(%22(?%3C=Essentials/).*%22).matcher(url);%0D%0A%09target=matcher.find()?matcher.group(0):%22Default.html%22;%0D%0A%09target=target.replaceAll(%22%5C%5C?.*%22, null
 );%0D%0A

Add regex mtach