2018-08-17

java tomcat session path



Case deploy to tomcat/webapps/projectA

but access to page by projectA.domain.com/

mean i have tomcat/webapps/projectA/gg.jsp

then deploy to server access by projectA.domain.com/gg.jsp

and facing session path issue.


Solutions refer to:
https://stackoverflow.com/questions/12755499/how-to-change-jsessionid-cookie-path-to-server-root-in-spring-app-on-jetty

<session-config>
    <session-timeout>15</session-timeout>
    <cookie-config>
        <name>JSESSIONID</name>
        <path>/</path>
        <http-only>false</http-only>
        <secure>false</secure>
    </cookie-config>
</session-config>








Reference URL:
https://www.mkyong.com/servlet/how-to-configure-the-session-timeout-in-servlet/

1) Timeout in the deployment descriptor (web.xml)
– Specified the timeout value in “minute” , enclose with “session-config” element.
<web-app ...> <session-config> <session-timeout>20</session-timeout> </session-config></web-app>CopyThe above setting is apply for the entire web application, and session will be kill by container if client doesn’t make any request after 20 minutes.




Reference URL:
https://stackoverflow.com/questions/40753753/cookies-with-path-path-and-jsessionid













2018-08-15

Stuck for 2.5 hrs...


codecommit
git

facing unable to push
keep commit everything
then pull
and face conflict
fix 1 by 1
then add fixed files into index, then commit and push again.



spring 注解 @ResponseBody 返回JSON 能不能设置他不返回为 null 的值


Searched by:
@responsebody without null value
https://www.google.com.sg/search?q=%40responsebody+without+null+value&oq=%40responsebody+without+null+value&aqs=chrome..69i64.7166j0j1&sourceid=chrome&ie=UTF-8


Reference URL:
https://segmentfault.com/q/1010000002522525


设置jackson忽略null

<mvc:annotation-driven>
    <mvc:message-converters register-defaults="true">
        <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
            <property name="objectMapper">
                <bean class="com.fasterxml.jackson.databind.ObjectMapper">
                    <property name="serializationInclusion">
                        <value type="com.fasterxml.jackson.annotation.JsonInclude.Include">NON_NULL</value>
                    </property>
                </bean>
            </property>
        </bean>
    </mvc:message-converters>
</mvc:annotation-driven>




Google Referrals