com.dyuproject.web.rest
Class WebContext
java.lang.Object
com.dyuproject.web.rest.WebContext
- Direct Known Subclasses:
- RESTControllerContext, RESTServiceContext
public abstract class WebContext
- extends Object
The REST web application context.
- Author:
- David Yu
- Date created:
- May 11, 2008
Method Summary |
void |
addAttribute(String name,
Object value)
|
void |
addViewDispatcher(String name,
ViewDispatcher dispatcher)
|
protected abstract void |
destroy()
|
Object |
getAttribute(String name)
|
static RequestContext |
getCurrentRequestContext()
|
static CookieSession |
getCurrentSession()
|
DefaultDispatcher |
getDefaultDispatcher()
|
JSPDispatcher |
getJSPDispatcher()
|
String |
getProperty(String name)
|
RequestContext |
getRequestContext()
|
static URL |
getResource(String resource)
|
ServletContext |
getServletContext()
|
CookieSession |
getSession(HttpServletRequest request)
|
CookieSession |
getSession(HttpServletRequest request,
boolean create)
|
ViewDispatcher |
getViewDispatcher(String name)
|
protected abstract void |
handlePath(RequestContext requestContext)
|
protected abstract void |
handleRoot(RequestContext requestContext)
|
protected abstract void |
init()
|
boolean |
invalidateSession(HttpServletResponse response)
|
boolean |
isInitialized()
|
boolean |
isMimeSupported(String mime)
|
boolean |
isSessionEnabled()
|
static Object |
newObjectInstance(String className)
|
boolean |
persistSession(CookieSession session,
HttpServletRequest request,
HttpServletResponse response)
|
protected abstract void |
preConfigure(ServletConfig config)
|
void |
service(HttpServletRequest request,
HttpServletResponse response)
|
void |
setAttribute(String name,
Object value)
|
void |
setAttributes(Map<String,Object> attributes)
|
void |
setEnv(File location)
|
void |
setEnv(InputStream stream)
|
void |
setEnv(Properties env)
|
void |
setEnv(URL location)
|
void |
setMime(File location)
|
void |
setMime(InputStream stream)
|
void |
setMime(Properties mimes)
|
void |
setMime(URL location)
|
void |
setViewDispatcher(String name,
ViewDispatcher dispatcher)
|
void |
setViewDispatchers(Map<String,ViewDispatcher> dispatchers)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DISPATCH_ATTR
public static final String DISPATCH_ATTR
- See Also:
- Constant Field Values
PATH_SUFFIX_ATTR
public static final String PATH_SUFFIX_ATTR
- See Also:
- Constant Field Values
DEFAULT_MIME_LOCATION
public static final String DEFAULT_MIME_LOCATION
- See Also:
- Constant Field Values
DEFAULT_ENV_LOCATION
public static final String DEFAULT_ENV_LOCATION
- See Also:
- Constant Field Values
SESSION_ENABLED
public static final String SESSION_ENABLED
- See Also:
- Constant Field Values
PATHINFO_ARRAY_ATTR
public static final String PATHINFO_ARRAY_ATTR
- See Also:
- Constant Field Values
PATHINFO_INDEX_ATTR
public static final String PATHINFO_INDEX_ATTR
- See Also:
- Constant Field Values
CONSUMER_PROPERTIES_CACHE
protected static final String CONSUMER_PROPERTIES_CACHE
- See Also:
- Constant Field Values
WebContext
public WebContext()
getCurrentRequestContext
public static RequestContext getCurrentRequestContext()
getRequestContext
public RequestContext getRequestContext()
getCurrentSession
public static CookieSession getCurrentSession()
isInitialized
public boolean isInitialized()
getSession
public CookieSession getSession(HttpServletRequest request,
boolean create)
getSession
public CookieSession getSession(HttpServletRequest request)
persistSession
public boolean persistSession(CookieSession session,
HttpServletRequest request,
HttpServletResponse response)
throws IOException
- Throws:
IOException
invalidateSession
public boolean invalidateSession(HttpServletResponse response)
throws IOException
- Throws:
IOException
isSessionEnabled
public boolean isSessionEnabled()
getServletContext
public ServletContext getServletContext()
getJSPDispatcher
public JSPDispatcher getJSPDispatcher()
getDefaultDispatcher
public DefaultDispatcher getDefaultDispatcher()
setViewDispatchers
public void setViewDispatchers(Map<String,ViewDispatcher> dispatchers)
setViewDispatcher
public void setViewDispatcher(String name,
ViewDispatcher dispatcher)
addViewDispatcher
public void addViewDispatcher(String name,
ViewDispatcher dispatcher)
getViewDispatcher
public ViewDispatcher getViewDispatcher(String name)
setMime
public void setMime(Properties mimes)
setMime
public void setMime(InputStream stream)
setMime
public void setMime(File location)
throws IOException
- Throws:
IOException
setMime
public void setMime(URL location)
throws IOException
- Throws:
IOException
isMimeSupported
public boolean isMimeSupported(String mime)
setEnv
public void setEnv(Properties env)
setEnv
public void setEnv(InputStream stream)
setEnv
public void setEnv(File location)
throws IOException
- Throws:
IOException
setEnv
public void setEnv(URL location)
throws IOException
- Throws:
IOException
setAttributes
public void setAttributes(Map<String,Object> attributes)
setAttribute
public void setAttribute(String name,
Object value)
addAttribute
public void addAttribute(String name,
Object value)
getAttribute
public Object getAttribute(String name)
getProperty
public String getProperty(String name)
newObjectInstance
public static Object newObjectInstance(String className)
throws Exception
- Throws:
Exception
getResource
public static URL getResource(String resource)
service
public void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
- Throws:
ServletException
IOException
preConfigure
protected abstract void preConfigure(ServletConfig config)
throws Exception
- Throws:
Exception
init
protected abstract void init()
destroy
protected abstract void destroy()
handleRoot
protected abstract void handleRoot(RequestContext requestContext)
throws ServletException,
IOException
- Throws:
ServletException
IOException
handlePath
protected abstract void handlePath(RequestContext requestContext)
throws ServletException,
IOException
- Throws:
ServletException
IOException
Copyright © 2008-2013. All Rights Reserved.