Class PlayWebContext

  • All Implemented Interfaces:
    org.pac4j.core.context.WebContext

    public class PlayWebContext
    extends Object
    implements org.pac4j.core.context.WebContext

    This class is the web context for Play (used both for Java and Scala).

    "Session objects" are managed by the defined SessionStore.

    Since:
    1.1.0
    Author:
    Jerome Leleu
    • Field Detail

      • logger

        protected final org.slf4j.Logger logger
      • PAC4J_REQUEST_ATTRIBUTES

        protected static final play.libs.typedmap.TypedKey<Map<String,​Object>> PAC4J_REQUEST_ATTRIBUTES
      • javaRequest

        protected play.mvc.Http.RequestHeader javaRequest
      • scalaRequest

        protected play.api.mvc.RequestHeader scalaRequest
      • requestContent

        protected String requestContent
      • responseCookies

        protected List<play.mvc.Http.Cookie> responseCookies
      • responseContentType

        protected String responseContentType
      • session

        protected play.mvc.Http.Session session
    • Constructor Detail

      • PlayWebContext

        public PlayWebContext​(play.mvc.Http.RequestHeader javaRequest)
      • PlayWebContext

        public PlayWebContext​(play.api.mvc.RequestHeader scalaRequest)
    • Method Detail

      • getNativeJavaRequest

        public play.mvc.Http.RequestHeader getNativeJavaRequest()
      • getNativeScalaRequest

        public play.api.mvc.RequestHeader getNativeScalaRequest()
      • getRequestHeader

        public Optional<String> getRequestHeader​(String name)
        Specified by:
        getRequestHeader in interface org.pac4j.core.context.WebContext
      • getRequestMethod

        public String getRequestMethod()
        Specified by:
        getRequestMethod in interface org.pac4j.core.context.WebContext
      • getRequestParameter

        public Optional<String> getRequestParameter​(String name)
        Specified by:
        getRequestParameter in interface org.pac4j.core.context.WebContext
      • getRequestParameters

        public Map<String,​String[]> getRequestParameters()
        Specified by:
        getRequestParameters in interface org.pac4j.core.context.WebContext
      • getBody

        protected Object getBody()
      • setResponseHeader

        public void setResponseHeader​(String name,
                                      String value)
        Specified by:
        setResponseHeader in interface org.pac4j.core.context.WebContext
      • getResponseHeader

        public Optional<String> getResponseHeader​(String name)
        Specified by:
        getResponseHeader in interface org.pac4j.core.context.WebContext
      • getServerName

        public String getServerName()
        Specified by:
        getServerName in interface org.pac4j.core.context.WebContext
      • getServerPort

        public int getServerPort()
        Specified by:
        getServerPort in interface org.pac4j.core.context.WebContext
      • getScheme

        public String getScheme()
        Specified by:
        getScheme in interface org.pac4j.core.context.WebContext
      • isSecure

        public boolean isSecure()
        Specified by:
        isSecure in interface org.pac4j.core.context.WebContext
      • getFullRequestURL

        public String getFullRequestURL()
        Specified by:
        getFullRequestURL in interface org.pac4j.core.context.WebContext
      • getRemoteAddr

        public String getRemoteAddr()
        Specified by:
        getRemoteAddr in interface org.pac4j.core.context.WebContext
      • getRequestAttribute

        public Optional<Object> getRequestAttribute​(String name)
        Specified by:
        getRequestAttribute in interface org.pac4j.core.context.WebContext
      • setRequestAttribute

        public void setRequestAttribute​(String name,
                                        Object value)
        Specified by:
        setRequestAttribute in interface org.pac4j.core.context.WebContext
      • getRequestCookies

        public Collection<org.pac4j.core.context.Cookie> getRequestCookies()
        Specified by:
        getRequestCookies in interface org.pac4j.core.context.WebContext
      • getPath

        public String getPath()
        Specified by:
        getPath in interface org.pac4j.core.context.WebContext
      • addResponseCookie

        public void addResponseCookie​(org.pac4j.core.context.Cookie cookie)
        Specified by:
        addResponseCookie in interface org.pac4j.core.context.WebContext
      • setResponseContentType

        public void setResponseContentType​(String contentType)
        Specified by:
        setResponseContentType in interface org.pac4j.core.context.WebContext
      • getRequestContent

        public String getRequestContent()
        Specified by:
        getRequestContent in interface org.pac4j.core.context.WebContext
      • getNativeSession

        public play.mvc.Http.Session getNativeSession()
      • setNativeSession

        public void setNativeSession​(play.mvc.Http.Session session)
      • supplementRequest

        public play.mvc.Http.Request supplementRequest​(play.mvc.Http.Request request)
      • supplementRequest

        public play.mvc.Http.RequestHeader supplementRequest​(play.mvc.Http.RequestHeader request)
      • supplementResponse

        public play.mvc.Result supplementResponse​(play.mvc.Result result)
      • supplementResponse

        public play.api.mvc.Result supplementResponse​(play.api.mvc.Result result)