LDAP not returning correct number of results through Java?

Hello all,
I've written a little testing application for my new shiny LDAP server and have the following method in it, which performs a search based on department number:
public Vector searchLDAP(String depNumber) throws NamingException          
          String uid;
          String mobile;
          String givenName;
          String sn;
          String telephoneNumber;
          String departmentNumber;
          String employeeType;
          String employeeNumber;
          String reportsTo;
          Vector people = new Vector();
          Attributes matchAttributes = new BasicAttributes(false);
          matchAttributes.put(new BasicAttribute("departmentnumber", depNumber));
          NamingEnumeration results = ctx.search(base, matchAttributes);
          SearchResult tempSR;
          Attributes tempAtt;
          LDAPPerson tmp;
          while(results.hasMore())
               uid = "";
               mobile = "";
               givenName = "";
               sn = "";
               telephoneNumber = "";
               departmentNumber = "";
               employeeType = "";
               employeeNumber = "";
               reportsTo = "";
               tempSR = (SearchResult) results.next();
               tempAtt = tempSR.getAttributes();
               if(atts.get("uid")!=null)
                     uid = (String)atts.get("uid").get();
               if(atts.get("mobile")!=null)
                      mobile = (String)atts.get("mobile").get();
               if(atts.get("givenname")!=null)
                      givenName = (String)atts.get("givenname").get();
               if(atts.get("sn")!=null)
                      sn = (String)atts.get("sn").get();
               System.out.println("Working with " + sn);
               if(atts.get("telephonenumber")!=null)
                      telephoneNumber = (String)atts.get("telephonenumber").get();
               if(atts.get("departmentNumber")!=null)
                      departmentNumber = (String)atts.get("departmentNumber").get();
               if(atts.get("employeeType")!=null)
                      employeeType = (String)atts.get("employeeType").get();
               if(atts.get("employeenumber")!=null)
                      employeeNumber = (String)atts.get("employeeNumber").get();
               if(atts.get("reportsTo")!=null)
                      reportsTo = (String)atts.get("reportsTo").get();
               tmp = new LDAPPerson(uid, mobile, givenName, sn, telephoneNumber, departmentNumber, employeeType, employeeNumber, reportsTo);     
               people.add(tmp);
          return people;
     }But for some reason (perhaps too much coding and not enough coffee?) I get the same person's details twice, instead of the two users I'm a) expecting and b) have retrieved using ldapsearch on the command line.
Have I done something really stupid or is there something I'm not aware of?
Thanks!
Gemma

Hello Gemma!
I think you have used a global class attribute atts and not tempAttr. So you get anything else but not what you wish.
So i think you should change the code in the following way,
i thing it should work ...
(Sorry for the bad code formatting ...)
Greetings
public Vector searchLDAP(DirContext ctx, String base, String depNumber) throws NamingException     
String uid;
String mobile;
String givenName;
String sn;
String telephoneNumber;
String departmentNumber;
String employeeType;
String employeeNumber;
String reportsTo;
Vector people = new Vector();
Attributes matchAttributes = new BasicAttributes(false);
matchAttributes.put(new BasicAttribute("departmentnumber", depNumber));
NamingEnumeration results = ctx.search(base, matchAttributes);
while(results.hasMore())
uid = "";
mobile = "";
givenName = "";
sn = "";
telephoneNumber = "";
departmentNumber = "";
employeeType = "";
employeeNumber = "";
reportsTo = "";
SearchResult tempSR = (SearchResult) results.next();
Attributes atts = tempSR.getAttributes();
     if(atts.get("uid")!=null)
     uid = (String)atts.get("uid").get();
     if(atts.get("mobile")!=null)
          mobile = (String)atts.get("mobile").get();
     if(atts.get("givenname")!=null)
givenName = (String)atts.get("givenname").get();
     if(atts.get("sn")!=null)
     sn = (String)atts.get("sn").get();
     System.out.println("Working with " + sn);
     if(atts.get("telephonenumber")!=null)
telephoneNumber = (String)atts.get("telephonenumber").get();
     if(atts.get("departmentNumber")!=null)
departmentNumber = (String)atts.get("departmentNumber").get();
     if(atts.get("employeeType")!=null)
