Thymeleaf adding ;jsessionid=... to all my js, css requests!

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Thymeleaf adding ;jsessionid=... to all my js, css requests!

Alex2
That's horrible for a caching. How do I put a stop to this?
Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf adding ;jsessionid=... to all my js, css requests!

Zemi
Administrator
Hello,

that's not a default behaviour of Thymeleaf.

Could you give us more details about your configuration?

Regards,
   Zemi

Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf adding ;jsessionid=... to all my js, css requests!

Alex2
While watching the logs a little more, I noticed it doesn't happen consistently. But it happens a lot.

Here's my thymeleaf-spring.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
        xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd       
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">


       
        <bean id="emailTemplateResolver"
                class="org.thymeleaf.templateresolver.ClassLoaderTemplateResolver">
                <property name="prefix" value="mail/" />
                <property name="templateMode" value="HTML5" />
                <property name="characterEncoding" value="UTF-8" />
                <property name="order" value="1" />
        </bean>

        <bean id="webTemplateResolver"
                class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
                <property name="prefix" value="/WEB-INF/templates/" />
                <property name="suffix" value=".html" />
                <property name="characterEncoding" value="UTF-8" />
                <property name="templateMode" value="HTML5" />
                <property name="order" value="2" />
                <property name="cacheable" value="${spring.template.cache}" />
        </bean>

        <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
                <property name="templateResolvers">
                        <set>
                                <ref bean="emailTemplateResolver" />
                                <ref bean="webTemplateResolver" />
                        </set>
                </property>
        </bean>

        <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
                <property name="templateEngine" ref="templateEngine" />
                <property name="contentType" value="text/html; charset=UTF-8" />
                <property name="characterEncoding" value="UTF-8" />
                <property name="order" value="1" />
        </bean>

        <bean
                class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
                <property name="ignoreUnresolvablePlaceholders" value="true" />
                <property name="location">
                        <value>/conf/application.properties</value>
                </property>
        </bean>

</beans>
Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf adding ;jsessionid=... to all my js, css requests!

Zemi
Administrator
There is nothing wrong in your thymeleaf-spring.xml file.

Are you sure that you are not creating sessions on public pages?

Regards,
   Zemi

Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf adding ;jsessionid=... to all my js, css requests!

Alex2
I am creating sessions, because my application requires them. The real question is why are the URLs been rewritten, instead of just using a cookie?

Sent from my iPhone

On Nov 17, 2015, at 6:05 AM, Zemi [via Thymeleaf - User Forum] <[hidden email]> wrote:

There is nothing wrong in your thymeleaf-spring.xml file.

Are you sure that you are not creating sessions on public pages?

Regards,
   Zemi




If you reply to this email, your message will be added to the discussion below:
http://forum.thymeleaf.org/Thymeleaf-adding-jsessionid-to-all-my-js-css-requests-tp4029327p4029332.html
To unsubscribe from Thymeleaf adding ;jsessionid=... to all my js, css requests!, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf adding ;jsessionid=... to all my js, css requests!

Zemi
Administrator
Hello,

URL-rewriting to keep sessions is a standard behaviour . When it is triggered is application server-dependent. For example in Tomcat 6 you can disable it with the disableURLRewriting parameter (http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Common_Attributes).

If you are using Servlet 3+ you can add this to your web.xml to disable it

    <session-config>
        <tracking-mode>COOKIE</tracking-mode>
    </session-config>

Regards,
   Zemi


Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf adding ;jsessionid=... to all my js, css requests!

Alex
That was it. Problem solved. Thank you