Class HttpRequest
- java.lang.Object
-
- org.apache.sling.junit.scriptable.HttpRequest
-
- All Implemented Interfaces:
javax.servlet.http.HttpServletRequest,javax.servlet.ServletRequest
public class HttpRequest extends Object implements javax.servlet.http.HttpServletRequest
Fake request used to acquire content from Sling
-
-
Field Summary
Fields Modifier and Type Field Description static StringFAKE_URL_BASE
-
Method Summary
-
-
-
Field Detail
-
FAKE_URL_BASE
public static final String FAKE_URL_BASE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAuthType
public String getAuthType()
- Specified by:
getAuthTypein interfacejavax.servlet.http.HttpServletRequest
-
getContextPath
public String getContextPath()
- Specified by:
getContextPathin interfacejavax.servlet.http.HttpServletRequest
-
getCookies
public javax.servlet.http.Cookie[] getCookies()
- Specified by:
getCookiesin interfacejavax.servlet.http.HttpServletRequest
-
getDateHeader
public long getDateHeader(String name)
- Specified by:
getDateHeaderin interfacejavax.servlet.http.HttpServletRequest
-
getHeader
public String getHeader(String name)
- Specified by:
getHeaderin interfacejavax.servlet.http.HttpServletRequest
-
getHeaderNames
public Enumeration<String> getHeaderNames()
- Specified by:
getHeaderNamesin interfacejavax.servlet.http.HttpServletRequest
-
getHeaders
public Enumeration<String> getHeaders(String name)
- Specified by:
getHeadersin interfacejavax.servlet.http.HttpServletRequest
-
getIntHeader
public int getIntHeader(String name)
- Specified by:
getIntHeaderin interfacejavax.servlet.http.HttpServletRequest
-
getMethod
public String getMethod()
- Specified by:
getMethodin interfacejavax.servlet.http.HttpServletRequest
-
getPathInfo
public String getPathInfo()
- Specified by:
getPathInfoin interfacejavax.servlet.http.HttpServletRequest
-
getPathTranslated
public String getPathTranslated()
- Specified by:
getPathTranslatedin interfacejavax.servlet.http.HttpServletRequest
-
getQueryString
public String getQueryString()
- Specified by:
getQueryStringin interfacejavax.servlet.http.HttpServletRequest
-
getRemoteUser
public String getRemoteUser()
- Specified by:
getRemoteUserin interfacejavax.servlet.http.HttpServletRequest
-
getRequestedSessionId
public String getRequestedSessionId()
- Specified by:
getRequestedSessionIdin interfacejavax.servlet.http.HttpServletRequest
-
getRequestURI
public String getRequestURI()
- Specified by:
getRequestURIin interfacejavax.servlet.http.HttpServletRequest
-
getRequestURL
public StringBuffer getRequestURL()
- Specified by:
getRequestURLin interfacejavax.servlet.http.HttpServletRequest
-
getServletPath
public String getServletPath()
- Specified by:
getServletPathin interfacejavax.servlet.http.HttpServletRequest
-
getSession
public javax.servlet.http.HttpSession getSession()
- Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest
-
getSession
public javax.servlet.http.HttpSession getSession(boolean create)
- Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest
-
getUserPrincipal
public Principal getUserPrincipal()
- Specified by:
getUserPrincipalin interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
- Specified by:
isRequestedSessionIdFromCookiein interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()
- Specified by:
isRequestedSessionIdFromUrlin interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
- Specified by:
isRequestedSessionIdFromURLin interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
- Specified by:
isRequestedSessionIdValidin interfacejavax.servlet.http.HttpServletRequest
-
isUserInRole
public boolean isUserInRole(String role)
- Specified by:
isUserInRolein interfacejavax.servlet.http.HttpServletRequest
-
getAttribute
public Object getAttribute(String name)
- Specified by:
getAttributein interfacejavax.servlet.ServletRequest
-
getAttributeNames
public Enumeration<String> getAttributeNames()
- Specified by:
getAttributeNamesin interfacejavax.servlet.ServletRequest
-
getCharacterEncoding
public String getCharacterEncoding()
- Specified by:
getCharacterEncodingin interfacejavax.servlet.ServletRequest
-
getContentLength
public int getContentLength()
- Specified by:
getContentLengthin interfacejavax.servlet.ServletRequest
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfacejavax.servlet.ServletRequest
-
getInputStream
public javax.servlet.ServletInputStream getInputStream() throws IOException- Specified by:
getInputStreamin interfacejavax.servlet.ServletRequest- Throws:
IOException
-
getLocalAddr
public String getLocalAddr()
- Specified by:
getLocalAddrin interfacejavax.servlet.ServletRequest
-
getLocale
public Locale getLocale()
- Specified by:
getLocalein interfacejavax.servlet.ServletRequest
-
getLocales
public Enumeration<Locale> getLocales()
- Specified by:
getLocalesin interfacejavax.servlet.ServletRequest
-
getLocalName
public String getLocalName()
- Specified by:
getLocalNamein interfacejavax.servlet.ServletRequest
-
getLocalPort
public int getLocalPort()
- Specified by:
getLocalPortin interfacejavax.servlet.ServletRequest
-
getParameter
public String getParameter(String name)
- Specified by:
getParameterin interfacejavax.servlet.ServletRequest
-
getParameterMap
public Map<String,String[]> getParameterMap()
- Specified by:
getParameterMapin interfacejavax.servlet.ServletRequest
-
getParameterNames
public Enumeration<String> getParameterNames()
- Specified by:
getParameterNamesin interfacejavax.servlet.ServletRequest
-
getParameterValues
public String[] getParameterValues(String name)
- Specified by:
getParameterValuesin interfacejavax.servlet.ServletRequest
-
getProtocol
public String getProtocol()
- Specified by:
getProtocolin interfacejavax.servlet.ServletRequest
-
getReader
public BufferedReader getReader() throws IOException
- Specified by:
getReaderin interfacejavax.servlet.ServletRequest- Throws:
IOException
-
getRealPath
public String getRealPath(String path)
- Specified by:
getRealPathin interfacejavax.servlet.ServletRequest
-
getRemoteAddr
public String getRemoteAddr()
- Specified by:
getRemoteAddrin interfacejavax.servlet.ServletRequest
-
getRemoteHost
public String getRemoteHost()
- Specified by:
getRemoteHostin interfacejavax.servlet.ServletRequest
-
getRemotePort
public int getRemotePort()
- Specified by:
getRemotePortin interfacejavax.servlet.ServletRequest
-
getRequestDispatcher
public javax.servlet.RequestDispatcher getRequestDispatcher(String path)
- Specified by:
getRequestDispatcherin interfacejavax.servlet.ServletRequest
-
getScheme
public String getScheme()
- Specified by:
getSchemein interfacejavax.servlet.ServletRequest
-
getServerName
public String getServerName()
- Specified by:
getServerNamein interfacejavax.servlet.ServletRequest
-
getServerPort
public int getServerPort()
- Specified by:
getServerPortin interfacejavax.servlet.ServletRequest
-
isSecure
public boolean isSecure()
- Specified by:
isSecurein interfacejavax.servlet.ServletRequest
-
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttributein interfacejavax.servlet.ServletRequest
-
setAttribute
public void setAttribute(String name, Object o)
- Specified by:
setAttributein interfacejavax.servlet.ServletRequest
-
setCharacterEncoding
public void setCharacterEncoding(String env) throws UnsupportedEncodingException
- Specified by:
setCharacterEncodingin interfacejavax.servlet.ServletRequest- Throws:
UnsupportedEncodingException
-
getContentLengthLong
public long getContentLengthLong()
- Specified by:
getContentLengthLongin interfacejavax.servlet.ServletRequest
-
getServletContext
public javax.servlet.ServletContext getServletContext()
- Specified by:
getServletContextin interfacejavax.servlet.ServletRequest
-
startAsync
public javax.servlet.AsyncContext startAsync() throws IllegalStateException- Specified by:
startAsyncin interfacejavax.servlet.ServletRequest- Throws:
IllegalStateException
-
startAsync
public javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws IllegalStateException- Specified by:
startAsyncin interfacejavax.servlet.ServletRequest- Throws:
IllegalStateException
-
isAsyncStarted
public boolean isAsyncStarted()
- Specified by:
isAsyncStartedin interfacejavax.servlet.ServletRequest
-
isAsyncSupported
public boolean isAsyncSupported()
- Specified by:
isAsyncSupportedin interfacejavax.servlet.ServletRequest
-
getAsyncContext
public javax.servlet.AsyncContext getAsyncContext()
- Specified by:
getAsyncContextin interfacejavax.servlet.ServletRequest
-
getDispatcherType
public javax.servlet.DispatcherType getDispatcherType()
- Specified by:
getDispatcherTypein interfacejavax.servlet.ServletRequest
-
changeSessionId
public String changeSessionId()
- Specified by:
changeSessionIdin interfacejavax.servlet.http.HttpServletRequest
-
authenticate
public boolean authenticate(javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException- Specified by:
authenticatein interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
login
public void login(String username, String password) throws javax.servlet.ServletException
- Specified by:
loginin interfacejavax.servlet.http.HttpServletRequest- Throws:
javax.servlet.ServletException
-
logout
public void logout() throws javax.servlet.ServletException- Specified by:
logoutin interfacejavax.servlet.http.HttpServletRequest- Throws:
javax.servlet.ServletException
-
getParts
public Collection<javax.servlet.http.Part> getParts() throws IOException, javax.servlet.ServletException
- Specified by:
getPartsin interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
getPart
public javax.servlet.http.Part getPart(String name) throws IOException, javax.servlet.ServletException
- Specified by:
getPartin interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
upgrade
public <T extends javax.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, javax.servlet.ServletException
- Specified by:
upgradein interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
-