net.officefloor.eclipse.socket.HttpFileSenderWorkSourceExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of net.officefloor.woof Show documentation
Show all versions of net.officefloor.woof Show documentation
OfficeFloor WoOF Eclipse plug-in
/*
* OfficeFloor - http://www.officefloor.net
* Copyright (C) 2005-2013 Daniel Sagenschneider
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package net.officefloor.eclipse.socket;
import net.officefloor.eclipse.extension.util.SourceExtensionUtil;
import net.officefloor.eclipse.extension.worksource.TaskDocumentationContext;
import net.officefloor.eclipse.extension.worksource.WorkSourceExtension;
import net.officefloor.eclipse.extension.worksource.WorkSourceExtensionContext;
import net.officefloor.frame.api.build.None;
import net.officefloor.plugin.socket.server.http.HttpRequest;
import net.officefloor.plugin.web.http.application.WebAutoWireApplication;
import net.officefloor.plugin.web.http.resource.HttpFile;
import net.officefloor.plugin.web.http.resource.source.HttpFileFactoryTask;
import net.officefloor.plugin.web.http.resource.source.HttpFileSenderWorkSource;
import net.officefloor.plugin.web.http.resource.source.SourceHttpResourceFactory;
import org.eclipse.swt.widgets.Composite;
/**
* {@link WorkSourceExtension} for {@link HttpFileSenderWorkSource}.
*
* @author Daniel Sagenschneider
*/
public class HttpFileSenderWorkSourceExtension
extends
AbstractSocketWorkSourceExtension, HttpFileSenderWorkSource> {
/**
* Initiate.
*/
public HttpFileSenderWorkSourceExtension() {
super(HttpFileSenderWorkSource.class, "Send Http File");
}
/*
* =================== WorkSourceExtension ===============================
*/
@Override
public void createControl(Composite page, WorkSourceExtensionContext context) {
// Provide properties
SourceExtensionUtil.loadPropertyLayout(page);
SourceExtensionUtil.createPropertyText("Package prefix",
SourceHttpResourceFactory.PROPERTY_CLASS_PATH_PREFIX,
WebAutoWireApplication.WEB_PUBLIC_RESOURCES_CLASS_PATH_PREFIX,
page, context, null);
SourceExtensionUtil
.createPropertyText(
"Directory index file name",
SourceHttpResourceFactory.PROPERTY_DEFAULT_DIRECTORY_FILE_NAMES,
"index.html", page, context, null);
SourceExtensionUtil.createPropertyText(
"Resource not found content path",
HttpFileSenderWorkSource.PROPERTY_NOT_FOUND_FILE_PATH,
"FileNotFound.html", page, context, null);
}
@Override
public String getTaskDocumentation(TaskDocumentationContext context)
throws Throwable {
// Should always only have the one task
// Obtain the prefix
String prefix = context.getPropertyList().getPropertyValue(
SourceHttpResourceFactory.PROPERTY_CLASS_PATH_PREFIX,
"");
// Return the documentation
return "Sends the "
+ HttpFile.class.getSimpleName()
+ " from the class path as specified on the request URI of the "
+ HttpRequest.class.getSimpleName()
+ "\n\nIn finding the "
+ HttpFile.class.getSimpleName()
+ " the prefix '"
+ prefix
+ "' is added to the "
+ HttpRequest.class.getSimpleName()
+ " request URI to restrict access to full class path resources.";
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy