com.github.dynamicextensionsalfresco.webscripts.messages.AnnotationWebScriptInputMessage 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.messages;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
public class AnnotationWebScriptInputMessage implements HttpInputMessage {
private WebScriptRequest request;
private final HttpHeadersWrapper headers;
public AnnotationWebScriptInputMessage(WebScriptRequest request) {
this.request = request;
this.headers = new HttpHeadersWrapper(request);
}
@Override
public InputStream getBody() throws IOException {
return request.getContent().getInputStream();
}
@Override
public HttpHeaders getHeaders() {
return this.headers;
}
class HttpHeadersWrapper extends HttpHeaders {
private final WebScriptRequest request;
public HttpHeadersWrapper(WebScriptRequest request) {
this.request = request;
}
@Override
public List get(Object key) {
String[] values = request.getHeaderValues(key.toString());
return Arrays.asList(values);
}
@Override
public String getFirst(String headerName) {
String[] values = request.getHeaderValues(headerName);
if (values == null){
return null;
} else {
return values[0];
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy