Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2005 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.servlets
Class PortalServletFilter

    java.lang.Object
      com.bea.p13n.servlets.PortalServletFilter

All Implemented Interfaces:
  Filter

public class PortalServletFilter
extends Object
implements Filter

Filters can interact with external resources. In this case, we associate the filter with the Servlet (see web.xml) so that, each time the servlet is called, this filter checks for user logins. If found, it delegates to the SessionHelper for profile swapping into/out of Session, firing events, tagging a logged in user via a Session attribute.

Configure this filter in web.xml as follows: `PortalServletFilter com.bea.p13n.servlets.PortalServletFilter PortalServletFilter *`

Field Summary
`protected boolean` | `createAnonymousProfile`
`protected boolean` | `createNewProfile` If not tracking anonymous, and if not using anonynomus, then we don't create a new profile wrapper.
`protected String` | `defaultSkipPattern`
`protected boolean` | `fireLoginEvent` Init parameters set in web.xml, default values
`protected String` | `skipRequestPattern` Patterns in the request that will cause us to bypass this request.
`protected boolean` | `trackAnonymousUsers`

Constructor Summary
`PortalServletFilter()`

Method Summary
`protected ProfileType` | `checkProfileType(ProfileWrapper profile, HttpServletRequest request, HttpServletResponse response)` Check that we're dealing with the right profile type
`void` | `destroy()`
`void` | `doFilter(ServletRequest req, ServletResponse res, FilterChain chain)` Called when the servlet associated with this filter is invoked.
`protected void` | `doTrackAnonymousUsers(ProfileWrapper profile, HttpServletRequest request, HttpServletResponse response)` If we're tracking anonymous users, more to be done.
`FilterConfig` | `getFilterConfig()` Required by Filter interface
`void` | `init(FilterConfig fc)` The init method is called by the container when the filter is instantiated.
`void` | `setFilterConfig(FilterConfig fc)` Required by Filter interface
`protected void` | `setSkipRequests(String noDo)` Construct the list of requests we're going to ignore
`protected void` | `showHeaders(HttpServletRequest request)` Debug purposes, show headers
`protected void` | `showRequest(HttpServletRequest request)` Debug purposes, show info about request
`protected boolean` | `skipRequest(HttpServletRequest request)` Determine wheter we're going to skip this request

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### createAnonymousProfile

    protected boolean createAnonymousProfile

### createNewProfile

    protected boolean createNewProfile

  If not tracking anonymous, and if not using anonynomus, then we don't create a new profile wrapper. Otherwise, we always create something.

### defaultSkipPattern

    protected String defaultSkipPattern

### fireLoginEvent

    protected boolean fireLoginEvent

  Init parameters set in web.xml, default values

### skipRequestPattern

    protected String skipRequestPattern

  Patterns in the request that will cause us to bypass this request. It's useful to skip images, java script, css, etc

### trackAnonymousUsers

    protected boolean trackAnonymousUsers

Constructor Detail

### PortalServletFilter

    public PortalServletFilter()

Method Detail

### checkProfileType

    protected ProfileType checkProfileType(ProfileWrapper profile,
                                           HttpServletRequest request,
                                           HttpServletResponse response)
                                    throws ServletException

  Check that we're dealing with the right profile type

  Throws:
    `ServletException`

### destroy

    public void destroy()

  Specified by:
    `destroy` in interface `Filter`

### doFilter

    public void doFilter(ServletRequest req,
                         ServletResponse res,
                         FilterChain chain)
                  throws IOException,
                         ServletException

  Called when the servlet associated with this filter is invoked. Test for presence of AnonymousProfileWrapper in Session, do stuff, then send it on to the next filter in the chain, if there is one.

  Specified by:
    `doFilter` in interface `Filter`
  Throws:
    `IOException`
    `ServletException`

### doTrackAnonymousUsers

    protected void doTrackAnonymousUsers(ProfileWrapper profile,
                                         HttpServletRequest request,
                                         HttpServletResponse response)
                                  throws Exception

  If we're tracking anonymous users, more to be done. Make sure we've got the right profile type in session. If user has registered, delete their cookie. If visit threshold exceeded, hand them a new cookie.

  Throws:
    `Exception`

### getFilterConfig

    public FilterConfig getFilterConfig()

  Required by Filter interface

### init

    public void init(FilterConfig fc)
              throws ServletException

  The init method is called by the container when the filter is instantiated. These parameters are configured in web.xml as follows: `PortalServletFilter com.bea.p13n.servlets.PortalServletFilter skipRequestPattern /css/, /js/, /image/, /wlwdir Skip over these type of requests (no profile manipulation). Pattern is glob-style. This entry is REQUIRED. fireSessionLoginEvent false Option to fire SessionLoginEvent , defaults to false if not set createAnonymousProfile true Create an anonymous profile for every session. Defaults to true seconds if not set enableTrackedAnonymous false Option to track anonymous users , defaults to false if not set. 'createAnonymousProfile' is ignored if this is true trackedAnonymousVisitDuration 5 Length in seconds visitor must be on site before we start tracking them . Defaults to 60 seconds if not set`

  Specified by:
    `init` in interface `Filter`
  Throws:
    `ServletException`

### setFilterConfig

    public void setFilterConfig(FilterConfig fc)

  Required by Filter interface

### setSkipRequests

    protected void setSkipRequests(String noDo)

  Construct the list of requests we're going to ignore

### showHeaders

    protected void showHeaders(HttpServletRequest request)

  Debug purposes, show headers

### showRequest

    protected void showRequest(HttpServletRequest request)

  Debug purposes, show info about request

### skipRequest

    protected boolean skipRequest(HttpServletRequest request)

  Determine wheter we're going to skip this request

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2005 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 BEA Systems, Inc. All Rights Reserved