Home / Function/ unauthorizedWithErrorPath() — spring-boot Function Reference

unauthorizedWithErrorPath() — spring-boot Function Reference

Architecture documentation for the unauthorizedWithErrorPath() function in ErrorPageFilterTests.java from the spring-boot codebase.

Entity Profile

Dependency Diagram

graph TD
  dbc270f0_10cd_2e53_0338_0393d69daa87["unauthorizedWithErrorPath()"]
  ceb50e39_12a3_53c8_45a3_31278bc19af6["ErrorPage()"]
  dbc270f0_10cd_2e53_0338_0393d69daa87 -->|calls| ceb50e39_12a3_53c8_45a3_31278bc19af6
  b3fa6802_0fcb_6ddf_3e94_a5f8ad2cf83a["TestFilterChain()"]
  dbc270f0_10cd_2e53_0338_0393d69daa87 -->|calls| b3fa6802_0fcb_6ddf_3e94_a5f8ad2cf83a
  822a5bf1_1210_1d34_4d64_7b2af9ebd5f5["doFilter()"]
  dbc270f0_10cd_2e53_0338_0393d69daa87 -->|calls| 822a5bf1_1210_1d34_4d64_7b2af9ebd5f5
  b31ddfb9_cf30_450c_456a_1eb75ca296e5["getChainResponse()"]
  dbc270f0_10cd_2e53_0338_0393d69daa87 -->|calls| b31ddfb9_cf30_450c_456a_1eb75ca296e5
  7606f772_1e74_2d47_7ffb_917e96483136["getStatus()"]
  dbc270f0_10cd_2e53_0338_0393d69daa87 -->|calls| 7606f772_1e74_2d47_7ffb_917e96483136
  style dbc270f0_10cd_2e53_0338_0393d69daa87 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

core/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/ErrorPageFilterTests.java lines 97–110

	@Test
	void unauthorizedWithErrorPath() throws Exception {
		this.filter.addErrorPages(new ErrorPage("/error"));
		this.chain = new TestFilterChain((request, response, chain) -> response.sendError(401, "UNAUTHORIZED"));
		this.filter.doFilter(this.request, this.response, this.chain);
		assertThat(this.chain.getRequest()).isEqualTo(this.request);
		HttpServletResponseWrapper wrapper = getChainResponse();
		assertThat(wrapper.getResponse()).isEqualTo(this.response);
		assertThat(this.response.isCommitted()).isTrue();
		assertThat(wrapper.getStatus()).isEqualTo(401);
		// The real response has to be 401 as well...
		assertThat(this.response.getStatus()).isEqualTo(401);
		assertThat(this.response.getForwardedUrl()).isEqualTo("/error");
	}

Domain

Subdomains

Frequently Asked Questions

What does unauthorizedWithErrorPath() do?
unauthorizedWithErrorPath() is a function in the spring-boot codebase.
What does unauthorizedWithErrorPath() call?
unauthorizedWithErrorPath() calls 5 function(s): ErrorPage, TestFilterChain, doFilter, getChainResponse, getStatus.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free