Tuesday, February 23, 2010

Yahoo openID discovery

Yadis Location
http://yahoo.com

XRDS Location
http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds


Monday, February 22, 2010

OpenId provider server/endpoint discovery

OpenID 2.0 discovery
- XRI disovery -> resolve XRDS doc from XRI
- Yadis discovery
 > "X-XRDS-Location" header or meta-attibute
 > return XRDS document when "Get" with a header "Accept:application/xrds+xml"
- HTML based discovery
 > link to endpoint with rel="openid.server" or rel="openid.provider "

xrds document from google OpenID

- says which protocol are supported. Bolds are openId and openId attribute extension
- points to the OP endpoint

 
 
  http://specs.openid.net/auth/2.0/server
  http://openid.net/srv/ax/1.0
  http://specs.openid.net/extensions/ui/1.0/mode/popup
  http://specs.openid.net/extensions/ui/1.0/icon
  http://specs.openid.net/extensions/pape/1.0
  https://www.google.com/accounts/o8/ud 


And for livejournal (openID 1.0)

        http://openid.net/signon/1.0
        http://www.livejournal.com/openid/server.bml


Saturday, February 20, 2010

Servlet and Filter pluggability from servlet 3.0

public class MyListener implements ServletContextListener{
    public void contextInitialized(ServletContextEvent sce) {
        ServletContext sc = sce.getServletContext();
        sc.addServlet("myServlet", "Sample servlet", "foo.bar.MyServlet",
                        null, -1);
        sc.addServletMapping("myServlet", new String[] {"/urlpattern/*"});
        sc.addFilter("myFilter", "Sample Filter", "foo.bar.MyFilter",
                        null);
        sc.addFilterMapping("myFilter", new String[] {"/urlpattern/*"},
                        “myServlet”, DispatcherType.REQUEST, false);
    }
}

Whats new in Servlet 2.4 & 2.5

Servlet 2.4
-- ServletRequest -> get Local/Remote host port ()
- <dispatcher> inside <filter-mapping>, so it helps decide when apply filter? Whether in case of direct request or forward or both?
- ServletRequestListener, ServletRequestAttibuteListener added with other listner clases for Session and Context(2.3)
-- servlet welcome files

Servlet 2.5
-- wildcard(*) matching for <servlet-name> in <filter-mapping>. So can apply a filter for all servlets.
-- multiple <servlet-name> in <filter-mapping>
-- multiple <url-patter> in <filter-mapping> and <servlet-mapping>
- annotation?? whatever

Listed in detail:
http://www.roseindia.net/servlets/DifferenceBetweenServlet2.5AndServlet2.4.shtml

http://www.javaworld.com/javaworld/jw-03-2003/jw-0328-servlet.html
http://www.javaworld.com/javaworld/jw-01-2006/jw-0102-servlet.html

Enable utf-8 for all JSP's

Don't have to put pageEncoding="utf-8" in all JSP pages

  <jsp-config>
    <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <page-encoding>utf-8</page-encoding>
      <!-- This works only on Servlet 2.5+ compatible servlet containers
         (like Tomcat 6.x, Resin 3.1+) -->
      <trim-directive-whitespaces>true</trim-directive-whitespaces>
    </jsp-property-group>
  </jsp-config>