com.github.dynamicextensionsalfresco.webscripts.UnavailableWebScript Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of annotations-runtime Show documentation
Show all versions of annotations-runtime Show documentation
Adds an OSGi container to alfresco repository supporting dynamic code reloading, classpath isolation and a bunch of other useful features
package com.github.dynamicextensionsalfresco.webscripts;
import java.io.IOException;
import java.util.ResourceBundle;
import javax.servlet.http.HttpServletResponse;
import org.springframework.extensions.webscripts.Container;
import org.springframework.extensions.webscripts.Description;
import org.springframework.extensions.webscripts.URLModelFactory;
import org.springframework.extensions.webscripts.WebScript;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;
/**
* {@link WebScript} that generates a "503 Service Unavailable" response when request is issued to an
* {@link AnnotationWebScript} that is currently unavailable.
*
* @author Laurens Fridael
*
*/
class UnavailableWebScript implements WebScript {
private Description description;
@Override
public void init(final Container container, final Description description) {
this.description = description;
}
@Override
public void setURLModelFactory(final URLModelFactory urlModelFactory) {
}
@Override
public Description getDescription() {
return description;
}
@Override
public ResourceBundle getResources() {
return null;
}
@Override
public void execute(final WebScriptRequest request, final WebScriptResponse response) throws IOException {
response.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
response.setHeader("Cache-Control", "no-cache,no-store");
response.getWriter()
.write("This Web Script is currently unavailable. It may have been undeployed temporarily.");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy