public class FacesWebRequest extends FacesRequestAttributes implements NativeWebRequest
REFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_REQUEST, SCOPE_SESSION| コンストラクターと説明 |
|---|
FacesWebRequest(FacesContextEE facesContext) 指定された FacesContext の新しい FacesWebRequest アダプターを作成します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
boolean | checkNotModified(long lastModifiedTimestamp) 提供された最終変更タイムスタンプ(アプリケーションによって決定)を使用して、リクエストされたリソースが変更されたかどうかを確認します。 |
boolean | checkNotModified(StringSE eTag) 提供された ETag (エンティティタグ)を使用して、アプリケーションによって決定された、リクエストされたリソースが変更されたかどうかを確認します。 |
boolean | checkNotModified(StringSE etag, long lastModifiedTimestamp) 提供された ETag (エンティティタグ)およびアプリケーションによって決定された最終変更タイムスタンプを指定して、リクエストされたリソースが変更されたかどうかを確認します。 |
StringSE | getContextPath() このリクエストのコンテキストパスを返します(通常、現在の Web アプリケーションがマップされているベースパス)。 |
StringSE | getDescription(boolean includeClientInfo) 通常、リクエスト URI とセッション ID を含む、このリクエストの簡単な説明を取得します。 |
StringSE | getHeader(StringSE headerName) 指定された名前のリクエストヘッダーを返します。ない場合は null を返します。 |
IteratorSE<StringSE> | getHeaderNames() リクエストヘッダー名に対してイテレータを返します。 |
StringSE[] | getHeaderValues(StringSE headerName) 指定されたヘッダー名のリクエストヘッダー値を返します。ない場合は null を返します。 |
LocaleSE | getLocale() このリクエストのプライマリロケールを返します。 |
ObjectSE | getNativeRequest() 基礎となるネイティブリクエストオブジェクトを返します。 |
<T> T | getNativeRequest(ClassSE<T> requiredType) 可能であれば、基礎となるネイティブリクエストオブジェクトを返します。 |
ObjectSE | getNativeResponse() 基になるネイティブレスポンスオブジェクトがあれば、それを返します。 |
<T> T | getNativeResponse(ClassSE<T> requiredType) 可能であれば、基礎となるネイティブレスポンスオブジェクトを返します。 |
StringSE | getParameter(StringSE paramName) 指定された名前のリクエストパラメーター、または存在しない場合は null を返します。 |
MapSE<StringSE, StringSE[]> | getParameterMap() パラメーター名をマップキー、パラメーター値をマップ値として、リクエストパラメーターの不変のマップを返します。 |
IteratorSE<StringSE> | getParameterNames() リクエストパラメーター名に対してイテレータを返します。 |
StringSE[] | getParameterValues(StringSE paramName) 指定されたパラメーター名のリクエストパラメーター値を返します。ない場合は null を返します。 |
StringSE | getRemoteUser() 存在する場合、このリクエストのリモートユーザーを返します。 |
PrincipalSE | getUserPrincipal() このリクエストのユーザープリンシパルがあれば、それを返します。 |
boolean | isSecure() このリクエストが安全な転送メカニズム(SSL など)を介して送信されたかどうかを返します。 |
boolean | isUserInRole(StringSE role) ユーザーがこのリクエストに対して指定されたロールを持っているかどうかを判断します。 |
StringSE | toString() |
getAttribute, getAttributeMap, getAttributeNames, getExternalContext, getFacesContext, getSessionId, getSessionMutex, registerDestructionCallback, removeAttribute, resolveReference, setAttributecloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSEgetAttribute, getAttributeNames, getSessionId, getSessionMutex, registerDestructionCallback, removeAttribute, resolveReference, setAttributepublic FacesWebRequest(FacesContextEE facesContext)
facesContext - 現在の FacesContextFacesContext.getCurrentInstance()EEpublic ObjectSE getNativeRequest()
NativeWebRequestNativeWebRequest の getNativeRequest HttpServletRequestEEpublic ObjectSE getNativeResponse()
NativeWebRequestNativeWebRequest の getNativeResponse HttpServletResponseEEpublic <T> T getNativeRequest(@Nullable ClassSE<T> requiredType)
NativeWebRequestNativeWebRequest の getNativeRequest requiredType - 目的の型のリクエストオブジェクト null HttpServletRequestEEpublic <T> T getNativeResponse(@Nullable ClassSE<T> requiredType)
NativeWebRequestNativeWebRequest の getNativeResponse requiredType - 希望する型のレスポンスオブジェクト null HttpServletResponseEE@Nullable public StringSE getHeader(StringSE headerName)
WebRequestnull を返します。複数値ヘッダーの場合、最初のヘッダー値を取得します。
WebRequest の getHeader HttpServletRequest.getHeader(String)EE@Nullable public StringSE[] getHeaderValues(StringSE headerName)
WebRequestnull を返します。単一値のヘッダーは、単一の要素を持つ配列として公開されます。
WebRequest の getHeaderValues HttpServletRequest.getHeaders(String)EEpublic IteratorSE<StringSE> getHeaderNames()
WebRequestWebRequest の getHeaderNames HttpServletRequest.getHeaderNames()EE@Nullable public StringSE getParameter(StringSE paramName)
WebRequestnull を返します。複数値パラメーターの場合、最初のパラメーター値を取得します。
WebRequest の getParameter ServletRequest.getParameter(String)EEpublic IteratorSE<StringSE> getParameterNames()
WebRequestWebRequest の getParameterNames ServletRequest.getParameterNames()EE@Nullable public StringSE[] getParameterValues(StringSE paramName)
WebRequestnull を返します。単一値パラメーターは、単一の要素を持つ配列として公開されます。
WebRequest の getParameterValues ServletRequest.getParameterValues(String)EEpublic MapSE<StringSE,StringSE[]> getParameterMap()
WebRequest単一値パラメーターは、単一の要素を持つ配列として公開されます。
WebRequest の getParameterMap ServletRequest.getParameterMap()EEpublic LocaleSE getLocale()
WebRequestWebRequest の getLocale ServletRequest.getLocale()EEpublic StringSE getContextPath()
WebRequestWebRequest の getContextPath HttpServletRequest.getContextPath()EE@Nullable public StringSE getRemoteUser()
WebRequestWebRequest の getRemoteUser HttpServletRequest.getRemoteUser()EE@Nullable public PrincipalSE getUserPrincipal()
WebRequestWebRequest の getUserPrincipal HttpServletRequest.getUserPrincipal()EEpublic boolean isUserInRole(StringSE role)
WebRequestWebRequest の isUserInRole HttpServletRequest.isUserInRole(String)EEpublic boolean isSecure()
WebRequestWebRequest の isSecure ServletRequest.isSecure()EEpublic boolean checkNotModified(long lastModifiedTimestamp)
WebRequestこれにより、"Last-Modified" レスポンスヘッダーと HTTP ステータスが透過的に設定されます(該当する場合)。
典型的な使用箇所:
public String myHandleMethod(WebRequest request, Model model) {
long lastModified = // application-specific calculation
if (request.checkNotModified(lastModified)) {
// shortcut exit - no further processing necessary
return null;
}
// further request processing, actually building content
model.addAttribute(...);
return "myViewName";
}このメソッドは、条件付きの GET/HEAD リクエストで機能しますが、条件付きの POST/PUT/DELETE リクエストでも機能します。
注意 : この #checkNotModified(long) メソッドのいずれかを使用できます。または WebRequest.checkNotModified(String)。HTTP 仕様で推奨されているように、強力なエンティティタグと Last-Modified 値の両方を適用する場合は、WebRequest.checkNotModified(String, long) を使用する必要があります。
"If-Modified-Since" ヘッダーが設定されているが日付値に解析できない場合、このメソッドはヘッダーを無視し、レスポンスの最終変更タイムスタンプの設定に進みます。
WebRequest の checkNotModified lastModifiedTimestamp - アプリケーションが基礎となるリソースに対して決定したミリ秒単位の最終変更タイムスタンプ public boolean checkNotModified(@Nullable StringSE eTag)
WebRequestETag (エンティティタグ)を使用して、アプリケーションによって決定された、リクエストされたリソースが変更されたかどうかを確認します。これにより、該当する場合は "ETag" レスポンスヘッダーと HTTP ステータスが透過的に設定されます。
典型的な使用箇所:
public String myHandleMethod(WebRequest request, Model model) {
String eTag = // application-specific calculation
if (request.checkNotModified(eTag)) {
// shortcut exit - no further processing necessary
return null;
}
// further request processing, actually building content
model.addAttribute(...);
return "myViewName";
} 注意 : この #checkNotModified(String) メソッドのいずれかを使用できます。または WebRequest.checkNotModified(long)。HTTP 仕様で推奨されているように、強力なエンティティタグと Last-Modified 値の両方を適用する場合は、WebRequest.checkNotModified(String, long) を使用する必要があります。
WebRequest の checkNotModified eTag - アプリケーションが基になるリソースに対して決定したエンティティタグ。このパラメーターには、必要に応じて引用符(")が埋め込まれます。public boolean checkNotModified(@Nullable StringSE etag, long lastModifiedTimestamp)
WebRequestETag (エンティティタグ)およびアプリケーションによって決定された最終変更タイムスタンプを指定して、リクエストされたリソースが変更されたかどうかを確認します。これにより、"ETag" と "Last-Modified" のレスポンスヘッダー、および該当する場合は HTTP ステータスが透過的に設定されます。
典型的な使用箇所:
public String myHandleMethod(WebRequest request, Model model) {
String eTag = // application-specific calculation
long lastModified = // application-specific calculation
if (request.checkNotModified(eTag, lastModified)) {
// shortcut exit - no further processing necessary
return null;
}
// further request processing, actually building content
model.addAttribute(...);
return "myViewName";
}このメソッドは、条件付きの GET/HEAD リクエストで機能しますが、条件付きの POST/PUT/DELETE リクエストでも機能します。
注意 : HTTP 仕様では、ETag 値と Last-Modified 値の両方を設定することを推奨していますが、#checkNotModified(String) または WebRequest.checkNotModified(long) を使用することもできます。
WebRequest の checkNotModified etag - アプリケーションが基になるリソースに対して決定したエンティティタグ。このパラメーターには、必要に応じて引用符(")が埋め込まれます。lastModifiedTimestamp - アプリケーションが基礎となるリソースに対して決定したミリ秒単位の最終変更タイムスタンプ public StringSE getDescription(boolean includeClientInfo)
WebRequestWebRequest の getDescription includeClientInfo - セッション ID やユーザー名などのクライアント固有の情報を含めるかどうか public StringSE toString()
ObjectSE の toStringSE