Permalink
Browse files

added request.userPrincipal

corrected content-length response header to be number of bytes not string length for text reponses, improves utf-8 support
  • Loading branch information...
1 parent cd59899 commit ac710b1433a55fade9a66a63a56df60750bd139d thatcher committed Jun 17, 2010
Binary file not shown.
@@ -164,6 +164,13 @@ public boolean processRequest(HttpServletRequest request, HttpServletResponse re
ScriptableObject.defineProperty(req, "serverPort", request.getServerPort(), 0);
ScriptableObject.defineProperty(req, "servletPath", request.getServletPath(), 0);
+ //user principle properties
+ if( request.getUserPrincipal() == null){
+ ScriptableObject.defineProperty(req, "userPrincipal", null, 0);
+ }else{
+ ScriptableObject.defineProperty(req, "userPrincipal", request.getUserPrincipal().getName(), 0);
+ }
+
//TODO add session object and it's properties
// Create the empty JavaScript response object
@@ -254,12 +261,12 @@ public boolean processRequest(HttpServletRequest request, HttpServletResponse re
ScriptableObject.getProperty(res, "body")
);
if(! (contentLength > -1) ){
- contentLength = body.length();
- response.setContentLength(contentLength);
- logger.debug("Actual Body Length ===> " + contentLength);
- response.getWriter().println(body);
- logger.debug("Response Body : " + body);
+ contentLength = body.getBytes("UTF-8").length;
}
+ response.setContentLength(contentLength);
+ logger.debug("Actual Body Length ===> " + contentLength);
+ response.getWriter().println(body);
+ logger.debug("Response Body : " + body);
}
}catch(Exception e){
logger.error(e);
View
@@ -8,7 +8,7 @@
<property description="major release number" name="major" value="0" />
<property description="minor release number" name="minor" value="5" />
- <property description="build number" name="number" value="0" />
+ <property description="build number" name="number" value="2" />
<property description="build id" name="build_id" value="${major}.${minor}.${number}" />
<property description="Java Jars" name="JAVA_LIB_DIR" location="WEB-INF/lib" />
View
Binary file not shown.
View
Binary file not shown.

0 comments on commit ac710b1

Please sign in to comment.