You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Alkhan <se...@gmail.com> on 2013/08/02 10:29:18 UTC

CSS files are not loaded

Hi, everyone, 

I'm new to Shiro and i have some trouble when i activate by adding the
filter section in the web.xml.
Indeed, all the CSS files are not loaded.

web.xml : 
	<listener>
	
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
	</listener>
	<filter>
		<filter-name>ShiroFilter</filter-name>
		<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>ShiroFilter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher> 
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>ERROR</dispatcher>
	</filter-mapping>

login.xhtml :
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<h:outputStylesheet library="default" name="css/style.css" />
</h:head>
<h:body>
    
Login

    <h:form id="login">
        <h:panelGrid columns="3">
            <h:outputLabel for="username" value="Username:" />
            <h:inputText id="username" value="#{login.username}"
required="true">
                <f:ajax event="blur" render="m_username" />
            </h:inputText>
            <h:message id="m_username" for="username" />

            <h:outputLabel for="password" value="Password:" />
            <h:inputSecret id="password" value="#{login.password}"
required="true">
                <f:ajax event="blur" render="m_password" />
            </h:inputSecret>
            <h:message id="m_password" for="password" />

            <h:outputLabel for="rememberMe" value="Remember Me:" />
            <h:selectBooleanCheckbox id="rememberMe"
value="#{login.remember}" />
            <h:panelGroup />

            <h:panelGroup />
            <h:commandButton value="Login" action="#{login.submit}" >
                <f:ajax execute="@form" render="@form" />
            </h:commandButton>
            <h:messages globalOnly="true" layout="table" />
        </h:panelGrid>
    </h:form>
</h:body>
</html>

I use :
- Glassfish 3
- shiro 1.2.2
- primeface 3.5

Do you have a suggestion?

Thanks



--
View this message in context: http://shiro-user.582556.n2.nabble.com/CSS-files-are-not-loaded-tp7578996.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: CSS files are not loaded

Posted by Nagaraju Kurma <na...@enhancesys.com>.
add this entry for the filter chain definitions

