Skip to main content
summaryrefslogtreecommitdiffstats
blob: 59c2add772e926eafd0dedced1f585e1cf3a80ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*******************************************************************************
 * Copyright (c) 2008 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - Initial API and implementation
 *******************************************************************************/
package org.eclipse.wst.server.preview.internal;

import java.net.MalformedURLException;

import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.util.resource.Resource;

public class ContextResourceHandler extends ResourceHandler {
	protected String context;

	public void setContext(String context) {
		this.context = context;
	}

	public Resource getResource(String path) throws MalformedURLException {
		if (path == null || !path.startsWith(context + "/"))
			return null;
		
		path = path.substring(context.length());
		return super.getResource(path);
	}
}

Back to the top