public class MockHttpServletResponse extends ObjectSE implements HttpServletResponseEE
HttpServletResponseEE インターフェースのモック実装。Spring Framework 5.0 以降、このモックのセットは Servlet 4.0 ベースラインに基づいて設計されています。
SC_ACCEPTEDEE, SC_BAD_GATEWAYEE, SC_BAD_REQUESTEE, SC_CONFLICTEE, SC_CONTINUEEE, SC_CREATEDEE, SC_EXPECTATION_FAILEDEE, SC_FORBIDDENEE, SC_FOUNDEE, SC_GATEWAY_TIMEOUTEE, SC_GONEEE, SC_HTTP_VERSION_NOT_SUPPORTEDEE, SC_INTERNAL_SERVER_ERROREE, SC_LENGTH_REQUIREDEE, SC_METHOD_NOT_ALLOWEDEE, SC_MOVED_PERMANENTLYEE, SC_MOVED_TEMPORARILYEE, SC_MULTIPLE_CHOICESEE, SC_NO_CONTENTEE, SC_NON_AUTHORITATIVE_INFORMATIONEE, SC_NOT_ACCEPTABLEEE, SC_NOT_FOUNDEE, SC_NOT_IMPLEMENTEDEE, SC_NOT_MODIFIEDEE, SC_OKEE, SC_PARTIAL_CONTENTEE, SC_PAYMENT_REQUIREDEE, SC_PRECONDITION_FAILEDEE, SC_PROXY_AUTHENTICATION_REQUIREDEE, SC_REQUEST_ENTITY_TOO_LARGEEE, SC_REQUEST_TIMEOUTEE, SC_REQUEST_URI_TOO_LONGEE, SC_REQUESTED_RANGE_NOT_SATISFIABLEEE, SC_RESET_CONTENTEE, SC_SEE_OTHEREE, SC_SERVICE_UNAVAILABLEEE, SC_SWITCHING_PROTOCOLSEE, SC_TEMPORARY_REDIRECTEE, SC_UNAUTHORIZEDEE, SC_UNSUPPORTED_MEDIA_TYPEEE, SC_USE_PROXYEE| コンストラクターと説明 |
|---|
MockHttpServletResponse() |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEpublic void setOutputStreamAccessAllowed(boolean outputStreamAccessAllowed)
getOutputStream() アクセスを許可するかどうかを設定します。 デフォルトは true です。
public boolean isOutputStreamAccessAllowed()
getOutputStream() アクセスが許可されているかどうかを返します。public void setWriterAccessAllowed(boolean writerAccessAllowed)
getWriter() アクセスを許可するかどうかを設定します。 デフォルトは true です。
public boolean isWriterAccessAllowed()
getOutputStream() アクセスが許可されているかどうかを返します。public boolean isCharset()
false の場合、getCharacterEncoding() はデフォルトのエンコーディング値を返します。
public void setCharacterEncoding(StringSE characterEncoding)
ServletResponseEE の setCharacterEncodingEE @Nullable public StringSE getCharacterEncoding()
ServletResponseEE の getCharacterEncodingEE public ServletOutputStreamEE getOutputStream()
ServletResponseEE の getOutputStreamEE public PrintWriterSE getWriter() throws UnsupportedEncodingExceptionSE
ServletResponseEE の getWriterEE UnsupportedEncodingExceptionSEpublic byte[] getContentAsByteArray()
public StringSE getContentAsString() throws UnsupportedEncodingExceptionSE
public void setContentLength(int contentLength)
ServletResponseEE の setContentLengthEE public int getContentLength()
public void setContentLengthLong(long contentLength)
ServletResponseEE の setContentLengthLongEE public long getContentLengthLong()
public void setContentType(@Nullable StringSE contentType)
ServletResponseEE の setContentTypeEE @Nullable public StringSE getContentType()
ServletResponseEE の getContentTypeEE public void setBufferSize(int bufferSize)
ServletResponseEE の setBufferSizeEE public int getBufferSize()
ServletResponseEE の getBufferSizeEE public void flushBuffer()
ServletResponseEE の flushBufferEE public void resetBuffer()
ServletResponseEE の resetBufferEE public void setCommitted(boolean committed)
public boolean isCommitted()
ServletResponseEE の isCommittedEE public void reset()
ServletResponseEE の resetEE public void setLocale(LocaleSE locale)
ServletResponseEE の setLocaleEE public LocaleSE getLocale()
ServletResponseEE の getLocaleEE public void addCookie(CookieEE cookie)
HttpServletResponseEE の addCookieEE public CookieEE[] getCookies()
public boolean containsHeader(StringSE name)
HttpServletResponseEE の containsHeaderEE public CollectionSE<StringSE> getHeaderNames()
Servlet 3.0 以降、このメソッドは HttpServletResponse でも定義されます。
HttpServletResponseEE の getHeaderNamesEE Strings の Set、ない場合は空の Set @Nullable public StringSE getHeader(StringSE name)
Servlet 3.0 以降、このメソッドは HttpServletResponse でも定義されています。Spring 3.1 以降、Servlet 3.0 との互換性のために文字列化された値を返します。生のオブジェクトアクセスには getHeaderValue(String) の使用を検討してください。
HttpServletResponseEE の getHeaderEE name - ヘッダーの名前 null public ListSE<StringSE> getHeaders(StringSE name)
Servlet 3.0 以降、このメソッドは HttpServletResponse でも定義されています。Spring 3.1 以降、Servlet 3.0 との互換性のために文字列化された値のリストを返します。生のオブジェクトアクセスには getHeaderValues(String) の使用を検討してください。
HttpServletResponseEE の getHeadersEE name - ヘッダーの名前 @Nullable public ObjectSE getHeaderValue(StringSE name)
複数の値の場合、最初の値を返します。
name - ヘッダーの名前 null public ListSE<ObjectSE> getHeaderValues(StringSE name)
name - ヘッダーの名前 public StringSE encodeURL(StringSE url)
サブクラスでオーバーライドでき、セッション ID などを追加します。
HttpServletResponseEE の encodeURLEE public StringSE encodeRedirectURL(StringSE url)
encodeURL(java.lang.String) に委譲し、指定された URL 文字列をそのまま返します。 サブクラスでオーバーライドでき、リダイレクト固有の方法でセッション ID などを追加できます。一般的な URL エンコーディングルールについては、代わりに一般的な encodeURL(java.lang.String) メソッドをオーバーライドし、一般的な URL だけでなくリダイレクト URL にも適用します。
HttpServletResponseEE の encodeRedirectURLEE @DeprecatedSE public StringSE encodeUrl(StringSE url)
HttpServletResponseEE の encodeUrlEE @DeprecatedSE public StringSE encodeRedirectUrl(StringSE url)
HttpServletResponseEE の encodeRedirectUrlEE public void sendError(int status,
StringSE errorMessage)
throws IOExceptionSEHttpServletResponseEE の sendErrorEE IOExceptionSEpublic void sendError(int status)
throws IOExceptionSEHttpServletResponseEE の sendErrorEE IOExceptionSEpublic void sendRedirect(StringSE url) throws IOExceptionSE
HttpServletResponseEE の sendRedirectEE IOExceptionSEpublic void setDateHeader(StringSE name, long value)
HttpServletResponseEE の setDateHeaderEE public long getDateHeader(StringSE name)
public void addDateHeader(StringSE name, long value)
HttpServletResponseEE の addDateHeaderEE public void setHeader(StringSE name, StringSE value)
HttpServletResponseEE の setHeaderEE public void addHeader(StringSE name, StringSE value)
HttpServletResponseEE の addHeaderEE public void setIntHeader(StringSE name, int value)
HttpServletResponseEE の setIntHeaderEE public void addIntHeader(StringSE name, int value)
HttpServletResponseEE の addIntHeaderEE public void setStatus(int status)
HttpServletResponseEE の setStatusEE @DeprecatedSE public void setStatus(int status, StringSE errorMessage)
HttpServletResponseEE の setStatusEE public int getStatus()
HttpServletResponseEE の getStatusEE public void addIncludedUrl(StringSE includedUrl)