Recent Notes
Displaying keyword search results 1 - 10
Created by Fang on March 30, 2012 10:23:21
Last update: March 30, 2012 10:23:21
These bean types are essential for the Spring MVC framework. I copied them here from the Spring Documentation for quick reference. Bean type Explanation HandlerMapping Maps incoming requests to handlers and a list of pre- and post-processors (handler interceptors) based on some criteria the details of which vary by HandlerMapping implementation. The most popular implementation supports annotated controllers but other implementations exists as well. HandlerAdapter Helps the DispatcherServlet to invoke a handler mapped to a request regardless of the handler is actually invoked. For example, invoking an annotated controller requires resolving various annotations. Thus the main purpose of a HandlerAdapter is to shield the DispatcherServlet from such details. HandlerExceptionResolver Maps exceptions to views also allowing for more complex exception handling code. ViewResolver Resolves logical String-based...
Created by Fang on March 30, 2012 10:07:25
Last update: March 30, 2012 10:09:08
After a user resets a password, I want to force the user to change the password before she gets access to secured content. This is usually done with a servlet filter. But with Spring MVC, you can also use a HandlerInterceptor . According to Spring JavaDoc: HandlerInterceptor is basically similar to a Servlet 2.3 Filter, but in contrast to the latter it just allows custom pre-processing with the option of prohibiting the execution of the handler itself, and custom post-processing. Filters are more powerful, for example they allow for exchanging the request and response objects that are handed down the chain. Note that a filter gets configured in web.xml, a HandlerInterceptor in the application context. As a basic guideline, fine-grained handler-related preprocessing tasks are candidates...
Created by Fang on March 02, 2012 13:23:35
Last update: March 02, 2012 13:23:35
The landing page after login can be configured with the default-target-url attribute of form-login . If a user was redirected to the login form after requesting a restricted URL, she's redirected to the original requested page after successful login.
An easy configuration looks like this:
<beans:beans xmlns="http://www.springframework.org...
But there are times that you want to do more initialization after login (such as loading user data), or apply more complex logic before redirecting. This is where the authentication-success-handler-ref attribute comes into play. You create a class that implements org.springframework.security.web.authentication.AuthenticationSuccessHandler and use that as the authentication-success-handler-ref :
<http
entry-point-ref="authProcessFilterEn...
This is a skeleton implementation:
public class MyAuthenticationSuccessHandler implem...
Created by mee2 on November 20, 2011 20:26:05
Last update: November 20, 2011 20:26:34
Stack trace:
Caused by: org.alfresco.error.AlfrescoRuntimeExcep...
Cause:
Location of Alfresco keystore changed via shared/classes/alfresco-global.properties but keystore files not exist.
Solution : copy keystore files from alfresco.war :
cp -R webapps/alfresco/WEB-INF/classes/alfresco/ke...
Created by Fang on November 10, 2011 09:26:12
Last update: November 10, 2011 09:26:12
Syntax highlighted XML schema for JSF 2.0 Application Configuration Resource File ( faces-config.xml ). Almost 3000 lines!
<?xml version="1.0" encoding="UTF-8"?>
<xsd:sch...
Created by Fang on September 07, 2009 20:44:15
Last update: November 03, 2011 14:43:19
Step 1: Repackage a web app as EAR A Java EE application is a multimodule Maven project. At the very least you'll need to package a WAR and an EAR. To get started, I'll simply re-package the simple webapp as an EAR. Create a directory named javaee-app Copy the webapp from here to javaee-app . Rename struts1app to webapp . Create pom.xml under javaee-app :
<project> <modelVersion>4.0.0</modelVersion>... Create a directory named ear under javaee-app . Create pom.xml under ear : <project> <modelVersion>4.0.0</modelVersion>... Modify pom.xml in the webapp directory so that it looks like this: <project> <modelVersion>4.0.0</modelVersion> ... Build with " mvn package " in the javaee-app directory. You can see that ear-1.0.ear is successfully generated in javaee-app/ear/target . Maven successfully resolves dependencies between the sub-projects....
Created by magnum on March 02, 2011 19:38:41
Last update: March 02, 2011 19:38:41
Once you apply a filter to a URL pattern:
<filter-mapping>
<filter-name>theFilter</fi...
there's no option in web.xml to exclude a more specific pattern such as: /public/* .
But you can put the exclusion logic in the filter itself:
<filter>
<filter-name>theFilter</filter-nam...
And in the filter code:
public void init(FilterConfig cfg) throws ServletE...
Created by James on February 14, 2011 12:10:19
Last update: February 14, 2011 20:22:05
I have long noticed that IE8 displays a "broken page" icon while showing my web pages, but didn't pay much attention. Since the world in general considers IE to be broken, it's not so unlogical for IE to see much of the world as broken. Until one day I noticed that the Google home page was not "broken". Then I thought may be I should fix my pages also. So I moused over the "broken page" icon, and this is what I saw: Compatibility View: websites designed for older browsers will often look better, and problems such as out-of-place menus, images, or text will be corrected. Very descriptive indeed! Older browsers? Such as Firefox 1.5? When it comes to MS products, I often had better...
Created by Dr. Xi on November 23, 2010 20:41:28
Last update: January 14, 2011 16:15:20
The servlet API allows servlet filters to be inserted into the processing cycle to form a Filter Chain . How is a chain defined, and what is the ordering of filters in the chain?
The servlet filter chain is formed by defining multiple filters for the same servlet or URL pattern in web.xml . The order in which the filters are invoked is the same order as <filter-mapping> s appear in the web.xml file.
For example, if this is defined in web.xml :
<!-- Filter mapping -->
<filter-mapping>
...
then servletFilter2 will be applied before servletFilter .
Actually, it's more accurate to imagine these filters as layers or wraps instead of chains. In the above example, servletFilter2 wraps servletFilter .
Created by nogeek on December 31, 2010 11:56:25
Last update: December 31, 2010 11:56:25
These are the steps to create a JBoss 5.1.0 configuration with Tomcat from the built-in minimal configuration. Change directory to $JBOSS_HOME/server . Make a copy of the minimal configuration.
cp -R minimal tomcatonly Copy bindingservice.beans from the default configuration. cp -R default/conf/bindingservice.beans tomcatonly... Copy login-config.xml from the default configuration. cp default/conf/login-config.xml tomcatonly/conf/ Edit tomcatonly/conf/jboss-service.xml : Add jars from the common/lib directory: <!-- Load all jars from the JBOSS_DIST/serv... Add the JAAS security manager section (copy from the default profile, and yes, JBoss tomcat can't live without the JBoss JAAS manager). <!-- JAAS security manager and realm mappin... Copy the Tomcat (JBoss web) deployer from the default configuration. cp -R default/deployers/jbossweb.deployer tomcaton... Copy metadata-deployer-jboss-beans.xml and security-deployer-jboss-beans.xml from the default profile. cp default/deployers/metadata-deployer-jboss-b... Copy...