java - Spring Security Failed to load resource: the server responded with a status of 404 -


when ever navigate authenticated url, static contents url's inside href has been attached route's url because of i'm getting 404 resources in page , urls inside href element

for e.x

    <security:http auto-config="true" use-expressions="false">              <security:intercept-url pattern="/reports/**" access="role_user"/>             <security:intercept-url pattern="/**" access="role_anonymous"/>              <security:form-login login-page="/login.do" login-processing-url="/login.do" username-parameter="custom_username"                  password-parameter="custom_password"                  authentication-success-handler-ref="authsuccesshandler"                 default-target-url="/"                 always-use-default-target="true"                 authentication-failure-url="/login.do?error=true"/>                 <security:logout logout-url="/logout.do" logout-success-url="/login.do?logout=true"/>             <security:csrf disabled="true"/>         </security:http >          <security:authentication-manager>             <security:authentication-provider>                 <security:user-service>                     <security:user name="user1" password="password" authorities="role_user"/>                     <security:user name="admin" password="password" authorities="role_user,role_foo"/>                 </security:user-service>             </security:authentication-provider>         </security:authentication-manager> <security:http  pattern="**/styles/**"  security="none" /> <security:http  pattern="**/js/**"  security="none" /> 

when navigate myapp/reports/ static contents have been changed

enter image description here

normally in html looks like

<link href="styles/jqueryui.css" rel="stylesheet" type="text/css" />  <link rel="stylesheet" href="styles/home.css">  <link rel="stylesheet" href="styles/metismenu.min.css">  <link rel="stylesheet" href="styles/sidebar.css">

something missed here have enebled mvc:resources

<mvc:annotation-driven/> <mvc:resources mapping="/webcontent/styles/**" location="css/"  /> <mvc:resources mapping="/webcontent/js/**" location="js/"  /> <mvc:resources mapping="/webcontent/images/**" location="images/"  /> <mvc:resources mapping="/webcontent/fonts/**" location="fonts/"  /> 

there problems @ resource mapping , href attribute of link tag. have not posted directory structure let me explain how sample map: here directory structure : enter image description here

if want add customestyle.min.css html page need following settings :

<mvc:resources mapping="/contents/css/**" location="/contents/css/" /> 

and

<link type="text/css" rel="stylesheet" href='<c:url value="/contents/css/customestyle.min.css"/> '/> 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -