Spring boot mvc ant mapping - PullRequest
       4

Spring boot mvc ant mapping

0 голосов
/ 03 сентября 2018

enter image description here

Я пытаюсь вызвать / admin / addClient, остальной вызов выполняется, но, возвращаясь из функции, он добавляет / admin в качестве префикса, поэтому делает вызов как / admin / admin / addClient вместо / admin / addClient и возвращает 404. Приложены журналы для более подробной информации.

Контроллер

@RequestMapping(value = "/admin/addClient", method = RequestMethod.POST)
    public ServiceResponse addClient(@RequestBody AddClientRequest request) {
        LOG.info("Adding Client");
        ServiceResponse response = new ServiceResponse();
        if (request == null || !request.isValid()) {
            response.setCode(ApiResponseUtils.INVALID_REQUEST_CODE);
            response.setMessage(ApiResponseUtils.INVALID_REQUEST_MESSAGE);
            return response;
        }
        try {
            response = adminService.addClient(request);
        } catch (Exception e) {
            LOG.error("Error occured while adding client.");
            LOG.error(ApiResponseUtils.EXCEPTION, e);
            response.setCode(ApiResponseUtils.ERROR_CODE);
            response.setMessage(e.getMessage());
        }
        return response;
    }

WebSecurityAdapter

 @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
        .httpBasic().and()
        .csrf().disable()
        .authorizeRequests()
         .antMatchers("/verify").permitAll()
         .antMatchers("/setPassword").permitAll()
         .antMatchers("/forgotPassword").permitAll()
         .antMatchers(HttpMethod.OPTIONS,"/**").permitAll()
         .anyRequest().authenticated()
         .and()
        .exceptionHandling()
         .authenticationEntryPoint(restUnauthorizedEntryPoint)
         .accessDeniedHandler(restAccessDeniedHandler)
         .and()
        .formLogin()
         .loginProcessingUrl("/authenticate")
         .failureHandler(restAuthenticationFailureHandler)
         .successHandler(restAuthenticationSuccessHandler)
         .usernameParameter("username")
         .passwordParameter("password")
         .permitAll()
         .and()
        .logout()
         .logoutUrl("/logout")
         .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler())
         .deleteCookies("JSESSIONID")
         .permitAll()
         .and();
      }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...