/relative path of the css files/*.css = anon

ex:

/framework/default/skins/css/*.css = anon


On Fri, Aug 2, 2013 at 4:40 PM, Harald Wellmann <hw...@gmail.com>wrote:

> Sounds like Shiro is working and now denies access to your CSS resources.
>
> If they are stored in /resources/default/css or something like that,
> make sure to allow anonymous access to that path in shiro.ini.
>
> Best regards,
> Harald
>
> 2013/8/2 Alkhan <se...@gmail.com>:
> > Hi, everyone,
> >
> > I'm new to Shiro and i have some trouble when i activate by adding the
> > filter section in the web.xml.
> > Indeed, all the CSS files are not loaded.
> >
> > web.xml :
> >         <listener>
> >
> >
> <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
> >         </listener>
> >         <filter>
> >                 <filter-name>ShiroFilter</filter-name>
> >
> <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
> >         </filter>
> >         <filter-mapping>
> >                 <filter-name>ShiroFilter</filter-name>
> >                 <url-pattern>/*</url-pattern>
> >                 <dispatcher>REQUEST</dispatcher>
> >                 <dispatcher>REQUEST</dispatcher>
> >                 <dispatcher>FORWARD</dispatcher>
> >                 <dispatcher>INCLUDE</dispatcher>
> >                 <dispatcher>ERROR</dispatcher>
> >         </filter-mapping>
> >
> > login.xhtml :
> > <html xmlns="http://www.w3.org/1999/xhtml"
> >         xmlns:ui="http://java.sun.com/jsf/facelets"
> >         xmlns:h="http://java.sun.com/jsf/html"
> >         xmlns:f="http://java.sun.com/jsf/core"
> >         xmlns:p="http://primefaces.org/ui">
> > <h:head>
> >         <h:outputStylesheet library="default" name="css/style.css" />
> > </h:head>
> > <h:body>
> >
> > Login
> >
> >     <h:form id="login">
> >         <h:panelGrid columns="3">
> >             <h:outputLabel for="username" value="Username:" />
> >             <h:inputText id="username" value="#{login.username}"
> > required="true">
> >                 <f:ajax event="blur" render="m_username" />
> >             </h:inputText>
> >             <h:message id="m_username" for="username" />
> >
> >             <h:outputLabel for="password" value="Password:" />
> >             <h:inputSecret id="password" value="#{login.password}"
> > required="true">
> >                 <f:ajax event="blur" render="m_password" />
> >             </h:inputSecret>
> >             <h:message id="m_password" for="password" />
> >
> >             <h:outputLabel for="rememberMe" value="Remember Me:" />
> >             <h:selectBooleanCheckbox id="rememberMe"
> > value="#{login.remember}" />
> >             <h:panelGroup />
> >
> >             <h:panelGroup />
> >             <h:commandButton value="Login" action="#{login.submit}" >
> >                 <f:ajax execute="@form" render="@form" />
> >             </h:commandButton>
> >             <h:messages globalOnly="true" layout="table" />
> >         </h:panelGrid>
> >     </h:form>
> > </h:body>
> > </html>
> >
> > I use :
> > - Glassfish 3
> > - shiro 1.2.2
> > - primeface 3.5
> >
> > Do you have a suggestion?
> >
> > Thanks
> >
> >
> >
> > --
> > View this message in context:
> http://shiro-user.582556.n2.nabble.com/CSS-files-are-not-loaded-tp7578996.html
> > Sent from the Shiro User mailing list archive at Nabble.com.
>



-- 

Regards,****

Nagaraju.

Re: CSS files are not loaded

Posted by Harald Wellmann <hw...@gmail.com>.
Sounds like Shiro is working and now denies access to your CSS resources.

If they are stored in /resources/default/css or something like that,
make sure to allow anonymous access to that path in shiro.ini.

Best regards,
Harald

2013/8/2 Alkhan <se...@gmail.com>:
> Hi, everyone,
>
> I'm new to Shiro and i have some trouble when i activate by adding the
> filter section in the web.xml.
> Indeed, all the CSS files are not loaded.
>
> web.xml :
>         <listener>
>
> <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
>         </listener>
>         <filter>
>                 <filter-name>ShiroFilter</filter-name>
>                 <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
>         </filter>
>         <filter-mapping>
>                 <filter-name>ShiroFilter</filter-name>
>                 <url-pattern>/*</url-pattern>
>                 <dispatcher>REQUEST</dispatcher>
>                 <dispatcher>REQUEST</dispatcher>
>                 <dispatcher>FORWARD</dispatcher>
>                 <dispatcher>INCLUDE</dispatcher>
>                 <dispatcher>ERROR</dispatcher>
>         </filter-mapping>
>
> login.xhtml :
> <html xmlns="http://www.w3.org/1999/xhtml"
>         xmlns:ui="http://java.sun.com/jsf/facelets"
>         xmlns:h="http://java.sun.com/jsf/html"
>         xmlns:f="http://java.sun.com/jsf/core"
>         xmlns:p="http://primefaces.org/ui">
> <h:head>
>         <h:outputStylesheet library="default" name="css/style.css" />
> </h:head>
> <h:body>
>
> Login
>
>     <h:form id="login">
>         <h:panelGrid columns="3">
>             <h:outputLabel for="username" value="Username:" />
>             <h:inputText id="username" value="#{login.username}"
> required="true">
>                 <f:ajax event="blur" render="m_username" />
>             </h:inputText>
>             <h:message id="m_username" for="username" />
>
>             <h:outputLabel for="password" value="Password:" />
>             <h:inputSecret id="password" value="#{login.password}"
> required="true">
>                 <f:ajax event="blur" render="m_password" />
>             </h:inputSecret>
>             <h:message id="m_password" for="password" />
>
>             <h:outputLabel for="rememberMe" value="Remember Me:" />
>             <h:selectBooleanCheckbox id="rememberMe"
> value="#{login.remember}" />
>             <h:panelGroup />
>
>             <h:panelGroup />
>             <h:commandButton value="Login" action="#{login.submit}" >
>                 <f:ajax execute="@form" render="@form" />
>             </h:commandButton>
>             <h:messages globalOnly="true" layout="table" />
>         </h:panelGrid>
>     </h:form>
> </h:body>
> </html>
>
> I use :
> - Glassfish 3
> - shiro 1.2.2
> - primeface 3.5
>
> Do you have a suggestion?
>
> Thanks
>
>
>
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/CSS-files-are-not-loaded-tp7578996.html
> Sent from the Shiro User mailing list archive at Nabble.com.

Re: CSS files are not loaded

Posted by Alkhan <se...@gmail.com>.
Yes, that was my problem. Thank you both.

Best regards



--
View this message in context: http://shiro-user.582556.n2.nabble.com/CSS-files-are-not-loaded-tp7578996p7579000.html
Sent from the Shiro User mailing list archive at Nabble.com.