Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.wst.server.preview/src')
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ContextResourceHandler.java32
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/IMemento.java74
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.java41
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.properties32
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Module.java43
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewApplication.java28
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewServerPlugin.java57
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java108
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java67
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Trace.java67
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPDefaultHandler.java76
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPErrorHandler.java49
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPLogger.java61
-rw-r--r--plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/XMLMemento.java175
14 files changed, 0 insertions, 910 deletions
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ContextResourceHandler.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ContextResourceHandler.java
deleted file mode 100644
index 56064c575..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ContextResourceHandler.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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.mortbay.jetty.handler.ResourceHandler;
-import org.mortbay.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);
- }
-}
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/IMemento.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/IMemento.java
deleted file mode 100644
index a0e8d8ea7..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/IMemento.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2007 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;
-/**
- * Interface to a memento used for saving the important state of an object
- * in a form that can be persisted in the file system.
- * <p>
- * Mementos were designed with the following requirements in mind:
- * <ol>
- * <li>Certain objects need to be saved and restored across platform sessions.
- * </li>
- * <li>When an object is restored, an appropriate class for an object might not
- * be available. It must be possible to skip an object in this case.</li>
- * <li>When an object is restored, the appropriate class for the object may be
- * different from the one when the object was originally saved. If so, the
- * new class should still be able to read the old form of the data.</li>
- * </ol>
- * </p>
- * <p>
- * Mementos meet these requirements by providing support for storing a
- * mapping of arbitrary string keys to primitive values, and by allowing
- * mementos to have other mementos as children (arranged into a tree).
- * A robust external storage format based on XML is used.
- * </p><p>
- * The key for an attribute may be any alpha numeric value. However, the
- * value of <code>TAG_ID</code> is reserved for internal use.
- * </p><p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface IMemento {
-
- /**
- * Returns the first child with the given type id.
- *
- * @param type the type id
- * @return the first child with the given type
- */
- public IMemento getChild(String type);
-
- /**
- * Returns all children with the given type id.
- *
- * @param type the type id
- * @return the list of children with the given type
- */
- public IMemento[] getChildren(String type);
-
- /**
- * Returns the integer value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not an integer
- */
- public Integer getInteger(String key);
-
- /**
- * Returns the string value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not an integer
- */
- public String getString(String key);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.java
deleted file mode 100644
index d0d3b8a5e..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2007 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 org.eclipse.osgi.util.NLS;
-/**
- * Translated messages.
- */
-public class Messages extends NLS {
- public static String errorLocation;
- public static String errorJRE;
- public static String classpathContainerDescription;
- public static String classpathContainer;
- public static String classpathContainerUnbound;
-
- public static String copyingTask;
- public static String deletingTask;
- public static String errorCopyingFile;
- public static String errorCreatingZipFile;
- public static String errorDelete;
- public static String errorRename;
- public static String errorReading;
- public static String updateClasspathContainers;
- public static String errorNoRuntime;
- public static String errorFacet;
- public static String errorDeleting;
- public static String errorNotADirectory;
- public static String errorMkdir;
-
- static {
- NLS.initializeMessages(PreviewServerPlugin.PLUGIN_ID + ".internal.Messages", Messages.class);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.properties b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.properties
deleted file mode 100644
index 185c62195..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-###############################################################################
-# Copyright (c) 2007 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
-###############################################################################
-
-classpathContainerDescription=Server Library
-classpathContainer={0} [{1}]
-classpathContainerUnbound={0} [{1}] (unbound)
-
-errorLocation=Invalid location.
-errorJRE=Invalid JRE.
-
-copyingTask=Copying from {0} to {1}
-deletingTask=Deleting {0}
-errorCopyingFile=Error copying file {0}: {1}
-errorCreatingZipFile=Error creating zip file {0}: {1}
-errorDelete=Could not delete previous copy, which may be locked by another process.
-errorRename=Could not replace with temp file {0}.
-errorReading=Error reading file {0}
-errorNoRuntime=Cannot verify facets because there is no runtime associated with the server.
-errorFacet=Project facet {0} version {1} is not supported.
-errorDeleting=Could not delete {0}. May be locked by another process.
-errorNotADirectory=Could not delete {0} since it is not a directory.
-errorMkdir=Could not create directory {0}.
-
-updateClasspathContainers=Updating classpath container for {0} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Module.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Module.java
deleted file mode 100644
index a45784fa6..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Module.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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;
-/**
- *
- */
-public class Module {
- private String name;
- private boolean isStatic;
- private String context;
- private String projectPath;
-
- public Module(String name, boolean isStatic, String context, String projectPath) {
- this.name = name;
- this.isStatic = isStatic;
- this.context = context;
- this.projectPath = projectPath;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isStaticWeb() {
- return isStatic;
- }
-
- public String getContext() {
- return context;
- }
-
- public String getPath() {
- return projectPath;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewApplication.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewApplication.java
deleted file mode 100644
index 2bfcf6cde..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewApplication.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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 org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-
-public class PreviewApplication implements IApplication {
- protected PreviewStarter starter;
-
- public Object start(IApplicationContext appContext) throws Exception {
- starter = new PreviewStarter(null);
- starter.run();
- return EXIT_OK;
- }
-
- public void stop() {
- starter.stop();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewServerPlugin.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewServerPlugin.java
deleted file mode 100644
index 5e9d2bdee..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewServerPlugin.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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 org.eclipse.core.runtime.*;
-import org.osgi.framework.BundleContext;
-/**
- *
- */
-public class PreviewServerPlugin extends Plugin {
- public static final String PLUGIN_ID = "org.eclipse.wst.server.preview";
-
- // singleton instance of this class
- private static PreviewServerPlugin singleton;
-
- protected BundleContext context;
-
- /**
- * Create the JavaServerPlugin.
- */
- public PreviewServerPlugin() {
- super();
- singleton = this;
- }
-
- /**
- * Returns the singleton instance of this plugin.
- *
- * @return a singleton instance
- */
- public static PreviewServerPlugin getInstance() {
- return singleton;
- }
-
- /**
- * @see Plugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context2) throws Exception {
- super.start(context2);
- context = context2;
- }
-
- /**
- * @see Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context2) throws Exception {
- super.stop(context2);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java
deleted file mode 100644
index 4f31ff7b8..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.io.File;
-
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.HandlerList;
-import org.mortbay.jetty.webapp.WebAppContext;
-
-public class PreviewStarter {
- protected String configPath;
- protected Server server;
-
- public PreviewStarter(String configPath) {
- this.configPath = configPath;
- }
-
- public static void main(String[] args) {
- PreviewStarter app = new PreviewStarter(args[0]);
- app.run();
- }
-
- protected void run() {
- try {
- System.setProperty("org.mortbay.log.class", "org.eclipse.wst.server.preview.internal.WTPLogger");
- ServerConfig config = new ServerConfig(configPath);
- System.out.println("Starting preview server on port " + config.getPort());
- System.out.println();
- Module[] m = config.getModules();
- int size = m.length;
- if (size > 0) {
- System.out.println("Modules:");
- for (Module mm : m)
- System.out.println(" " + mm.getName() + " (" + mm.getContext() + ")");
- System.out.println();
- }
-
- server = new Server(config.getPort());
- server.setStopAtShutdown(true);
-
- WTPErrorHandler errorHandler = new WTPErrorHandler();
-
- HandlerList handlers = new HandlerList();
- for (Module module : m) {
- if (module.isStaticWeb()) {
- ContextResourceHandler resourceHandler = new ContextResourceHandler();
- resourceHandler.setResourceBase(module.getPath());
- resourceHandler.setContext(module.getContext());
- handlers.addHandler(resourceHandler);
- } else {
- WebAppContext wac = new WebAppContext();
- wac.setContextPath(module.getContext());
- wac.setWar(module.getPath());
- wac.setErrorHandler(errorHandler);
- handlers.addHandler(wac);
- }
- }
-
- handlers.addHandler(new WTPDefaultHandler(config.getPort(), m));
- server.setHandler(handlers);
-
- try {
- server.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
-
- public void stop() {
- try {
- System.out.println("Stop!");
- server.stop();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * deleteDirectory is a convenience method to recursively delete a directory
- * @param directory - the directory to delete.
- * @return was the delete successful
- */
- protected static boolean deleteDirectory(File directory) {
- if (directory.exists() && directory.isDirectory()) {
- File[] files = directory.listFiles();
- for (File file : files) {
- if (file.isDirectory()) {
- deleteDirectory(file);
- } else {
- file.delete();
- }
- }
- }
- return directory.delete();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java
deleted file mode 100644
index af67ac764..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ServerConfig {
- private String configPath;
- private Module[] modules;
- private int port = 8080;
-
- public ServerConfig(String configPath) {
- this.configPath = configPath;
- init();
- }
-
- private void init() {
- File f = new File(configPath);
- if (!f.exists())
- System.err.println("Config doesn't exist at " + configPath);
- else {
- try {
- IMemento memento = XMLMemento.loadMemento(f);
- Integer prt = memento.getInteger("port");
- if (prt != null)
- port = prt.intValue();
-
- IMemento[] modules2 = memento.getChildren("module");
- int size = modules2.length;
- List<Module> list = new ArrayList<Module>(size);
- for (IMemento mod : modules2) {
- String name = mod.getString("name");
- boolean isStatic = "static".equals(mod.getString("type"));
- String path = mod.getString("path");
- String context = mod.getString("context");
- if (context != null && !context.startsWith("/"))
- context = "/" + context;
- Module module = new Module(name, isStatic, context, path);
- list.add(module);
- }
-
- modules = new Module[list.size()];
- list.toArray(modules);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- public int getPort() {
- return port;
- }
-
- public Module[] getModules() {
- return modules;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Trace.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Trace.java
deleted file mode 100644
index 8a86d6496..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Trace.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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;
-/**
- * Helper class to route trace output.
- */
-public class Trace {
- /**
- * Config tracing
- */
- public static final byte CONFIG = 0;
- /**
- * Warning tracing
- */
- public static final byte WARNING = 1;
- /**
- * Severe tracing
- */
- public static final byte SEVERE = 2;
- /**
- * Finest tracing
- */
- public static final byte FINEST = 3;
-
- public static final byte PUBLISHING = 4;
-
- /**
- * Trace constructor comment.
- */
- private Trace() {
- super();
- }
-
- /**
- * Trace the given text.
- *
- * @param level trace level
- * @param s String
- */
- public static void trace(byte level, String s) {
- Trace.trace(level, s, null);
- }
-
- /**
- * Trace the given message and exception.
- *
- * @param level trace level
- * @param s String
- * @param t Throwable
- */
- public static void trace(byte level, String s, Throwable t) {
- if (!PreviewServerPlugin.getInstance().isDebugging())
- return;
-
- System.out.println(PreviewServerPlugin.PLUGIN_ID + " " + s);
- if (t != null)
- t.printStackTrace();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPDefaultHandler.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPDefaultHandler.java
deleted file mode 100644
index d13a0d2ba..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPDefaultHandler.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * 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.io.IOException;
-import java.io.OutputStream;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.mortbay.jetty.HttpConnection;
-import org.mortbay.jetty.MimeTypes;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.handler.AbstractHandler;
-import org.mortbay.util.ByteArrayISO8859Writer;
-import org.mortbay.util.StringUtil;
-
-public class WTPDefaultHandler extends AbstractHandler {
- protected int port;
- protected Module[] modules;
-
- public WTPDefaultHandler(int port, Module[] modules) {
- this.port = port;
- this.modules = modules;
- }
-
- public void handle(String target, HttpServletRequest request, HttpServletResponse response,
- int dispatch) throws IOException, ServletException {
- Request base_request = request instanceof Request?(Request)request:HttpConnection.getCurrentConnection().getRequest();
-
- if (response.isCommitted() || base_request.isHandled())
- return;
- base_request.setHandled(true);
-
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- response.setContentType(MimeTypes.TEXT_HTML);
-
- ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer(1500);
-
- String uri = request.getRequestURI();
- uri = StringUtil.replace(uri, "<", "&lt;");
- uri = StringUtil.replace(uri, ">", "&gt;");
-
- writer.write("<HTML>\n<HEAD>\n<TITLE>Error 404 - Not Found");
- writer.write("</TITLE>\n<BODY>\n<H2>Error 404 - Not Found</H2>\n");
- writer.write("No context on this server matched or handled this request.<BR>");
- writer.write("Contexts known to this server are: <ul>");
-
- for (Module module : modules) {
- writer.write("<li>");
- writer.write(module.getName());
- writer.write("(<a href=\"http://localhost:" + port + module.getContext() + "\">");
- writer.write(module.getContext());
- writer.write("</a>)</li>");
- }
-
- for (int i = 0; i < 10; i++)
- writer.write("\n<!-- Padding for IE -->");
-
- writer.write("\n</BODY>\n</HTML>\n");
- writer.flush();
- response.setContentLength(writer.size());
- OutputStream out = response.getOutputStream();
- writer.writeTo(out);
- out.close();
- }
-}
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPErrorHandler.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPErrorHandler.java
deleted file mode 100644
index 725f4bd55..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPErrorHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.io.IOException;
-import java.io.Writer;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.mortbay.jetty.HttpConnection;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.handler.ErrorHandler;
-import org.mortbay.util.StringUtil;
-
-public class WTPErrorHandler extends ErrorHandler {
- private static final long serialVersionUID = 1L;
-
- public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException {
- super.handle(target, request, response, dispatch);
- Request base_request = request instanceof Request?(Request)request:HttpConnection.getCurrentConnection().getRequest();
- base_request.setHandled(true);
- }
-
- protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks)
- throws IOException {
- String uri = request.getRequestURI();
- if (uri != null) {
- uri = StringUtil.replace(uri, "&", "&amp;");
- uri = StringUtil.replace(uri, "<", "&lt;");
- uri = StringUtil.replace(uri, ">", "&gt;");
- }
-
- writeErrorPageMessage(request, writer, code, message, uri);
- if (showStacks)
- writeErrorPageStacks(request, writer);
-
- for (int i = 0; i < 20; i++)
- writer.write("<br/> \n");
- }
-}
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPLogger.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPLogger.java
deleted file mode 100644
index 943508a73..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/WTPLogger.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * 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 org.mortbay.log.Logger;
-
-public class WTPLogger implements Logger {
- protected boolean debug = false;
-
- public void debug(String msg, Throwable t) {
- if (debug) {
- System.out.println(msg);
- t.printStackTrace();
- }
- }
-
- public void debug(String msg, Object arg1, Object arg2) {
- if (debug) {
- System.out.println(msg);
- }
- }
-
- public Logger getLogger(String name) {
- return this;
- }
-
- public void info(String msg, Object arg1, Object arg2) {
- if (debug) {
- System.out.println(msg);
- }
- }
-
- public boolean isDebugEnabled() {
- return debug;
- }
-
- public void setDebugEnabled(boolean debug) {
- this.debug = debug;
- }
-
- public void warn(String msg, Throwable t) {
- if (debug) {
- System.out.println(msg);
- t.printStackTrace();
- }
- }
-
- public void warn(String msg, Object arg1, Object arg2) {
- if (debug) {
- System.out.println(msg);
- }
- }
-}
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/XMLMemento.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/XMLMemento.java
deleted file mode 100644
index d43134f26..000000000
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/XMLMemento.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.io.*;
-import java.util.*;
-
-import org.w3c.dom.*;
-import org.xml.sax.*;
-
-import javax.xml.parsers.*;
-/**
- * A Memento is a class independent container for persistence
- * info. It is a reflection of 3 storage requirements.
- *
- * 1) We need the ability to persist an object and restore it.
- * 2) The class for an object may be absent. If so we would
- * like to skip the object and keep reading.
- * 3) The class for an object may change. If so the new class
- * should be able to read the old persistence info.
- *
- * We could ask the objects to serialize themselves into an
- * ObjectOutputStream, DataOutputStream, or Hashtable. However
- * all of these approaches fail to meet the second requirement.
- *
- * Memento supports binary persistence with a version ID.
- */
-public final class XMLMemento implements IMemento {
- private Document factory;
- private Element element;
-
- /**
- * Answer a memento for the document and element. For simplicity
- * you should use createReadRoot and createWriteRoot to create the initial
- * mementos on a document.
- */
- private XMLMemento(Document doc, Element el) {
- factory = doc;
- element = el;
- }
-
- /**
- * Create a Document from a Reader and answer a root memento for reading
- * a document.
- */
- private static XMLMemento createReadRoot(InputStream in) {
- Document document = null;
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- document = parser.parse(new InputSource(in));
- Node node = document.getFirstChild();
- if (node instanceof Element)
- return new XMLMemento(document, (Element) node);
- } catch (Exception e) {
- // ignore
- } finally {
- try {
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- return null;
- }
-
- /*
- * @see IMemento
- */
- public IMemento getChild(String type) {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return null;
-
- // Find the first node which is a child of this node.
- for (int nX = 0; nX < size; nX ++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element2 = (Element)node;
- if (element2.getNodeName().equals(type))
- return new XMLMemento(factory, element2);
- }
- }
-
- // A child was not found.
- return null;
- }
-
- /*
- * @see IMemento
- */
- public IMemento [] getChildren(String type) {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return new IMemento[0];
-
- // Extract each node with given type.
- List<Element> list = new ArrayList<Element>(size);
- for (int nX = 0; nX < size; nX ++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element2 = (Element)node;
- if (element2.getNodeName().equals(type))
- list.add(element2);
- }
- }
-
- // Create a memento for each node.
- size = list.size();
- IMemento [] results = new IMemento[size];
- for (int x = 0; x < size; x ++) {
- results[x] = new XMLMemento(factory, list.get(x));
- }
- return results;
- }
-
- /*
- * @see IMemento
- */
- public Integer getInteger(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Integer(strValue);
- } catch (NumberFormatException e) {
- return null;
- }
- }
-
- /*
- * @see IMemento
- */
- public String getString(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- return attr.getValue();
- }
-
- /**
- * Loads a memento from the given file.
- *
- * @param file a file
- * @exception java.io.IOException
- * @return a memento
- */
- public static IMemento loadMemento(File file) throws IOException {
- InputStream in = null;
- try {
- in = new BufferedInputStream(new FileInputStream(file));
- return XMLMemento.createReadRoot(in);
- } finally {
- try {
- if (in != null)
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
-} \ No newline at end of file

Back to the top