Showing posts with label JSP. Show all posts
Showing posts with label JSP. Show all posts

Thursday, 7 May 2015

Configure Tomcat with multiple virtual hosts and change webapps directory

conf/server.xml

  <Host name="testvimal.local.com" debug="0" appBase="/Users/vimal-zt58/Downloads/outwebapps" unpackWARs="true">
        <Alias>www.domain1.com</Alias>
             <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
        </Host>



/etc/hosts

127.0.0.1      testvimal.local.com

Wednesday, 18 February 2015

Http Cookie

Types of Http Cookie


  • Session Cookie - browser close expired. not any expire time
  • Persistent Cookie - Max-Age one year 
  • Secure Cookie - https only access. encrypt while send client to server
  • Http only cookie - only access via http not using javascript or 
  • Third party cookie - thrid party site cookie store. browser doesn't allow third part cookie util enable browser setting
  • Super cookie - .com super domain cookie. default disable in browser
  • Zombie cookie - delete also recreate the cookie from storage




Sunday, 15 February 2015

ReactJs

1. ReactJS - Server side Rendering Using Java(jdk1.7)

<%
String output="var value=[]";
ScriptEngineManager sem = new ScriptEngineManager();
ScriptEngine se = sem.getEngineByName("rhino");
// React depends on the "global" variable and console variable
se.eval("var global = this");
se.eval("var console = {}");
se.eval("console.warn = function(){};");
// eval react.js
se.eval(new FileReader("/react-0.12.2.js")); // React Location
se.eval(output); // variable for component props
se.eval(new FileReader("/Component.js")); // React Component location (Component should be converted js file not jsx file)
String render ="React.renderToString(React.createFactory(Component)({props: value}))";
%>

<%=se.eval(render)%> // execute the component get html as a string