Tomcat CORS filter

The filter org.apache.catalina.filters.CorsFilter seek first a header in the request: Origin. If this header does not exist, the filter does not add any header in the response. Perhaps for that reason does not work. Additionally, in a POST request, look for the header Content-Type. Something similar happens to other methods. May you want to see … Read more

My Application Could not open ServletContext resource

Quote from the Spring reference doc: Upon initialization of a DispatcherServlet, Spring MVC looks for a file named [servlet-name]-servlet.xml in the WEB-INF directory of your web application and creates the beans defined there… Your servlet is called spring-dispatcher, so it looks for /WEB-INF/spring-dispatcher-servlet.xml. You need to have this servlet configuration, and define web related beans … Read more

Meta Tag “apple-mobile-web-app-capable” for Android?

Chrome on Android now supports a meta-tag mobile-web-app-capable: Since Chrome M31, you can set up your web app to have an application shortcut icon added to a device’s homescreen, and have the app launch in full-screen “app mode” using Chrome for Android’s “Add to homescreen” menu item. For details about the mobile-web-app-capable meta-tag, scroll down … Read more

Servlet Mapping using web.xml

It allows servlets to have multiple servlet mappings: <servlet> <servlet-name>Servlet1</servlet-name> <servlet-path>foo.Servlet</servlet-path> </servlet> <servlet-mapping> <servlet-name>Servlet1</servlet-name> <url-pattern>/enroll</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Servlet1</servlet-name> <url-pattern>/pay</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Servlet1</servlet-name> <url-pattern>/bill</url-pattern> </servlet-mapping> It allows filters to be mapped on the particular servlet: <filter-mapping> <filter-name>Filter1</filter-name> <servlet-name>Servlet1</servlet-name> </filter-mapping> Your proposal would support neither of them. Note that the web.xml is read and parsed only once … Read more

iPad doesn’t trigger resize event going from vertical to horizontal?

If I understood you correctly, you want to do something when the user tilts the iPad. Here you go: window.onorientationchange = function(){ var orientation = window.orientation; // Look at the value of window.orientation: if (orientation === 0){ // iPad is in Portrait mode. } else if (orientation === 90){ // iPad is in Landscape mode. … Read more

Right Click Menu using React JS

UPDATE: Figured it out – here is what you can do var addMenu; componentWillMount: function() { addMenu = new nw.Menu(); addMenu.append(new nw.MenuItem({ label: ‘doSomething’, click: function() { // doSomething } })); }, contextMenu: function(e) { e.preventDefault(); addMenu.popup(e.clientX, e.clientY); }, render: function(){ return <button onClick={this.handleClick} onContextMenu={this.contextMenu}>SomethingUseful</button> } In render you can pass a function to onContextMenu … Read more

Apply loading spinner during ui-router resolve

You can use a directive that listens on $routeChangeStart and for example shows the element when it fires: app.directive(‘showDuringResolve’, function($rootScope) { return { link: function(scope, element) { element.addClass(‘ng-hide’); var unregister = $rootScope.$on(‘$routeChangeStart’, function() { element.removeClass(‘ng-hide’); }); scope.$on(‘$destroy’, unregister); } }; }); Then you place it on the specific view’s loader, for example: View 1: <div … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)