11#if __DCL_HAVE_ALLOC_DEBUG
12#undef __DCL_ALLOC_LEVEL
13#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
43 const String& _tempPath
54 size_t nMaxContentLength
66 addHeader(
HttpHeader(L
"Cache-Control", L
"no-cache"));
68 size_t nLength = contentLength();
69 if (nLength && (nMaxContentLength == 0 || nLength <= nMaxContentLength)) {
73 ByteBuffer*
buf = ByteBuffer::create(nLength);
75 size_t nRead = read(
buf->data(), nLength);
76 buf->__dataLength = nRead;
77 *(
buf->data() +
buf->__dataLength) = L
'\0';
89 else if (HttpFormDataDecoder::isValidType(
__context->pszContentType)) {
106 if (!decoder.
warnings().isEmpty()) {
113 __DCL_TRACE1(L
"Unknown Content-Type[%ls]\n", contentType().data());
128HttpServletEx::HttpServletEx()
133 m_bEnableDebugOut =
true;
144#define __WSTR(s) UTF8Decoder::decode(s, ByteString::length(s))
146void HttpServletEx::onHttpService(
151 if (__tempPath !=
NULL) {
152 tempPath = __tempPath;
155 if (tempPath.isEmpty()) {
157 String str2 = str + L
"temp/";
170 bool bEnableDebugOut = m_bEnableDebugOut;
171 if (bEnableDebugOut) {
172 pOldOut = DCLDebugSetThreadReport(
180 __DCL_TRACE1(L
"initRequest __tempDir[% ls]\n", tempPath.data());
182 __DCL_TRACE1(L
"onService __tempDir [%ls]\n", tempPath.data());
193 if (pOldOut !=
NULL && debugOut.size() > 0) {
197 debugOut.flushTo(*pOldOut);
204 if (bEnableDebugOut) {
205 DCLDebugSetThreadReport(
214 if (bEnableDebugOut) {
215 DCLDebugSetThreadReport(
220 if (pOldOut && debugOut.size() > 0) {
222 pOldOut->write(debugOut.data(), debugOut.size());
227 && debugOut.size() > 0
232 "\n<hr>\n<div style=\"color: black; background-color: white;\">\n"
233 "<h3>DCL Runtime Debugging Information</h3>\n"
234 "<pre style=\"font-size:10pt;\">\n";
235 debugOut.flushTo(writer);
236 writer << L
"</pre>\n</div>\n";
253 if (ctx.
writer().size() > 0) {
255 ctx.
writer() << L
"</body>\n</html>\n";
262 writer.
write(content.data(), content.length());
264 ctx.addHeader(
HttpHeader(L
"Content-Length", String::valueOf(output.size())));
struct _DCL_HTTP_SERVLET_CONTEXT DCL_HTTP_SERVLET_CONTEXT
struct _DCL_HTTP_SERVER_API DCL_HTTP_SERVER_API
#define __DCL_TRACE0(psz)
#define __DCL_TRACE1(fmt, arg1)
#define __DCL_ASSERT(expr)
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
static String dirname(const String &_path)
static bool exists(const String &_path)
static size_t copy(InputStream &_input, OutputStream &_output) __DCL_THROWS1(IOException *)
static void decode(const ByteString &_contents, ListedStringToStringMap &_results)
static void decode(const ByteString &_queryString, ListedStringToStringArrayMap &_results)
static bool isValidType(const char *_contentType)
StringWriter __responseBuf
void initRequest(size_t nMaxContentLength) __DCL_THROWS1(FormDataException *)
virtual ~HttpServletContextEx()
HttpServletContextEx(const DCL_HTTP_SERVER_API *_SAPI, const DCL_HTTP_SERVLET_CONTEXT *_context, const String &_tempPath)
const DCL_HTTP_SERVLET_CONTEXT * __context
virtual void onInitialize() __DCL_THROWS1(Exception *)
size_t m_nMaxContentLength
virtual void onInitialize() __DCL_THROWS1(Exception *)
virtual String toString() const
virtual Writer & write(const wchar_t *_buf, size_t _n) __DCL_THROWS1(IOException *)
static unsigned long getCurrentThreadId()