Liam Staskawicz avatar Liam Staskawicz committed f70ce49

* code cleanup - braces, parens, etc. no functional changes.

Comments (0)

Files changed (4)

fan/ServletReq.fan

   private InStream webIn
   override WebMod mod
   
-  new make(HttpServletRequest? request, WebMod wm) {
+  new make(HttpServletRequest? request, WebMod wm)
+  {
     req = request
     mod = wm
-    webIn = Interop.toFan(req.getInputStream())
+    webIn = Interop.toFan(req.getInputStream)
   }
   
   override InStream in() { return webIn }
-  override IpAddr remoteAddr() { return IpAddr(req.getRemoteAddr()) }
-  override Int remotePort() { return req.getRemotePort() }
+  override IpAddr remoteAddr() { return IpAddr(req.getRemoteAddr) }
+  override Int remotePort() { return req.getRemotePort }
   override Version version := Version("0")
-  override Str method() { return req.getMethod() }
-  override Uri uri() { return Uri.fromStr(req.getRequestURI()) }
-  override once WebSession session() { return ServletSession(req.getSession()) }
+  override Str method() { return req.getMethod }
+  override Uri uri() { return Uri.fromStr(req.getRequestURI) }
+  override once WebSession session() { return ServletSession(req.getSession) }
   
-  override once Str:Str headers() {
+  override once Str:Str headers()
+  {
     hdrs := Str:Str[:]
-    e := req.getHeaderNames()
-    while (e.hasMoreElements()) {
-      name := e.nextElement()
+    e := req.getHeaderNames
+    while (e.hasMoreElements)
+    {
+      name := e.nextElement
       hdrs[name] = req.getHeader(name)
     }
     return hdrs.ro

fan/ServletRes.fan

 internal class ServletRes : WebRes
 {
   private HttpServletResponse? res
+  internal WebOutStream? webOut
   override readonly Bool isCommitted := false
-  internal WebOutStream? webOut
 
-  new make(HttpServletResponse? response) {
+  new make(HttpServletResponse? response)
+  {
     res = response
   }
   
   
   override Int statusCode := 200
   {
-    set {
+    set
+    {
       checkUncommitted
       &statusCode = it
       // this is applied in commit()
     }
   }
   
-  internal Void checkUncommitted() {
+  internal Void checkUncommitted()
+  {
     if (isCommitted) throw Err("WebRes already committed")
   }
 
     // if we have content then we need to ensure we have our
     // headers and response stream are setup correctly
     if (content)
-      webOut = WebOutStream(Interop.toFan(res.getOutputStream()))
+      webOut = WebOutStream(Interop.toFan(res.getOutputStream))
 
     // write response line and headers
-    res.setStatus(this.statusCode)
-    this.headers.each |Str v, Str k| {
-      res.addHeader(k, v)
-    }
-    this.cookies.each |c| {
+    res.setStatus(statusCode)
+    headers.each |Str v, Str k| { res.addHeader(k, v) }
+    cookies.each |c|
+    {
       jc := JCookie(c.name, c.val)
       if (c.maxAge != null) jc.setMaxAge(c.maxAge.toSec)
       if (c.secure == true) jc.setSecure(true)
     }
   }
   
-  override Str:Str headers := Str:Str[:] {
+  override Str:Str headers := Str:Str[:]
+  {
     get { return (isCommitted ? &headers.ro : &headers) }
   }
   
-  override web::Cookie[] cookies := Cookie[,] {
+  override web::Cookie[] cookies := Cookie[,]
+  {
     get { return (isCommitted ? &cookies.ro : &cookies) }
   }
 }

fan/ServletSession.fan

   private HttpSession? session
   private Bool isValid := true
   
-  new make(HttpSession? hs) : super(hs.getId()) {
+  new make(HttpSession? hs) : super(hs.getId)
+  {
     session = hs
-    e := session.getAttributeNames()
-    while (e.hasMoreElements()) {
-      name := e.nextElement()
+    e := session.getAttributeNames
+    while (e.hasMoreElements)
+    {
+      name := e.nextElement
       this.map[name] = session.getAttribute(name)
     }
   }
   
-  override Void delete() {
+  override Void delete()
+  {
     session.invalidate()
     isValid = false
   }

java/FanServlet.java

     locals.set("web.res", webres);
     locals.set("web.req", webreq);
     
-    try {
+    try
+    {
       webmod.typeof().method("onService").call(webmod);
     }
-    finally {
+    finally
+    {
       // save the session, and cleanup thread locals
       FanObj session = (FanObj) webreq.typeof().method("session").call(webreq);
       session.typeof().method("save").call(session);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.