SDB implementation of RDF API (and merge from trunk)

This commit is contained in:
brianjlowe 2012-06-04 21:09:36 +00:00
parent 8aa257d564
commit cead502f89
194 changed files with 10522 additions and 5324 deletions

View file

@ -10,6 +10,8 @@ import java.io.StringWriter;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
@ -29,6 +31,7 @@ public class HttpServletResponseStub implements HttpServletResponse {
private String errorMessage;
private Map<String, String> headers = new HashMap<String, String>();
private String contentType;
private String charset = "";
private ByteArrayOutputStream outputStream;
private StringWriter outputWriter;
@ -129,9 +132,19 @@ public class HttpServletResponseStub implements HttpServletResponse {
return headers.containsKey(name);
}
/**
* Calling setContentType("this/type;charset=UTF-8") is the same as calling
* setContentType("this/type;charset=UTF-8"); setCharacterEncoding("UTF-8")
*/
@Override
public void setContentType(String contentType) {
this.contentType = contentType;
Pattern p = Pattern.compile(";\\scharset=([^;]+)");
Matcher m = p.matcher(contentType);
if (m.find()) {
this.charset = m.group(1);
}
}
@Override
@ -139,6 +152,16 @@ public class HttpServletResponseStub implements HttpServletResponse {
return contentType;
}
@Override
public void setCharacterEncoding(String charset) {
this.charset = charset;
}
@Override
public String getCharacterEncoding() {
return charset;
}
// ----------------------------------------------------------------------
// Un-implemented methods
// ----------------------------------------------------------------------
@ -155,12 +178,6 @@ public class HttpServletResponseStub implements HttpServletResponse {
"HttpServletResponseStub.getBufferSize() not implemented.");
}
@Override
public String getCharacterEncoding() {
throw new RuntimeException(
"HttpServletResponseStub.getCharacterEncoding() not implemented.");
}
@Override
public Locale getLocale() {
throw new RuntimeException(
@ -191,12 +208,6 @@ public class HttpServletResponseStub implements HttpServletResponse {
"HttpServletResponseStub.setBufferSize() not implemented.");
}
@Override
public void setCharacterEncoding(String arg0) {
throw new RuntimeException(
"HttpServletResponseStub.setCharacterEncoding() not implemented.");
}
@Override
public void setContentLength(int arg0) {
throw new RuntimeException(