1 37 38 package org.jahia.blogs; 39 40 import javax.servlet.ServletConfig ; 41 import javax.servlet.http.HttpServletRequest ; 42 import javax.servlet.http.HttpServletResponse ; 43 44 50 public class ServletResources { 51 52 private static ThreadLocal currentConfig = new ThreadLocal (); 53 private static ThreadLocal currentRequest = new ThreadLocal (); 54 private static ThreadLocal currentResponse = new ThreadLocal (); 55 56 59 public static HttpServletRequest getCurrentRequest() { 60 return (HttpServletRequest )currentRequest.get(); 61 } 62 63 66 public static void setCurrentRequest(HttpServletRequest request) { 67 currentRequest.set(request); 68 } 69 70 73 public static HttpServletResponse getCurrentResponse() { 74 return (HttpServletResponse )currentResponse.get(); 75 } 76 77 80 public static void setCurrentResponse(HttpServletResponse response) { 81 currentResponse.set(response); 82 } 83 84 87 public static ServletConfig getCurrentConfig() { 88 return (ServletConfig )currentConfig.get(); 89 } 90 91 94 public static void setCurrentConfig(ServletConfig config) { 95 currentConfig.set(config); 96 } 97 } 98 | Popular Tags |