employeeType = (String)atts.get("employeeType").get();
     if(atts.get("employeenumber")!=null)
employeeNumber = (String)atts.get("employeeNumber").get();
     if(atts.get("reportsTo")!=null)
reportsTo = (String)atts.get("reportsTo").get();
LDAPPerson tmp = new LDAPPerson(uid, mobile, givenName, sn, telephoneNumber, departmentNumber, employeeType, employeeNumber, reportsTo);     
     people.add(tmp);
return people;

Similar Messages

  • Filr 1.1 LDAP Preview Not Returning Correct Number of Result

    I'm finishing set up of Filr 1.1 in our environment but noticed today that the LDAP preview does not return the correct number of results. The query:
    (&(objectClass=Person)(|(employeeType=E)(employeeT ype=Y)(employeeType=Z)))
    has been tried against multiple AD domain controllers and has so far returned 3 different user counts - 2895, 2800, and 2700. Mostly it always returns 2800. The correct count using powershell with the exact same ldap filter is over 5000.
    I would prefer not to try a sync until I have some confidence that it will complete successfully. Any suggestions?

    On Wed, 22 Apr 2015 17:26:03 GMT, jameswatson3
    <[email protected]> wrote:
    >
    > I'm finishing set up of Filr 1.1 in our environment but noticed today
    > that the LDAP preview does not return the correct number of results. The
    > query:
    >
    > (&(objectClass=Person)(|(employeeType=E)(employeeT ype=Y)(employeeType=Z)))
    >
    > has been tried against multiple AD domain controllers and has so far
    > returned 3 different user counts - 2895, 2800, and 2700. Mostly it
    > always returns 2800. The correct count using powershell with the exact
    > same ldap filter is over 5000.
    >
    > I would prefer not to try a sync until I have some confidence that it
    > will complete successfully. Any suggestions?
    Could you try it with filr 1.2?
    https://download.novell.com/Download...d=q-mgVFDsOKQ~

  • Query not returning correct number of records

    Hi Guys,
    Can someone please tell me why this query is not retrieving the correct number of records.
    I have a table with six users
    FIRST_NAME          LAST_NAME
    David               Robert
    Martin               Fisher
    Henry               Robert King
    Edmund               Tomkinson
    Williams          Hayes Robert
    Tina               Belkins
    When I run a query, SELECT * FROM USERS WHERE LAST_NAME LIKE 'Robert';
    I only get 1 record back (David Robert). Is the space between the last name
    causing this? If yes, How can I rewite the query?

    show a copy-paste example of your query...
    you need to use a wild card with LIKE, as in
    SQL> create table test
      2  (first_name varchar2(50)
      3  ,last_name varchar2(50)
      4  );
    Table created.
    SQL>
    SQL> insert into test values ('David' , 'Robert'           );
    1 row created.
    SQL> insert into test values ('Martin', 'Fisher'           );
    1 row created.
    SQL> insert into test values ('Henry' , 'Robert King'      );
    1 row created.
    SQL> insert into test values ('Edmund', 'Tomkinson'        );
    1 row created.
    SQL> insert into test values ('Williams',  'Hayes Robert');
    1 row created.
    SQL> insert into test values ('Tina',  'Belkins');
    1 row created.
    SQL>
    SQL> SELECT * FROM test WHERE LAST_NAME LIKE 'Robert';
    FIRST_NAME
    LAST_NAME
    David
    Robert
    SQL>
    SQL> SELECT * FROM test WHERE LAST_NAME LIKE '%Robert%';
    FIRST_NAME
    LAST_NAME
    David
    Robert
    Henry
    Robert King
    Williams
    Hayes Robert

  • ABAP query not returning correct number of records

    Hi,
    I have created an ABAP Query using logical database VFV and nodes VBRK, VBUK and VBRP.
    But, after entering values for Sales Organisation ( VBRK-VKORG ), Distribution channel ( VBRK-VTWEG ) and Date ( VBRK-FKDAT), the number of records that I get are very less in number as compared to the actual number in the database.
    Please give some pointers to the reason. I have set Lines 60 and Columns length - 83 and selected ALV List.
    Regards,
    Garima.

    Hi Garima,
    Please Check whether you are selecting all the Key fields in your Query.
    Thanks & Regards,
    Ashok kumar.

  • FOR ALL ENTRIES not returning correct number of records

    Hi,
    I have the following code: -
      SELECT vbelv                                     "Delivery
             posnv                                     "Delivery Item
             rfmng                                     "GR Qty
             plmin                                     "Sign
             INTO TABLE t_gr
             FROM vbfa
             FOR ALL ENTRIES IN t_deliveries
             WHERE vbelv   EQ t_deliveries-vbeln
               AND posnv   EQ t_deliveries-posnr
               AND vbtyp_n EQ c_goods_receipt.
    The internal table t_deliveries has a single entry. The table VBFA has 5 records for the delivery/item.
    When the SQL is executed it returns 4 records. If I amend the code to use the following it returns the 5 records. Has anybody had a similar issue.
      LOOP AT t_deliveries INTO st_deliveries.
        SELECT vbelv                                     "Delivery
               posnv                                     "Delivery Item
               rfmng                                     "GR Qty
               plmin                                     "Sign
               APPENDING TABLE t_gr
               FROM vbfa
               WHERE vbelv   EQ st_deliveries-vbeln
                 AND posnv   EQ st_deliveries-posnr
                 AND vbtyp_n EQ c_goods_receipt.
      ENDLOOP.

    FOR ALL Entries can fatch only the unique rows from the table. So, check in the VBFA for the your inputs and the output fields, you will have only 4 unique records. That's why it is picking up only 4 records.
    Try to include one more fields which makes every row as a unique row.
    Regards,
    Naimesh Patel

  • Fsbtodb macro in ufs_fs.h does not return correct disk address

    I'm using fsbtodb to translate the file inode block address to file system block address.
    What I've observed is fsbtodb returns corretct disk address for all the files if file system size < 1 TB.
    But, if ufs file system size is greater than 1 TB then for some files, the macro fsbtodb does not return correct value, it returns -ve value
    Is this a known issue and is this been resolved in new versions
    Thanks in advance,
    dhd

    returns corretct disk address for all the files if file system size < 1 TB.and
    if ufs file system size is greater than 1 TB then for some files, the macro fsbtodb does not return correct value, it returns -ve valueI seem to (very) vaguely recall that you shouldn't be surprised at this example of a functional filesize limitation.
    Solaris 9 was first shipped in May 2002 and though it was the first release of that OS to have extended file attributes I do not think the developers had intended the OS to use raw filesystems larger than 1TB natively.
    That operating environment is just too old to do exactly as you hope.
    Perhaps others can describe this at greater length.

  • Problems with EVGET not Returning Correct Results

    We have several reports with EVGETs that are not working.  It seems to be limited to gets on a particular datasrc when getting members at the base level.  Here is an example.
    Application: Budgeting
    Deptid: D_07104
    Account: A_612080
    Product: P_070040
    Project: PJ_NOPROJ
    Time: 2009.APR
    Datasrc; ACTUALS
    Category: INPUT
    At this point, all the members above are base level members.  A standard EVGET will not return results at this intersection even though there is data.  If we change any of the following (Deptid, product, time, or category) to a parent level member, data will be returned.  Another action we can take to get data to return is open a new worksheet and write the same EVGET on the same intersection and it will return results.  If we go back to the original sheet edit each formula and hit enter it will return the correct results.  If we refresh the sheet, the results will disappear.  We have also tried EVGTS and get similar results.
    Another thing we have tried is copying a month of data from datasrc (ACTUALS) and category (INPUT) to datasrc (NEW_ACTUALS) and category (NEW_INPUT) through the BPC delivered copy.  That seems to work.  I don't know if the copy does something to load the data that we are missing.  We also updated our fact table with a SQL update changing the datasrc and category the same way and processed the application and the data would return through some EVGETs and not others.

    This issue can happen when you have for onde dimension multiple hierachies and something is wrong into hierachies.
    Usually you have dimension formula where you are trying to do calculation of a member from H1 using members from H2.
    This it is an example but it can be other possible errors.
    Any way for sure your issue is related to one dimension having multiple hierachies.
    Regards
    Sorin Radulescu

  • ADDT not returning correct results

    Hello
    SELECT tblTraders.trader_company AS trader_ref, tblTrades.trade_name AS trade_ref, tblT2t.t2t_id
    FROM (tblT2t LEFT JOIN tblTraders ON tblT2t.trader_ref = tblTraders.trader_id) LEFT JOIN tblTrades ON tblT2t.trade_ref = tblTrades.trade_id
    WHERE {$NXTFilter_rstblT2t1}
    ORDER BY {$NXTSort_rstblT2t1}
    With reference to the above SQL statement generated while using dynamic list wizard, the SQL does not return the correct results.
    Sadly the SQL does not retrieve the field "trade_ref" and is blank when the "test" button is used.
    Anyone got any ideas?
    Cheers
    Paul

    Hi Paul,
    does this query return the correct results when loading the page in a browser ?
    Cheers,
    Günter

  • Table not returning correct information

    We had a problem where doing a select count(*) returned a number, but then when a select * was issued not rows were returned. Many iterations were tried. Some returning rows and others not. Then when trying to truncate FK errors occurred. Does anyone know what might have been the problem? Our solution was to drop and re-create the tables. This was in a test environment, but we don't want this to happen in production.
    Thanks.

    Something doesn't sound right to me. I haven't seen this happen in our Oracle databases but have seen this happen with a DB2 database
    when an index was corrupt. The solution was to rebuild the index in that case. I'd issue a statement to validate the structure of the table
    and its indexes:
    analyze table table_name validate structure cascade;
    From the 8.1.7 SQL manual:
    VALIDATE STRUCTURE
    Specify VALIDATE STRUCTURE to validate the structure of the analyzed object. The statistics collected by this clause are not used by the Oracle optimizer, as are
    statistics collected by the COMPUTE STATISTICS and ESTIMATE STATISTICS clauses.
    For a table, Oracle verifies the integrity of each of the table's data blocks and rows.
    For a cluster, Oracle automatically validates the structure of the cluster's tables.
    For a partitioned table, Oracle also verifies that each row belongs to the correct partition. If a row does not collate correctly, its rowid is inserted into the
    INVALID_ROWS table.
    For a temporary table, Oracle validates the structure of the table and its indexes during the current session.
    For an index, Oracle verifies the integrity of each data block in the index and checks for block corruption. This clause does not confirm that each row in the table
    has an index entry or that each index entry points to a row in the table. You can perform these operations by validating the structure of the table with the
    CASCADE clause (described below).
    Oracle stores statistics about the index in the data dictionary views INDEX_STATS and INDEX_HISTOGRAM.
    See Also: Oracle8i Reference for information on these views
    Validating the structure of an object prevents SELECT, INSERT, UPDATE, and DELETE statements from concurrently accessing the object. Therefore, do not use this
    clause on the tables, clusters, and indexes of your production applications during periods of high database activity.
    If Oracle encounters corruption in the structure of the object, an error message is returned to you. In this case, drop and re-create the object.
    INTO table
    Specify a table into which Oracle lists the rowids of the partitions whose rows do not collate correctly. If you omit schema, Oracle assumes the list is in
    your own schema. If you omit this clause altogether, Oracle assumes that the table is named INVALID_ROWS. The SQL script used to create this table
    is UTLVALID.SQL.
    CASCADE
    Specify CASCADE if you want Oracle to validate the structure of the indexes associated with the table or cluster. If you use this clause when validating a
    table, Oracle also validates the table's indexes. If you use this clause when validating a cluster, Oracle also validates all the clustered tables' indexes,
    including the cluster index.
    If you use this clause to validate an enabled (but previously disabled) function-based index, validation errors may result. In this case, you must rebuild the
    index.

  • Missing large number of results through Bing Search API (web results only)

    When making multiple calls to the Bing Web Search API (with a different $skip parameter), many queries I try seem to be missing many of the result I'd expect.
    For example, searching for the string 'obama' on bing.com shows 107,000,000 results available.
    When I search using the web search API using:
    https://api.datamarket.azure.com/Bing/SearchWeb/v1/Web?Query=%27obama%27&%24format=json
    I get 50 results, and the '__next' parameter is given as 'https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/v1/Web?Query='obama'&$skip=50'
    If I repeat this several times, eventually I get a response with less than 50 results, and no '__next' parameter, indicating there are no more results.
    However, I always get far fewer than 1000 results (I'd expect there to be at least 1000). Trying to get 1000 results (by making a request and querying against the '__next' URL), I get different numbers of results each time:
    attempt 1: 355 results
    attempt 2: 441 results
    attempt 3: 358 results
    attempt 4: 692 results
    attempt 5: 692 results
    attempt 6: 694 results
    attempt 7: 659 results
    Querying for this should always return at least 1000 results, since 'obama' has 107,000,000 results listed when searching from bing.com
    Any idea what's going on here?

    Sorry to respond to this old thread, but the problem persists. It exists in both the web UI and the API. The initial result page (on the web) or result object (in the API) report millions of search results, however after clicking through a number of result
    pages (on the web) the total number is reduced to a few hundred. Similarly, in the API, setting the '$skip' parameter above this number does not return results. In the Obama case the first page shows 18.2 million results (http://www.bing.com/search?q=obama&go=Submit+Query&qs=bs&form=QBRE)
    but from page 35 and over only 529 results are reported (e.g., http://www.bing.com/search?q=obama&qs=n&pq=obama&sc=8-3&sp=-1&sk=&ghc=1&cvid=92729d6076e24a37a9e6ee099da99a4a&first=527&FORM=PERE7). Therefore the above problem
    does not seem to be related to the difference between the API and the web UI, but rather that Bing does not provide any results from a certain point (presumably because nobody is interested in them anyway). However, for data mining/web content analysis it
    is desired to get all results, even uninteresting ones. Is this behaviour documented somewhere, or can it be influenced?

  • Bizzare error - datasource and getdate not returning correct day of week

    Hi,
    This is on CFMX 7.0.2,142559.
    I have a data source pointing to a MS SQL server. There is a
    simple query that access a date off the database and extract the
    values of:
    -. Current timestamp
    -. Day of week
    -. First day of week
    The query has been running for years and suddenly it gives me
    the wrong Day of week and First day of week, but the timestamp is
    correct! The result of the calculation for the Day of Week suddenly
    became one day ahead, the @@DATEFIRST switched between 6 and 7
    (being 7 as the correct value).
    Here is the code:
    <cfquery name="dte0" datasource="test123"
    SELECT getdate() dte, DATEPART(dw, getdate()) dteDW,
    @@DATEFIRST dteFirst, @@language LanguageVersion
    </cfquery>
    <cfdump expand="Yes" label="Query Dump" var="#dte0">
    I tried to delete and recreate this data source, restart CF
    and flush the cache with no success.
    The really bizarre thing is for a few minutes after I restart
    CF, it returnes the correct data, but then it suddenly moves one
    day ahead - and again, only the Day of week. The DATEFIRST
    sometimes returns 6 (instead of the correct value of 7) The
    timestamp is ALWAYS correct.
    I then created a second data source with exactly the same
    parameters and named it "test456" and it works perfectly every
    time!!
    I am baffled as how this happened and how to fix it.
    Does anyone know if somehow the datasource "test123" is
    cached somewhere? Appreciate any advice/suggestions/ideas.
    Aditya.

    > The query has been running for years and suddenly it
    gives me the wrong Day of
    > week and First day of week, but the timestamp is
    correct! The result of the
    > calculation for the Day of Week and First day of week
    suddenly became one day
    > ahead.
    >
    > Here is the code:
    >
    > <cfquery name="dte0" datasource="test123"
    > SELECT getdate() dte, DATEPART(dw, getdate()) dteDW,
    $$DATEFIRST dteFirst,
    > @@language LanguageVersion
    > </cfquery>
    > <cfdump expand="Yes" label="Query Dump"
    var="#dte0">
    When CF encouters the string within a <cfquery> tag,
    all it does is resolve
    any CF expressions (there are none in your example), and then
    passes the
    finalised string to the DB and patiently waits for the DB to
    respond, at
    which point CF converts the DB-specific result set to a CF
    recordset, and
    returns it to the calling code. There is very little
    involvement on the
    part of CF other than that: the DB does most of the work, and
    is providing
    all the data.
    All that said, it does seem weird that one DSN returns one
    thing, and
    another returns something else. Is your test rig like this:
    <cfquery name="dte0" datasource="test123"
    SELECT getdate() dte, DATEPART(dw, getdate()) dteDW,
    $$DATEFIRST dteFirst,
    @@language LanguageVersion
    </cfquery>
    <cfdump expand="Yes" label="Query Dump" var="#dte0">
    <cfquery name="dte0" datasource="test456"
    SELECT getdate() dte, DATEPART(dw, getdate()) dteDW,
    $$DATEFIRST dteFirst,
    @@language LanguageVersion
    </cfquery>
    <cfdump expand="Yes" label="Query Dump" var="#dte0">
    IE: both queries to each DSN within the same CF template,
    executed at the
    same time.
    (note: you have a syntax error in your <cfdump>
    statement, so that actually
    *isn't* the code you're running, because it would error).
    If you run the query via some other client (like Query
    Analyser, or SQL
    Studio), what do you get? Does it differ from what CF
    presents?
    Adam

  • MessageChoice does not return correct value

    Hi
    I am problem with MessgeChoiceBean's improver beharior
    For the first time it retunrs blank and subsequently In one page if I select Yes, it returns No.
    In another page it does not return any thing for the first two selections. And I reciev flip values.
    I ran VO outside, VO is returning correct values.
    MessageChoice attributes and associated PPR:
    Data Type: Varchar2
    Initial Value: N
    Pick List view Definition: oracle.apps.xxx.docs.common.lov.server.YesNoVO
    Pick List View Instance: YesNoVO3
    Pick List Display Attribute: Meaning
    Pick List Value AttributeL LookupCode
    ActionType: firePartialAction
    Event: handleNewLocationFlagChange
    Parameter Name: newLocationFlag
    Parameter Value: ${oa.CustomerInfoVO1.NewShipToLocationFlag}
    ProcessParameterForm Code:
    if ("handleNewLocationFlagChange".equals(event))
    String newLocationFlag = pageContext.getParameter("newLocationFlag");
    Serializable[] parameters = { ""+newLocationFlag};
    Class[] paramTypes = { String.class};
    am.invokeMethod("handleNewLocationFlagChange", parameters, paramTypes);
    VO definition:
    select LOOKUP_CODE,MEANING
    FROM ONLINE_DOCS_LOOKUPS
    WHERE ONLINE_DOCUMENT_CODE = 'ALL'
    AND LOOKUP_TYPE = 'YESNO'
    ORDER BY ATTRIBUTE1
    View output:
    LOOKUP_CODE     MEANING
    N     No
    Y     Yes
    I have quite a bit number of columns to change render property.
    Any help will be appreciated.
    Thanks
    Prasad

    Your question is not clear, are you saying the values in the messageChoiceBean is not displayed properly. As far as I can see from the definition the poplist picks the values from a lookup(Yes, No) values and has a PPR action associated with it. Did you check what this method handleNewLocationFlagChange is doing in the AM ?

  • Res.getPathTranslated() does not return correct URL of the page requested

    Hi,
    The res.getPathTranslated() statement in the below code (in doFilter method) does not return the correct URL of the requested webpage.
    Whenever a web page is accessed using a return statement (eg : return "nextPage"; ) inside a button's action method or a hyperlink's action method, the res.getPathTranslated() returns the URL of the current webpage instead of returning the URL of the webpage that is actually requested.
    For example if there is a button on the page http://localhost:29080/MyJaas/faces/firstPage.jsp
    And the button_action() is as follows
    button_action()
    return "nextPage";
    The res.getPageTranslaged() returns "http://localhost:29080/MyJaas/faces/firstPage.jsp" instead of "http://localhost:29080/MyJaas/faces/nextPage.jsp"
    However, if the webpage is requested by populating the URL property of the hyerlink in creator IDE, the res.getPathTranslated() returns the correct (requested) web page.
    How to make res.getPathTranslagted() return the correct URL when the webpage is accessed from hyperlink's / button's action method?
    I know that the explation is not very clear, so please bear with me. Let me know if you need more clarificatons. Thanks in advance for showing interest in this issue.
    And by the way, the code below is the same as that used in Jaas Authentication tutorial :- http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/jaas_authentication.html
    package jaasauthentication;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.http.HttpSession;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class SecurityFilter implements Filter{
        /** Creates a new instance of SecurityFilter */
        private final static String FILTER_APPLIED = "_security_filter_applied";
        public SecurityFilter() {
        public void init(FilterConfig filterConfig) {
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException{
            HttpServletRequest req = (HttpServletRequest)request;
            HttpServletResponse res = (HttpServletResponse)response;
            HttpSession session = req.getSession();
            String requestedPage = req.getPathTranslated();
            String user=null;
            //We dont want to filter certain pages which include the Login.jsp/Register.jsp/Help.jsp
            if(request.getAttribute(FILTER_APPLIED) == null) {
                //check if the page requested is the login page or register page
                if((!requestedPage.endsWith("Login.jsp")) && (!requestedPage.endsWith("Register.jsp")) && (!requestedPage.endsWith("Help.jsp"))){
                    //Requested page is not login.jsp or register.jsp therefore check for user logged in..
                    //set the FILTER_APPLIED attribute to true
                    request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
                    //Check that the session bean is not null and get the session bean property username.
                    if(((jaasauthentication.SessionBean1)session.getAttribute("SessionBean1"))!=null) {
                        user = ((jaasauthentication.SessionBean1)session.getAttribute("SessionBean1")).getUsername();
                    if((user==null)||(user.equals(""))) {
                        res.sendRedirect("Login.jsp");
                        return;
            //deliver request to next filter
            chain.doFilter(request, response);
        public void destroy(){
    }

    Guys any solution for the above problem?
    Right answer fetches 10 duke dollars..

  • Rtrim in where clause not returning correct data

    A select statement specifying
    where rtrim(field_name) &lt;&gt; ''
    is not returning any rows even though there is data on the table with field_name not blank.
    If this particular where clause is omitted the data is returned and rtrim(field_name) is populated correctly.
    This is occurring across different tables and in both 10.2.0.4 and 11.2.0.1 databases. I can't find any references to this being a bug.
    Has anyone else come across this ? Can anyone explain why this is happening please ?

    An empty VARCHAR2 is considered NULL by Oracle.
    sql> select 1 from dual where trim (' ') = '';
    no rows selected
    sql> select 1 from dual where trim (' ') != '';
    no rows selected
    sql> select 1 from dual where trim (' ') is null;
             1
             1

  • L_WMPP_WM_POST Function module not returning TO number

    Hello Friends,
    I am using this function module L_WMPP_WM_POST  to create the transfer order.I am not able to get the no of transfer order since
    the function module is not returning that.
    Is there any method to get the transfer order created.
    Thanks & Regards,
    Hari

    solved on my own.

Maybe you are looking for

  • Hard drive backup for sending powerbook in for repair

    I'm not sure how to ask this in mac speak so please bare with me. I'm about to send my Powerbook in for repair (mechanical not software) I want to backup my HDD so that in the event that something happens I can restore my powerbook to the condition i

  • 10.6.7 and 10.6.8 crash my Mini 2010

    Mini works great with 10.6.6. Have upgraded my MBP without incident. Has same software config as the Mini. 10.6.7 finder becomes unresponsive, machine will not wake from sleep. Restored from time capsule back to 10.6.6. Tried 10.6.8 yesterday. One by

  • BT Hub 2.0 going off constantly

    Hi We recently have had an upgrade to our "local" network as the email described that I received, but since then my BT hub "clicks" all the lights go out and then over a few minutes comes back on, sometimes with the broadband light flashing orange fo

  • How do I change size of JComboBox's popup?

    I have a JComboBox. Problem is, I need the popup from this JComboBox to be wider than the JComboBox itself. How do I do this?

  • Flash Slideshow-Image Fade-CS4 help!

    So thanks to this place I have figured out how to a an image slideshow...but I would like the image to like go white... fade out..and then turn into the next picture,possible seeing the next image bleed through the fade... I am not able to figure it