Do arrowpoint-cookies use "string range"?

I can't find any document mentioning whether or not "advanced-balance arrowpoint-cookie" uses the "string range" setting in a content rule to determine how far to look down the cookie string to find the ARPT cookie. The default setting in the rule is "1 to 100", so if I have a cookie string that looks like this (from a sniffer trace):
HTTP: 12: Cookie: $Version=0; XSESSIONID=Qy8PilVehwrIFD8Fs6tqzbIhtSFe3Qer9Euu2qGE4Ygz1nx29238F0FuFPS!=1730213783!=2102771864!8161!7002; ARPT=OZOMIVS172.16.1.20CK00J; preloginFlag=yes; termsflag=yes
The arrowpoint cookie ARPT is more than 100 characters into the string, so will the CSS not see this cookie and send a new one (thereby rebalancing, possibly to a new server)? Or does advanced-balance arrowpoint-cookie always look through the entire cookie string?
I haven't been able to lab test this, so I was wondering if anyone knew for sure?
Thanks,
Paul

Paul,
for arrowpoint cookie the CSS will look in the first 6 packets - whatever the size.
You can increase or decrease this value with the command
CSS11503(config)# spanning-packets ?
Integer value(Range: 1-20)
The string range has no effect for arrowpoint-cookie.
Regards,
Gilles.
Thanks for rating this answer.

Similar Messages

  • CSS11500 arrowpoint-cookie question

    I'm doing some testing with a CSS11500 in a one-armed configuration.
    I need to ensure that users will stick to the same web server for a period of about 8 hours. I know this can be accomplished with sticky sourceip, but wanted to try arrowpoint-cookies to see how that worked. I believe I have everything configured correctly, but for some reason, I'm not getting any arrowpoint-cookies. Load-balancing is occurring round-robin and there are never any arrowpoint cookies in my Temp Internet Files folder.
    Does anyone have any clues?
    Config below:
    !************************** CIRCUIT **************************
    circuit VLAN1
    ip address 192.168.200.100 255.255.255.0
    no redirects
    !************************** SERVICE **************************
    service adcwps1p
    ip address 158.52.157.197
    string css_adcwps1p
    active
    service adcwps3p
    ip address 158.52.157.195
    keepalive type none
    string css_adcwps3p
    active
    !*************************** OWNER ***************************
    owner WHR_Portal
    content Employee_Portal
    vip address 192.168.200.106
    add service adcwps1p
    add service adcwps3p
    advanced-balance arrowpoint-cookie
    arrowpoint-cookie expiration 00:08:00:00
    arrowpoint-cookie expire-services
    active
    !*************************** GROUP ***************************
    group Portal_Servers
    vip address 192.168.200.106
    portmap number-of-ports 57216
    add destination service adcwps1p
    add destination service adcwps3p
    active

    Gilles-
    Thanks for your reply. The clock is correctly set and is using sntp to keep time synchronized.
    I did a sniffer trace like you asked, and I see the page being served from my VIP. I don't, however, see any arrowpoint-cookies. There is a cookie being set, but it is being set by my source server and, unfortunately, does not provide unique information for stickiness.
    Below is part of the TCP decode from the sniffer trace:
    GET /wps/WhrWasLogin HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*
    Accept-Language: en-us
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)
    Host: portal.whirlpool.com
    Connection: Keep-Alive
    Cookie: WhrCredZmlzYmVnYzswMDAyQjM0MUU3NDg$=5EEB7C1E3A48E3B8
    HTTP/1.1 200 OK
    Date: Fri, 21 Mar 2003 19:12:59 GMT
    Server: IBM_HTTP_Server/1.3.12.6 Apache/1.3.12 (Unix)
    Pragma: no-cache
    Cache-Control: no-cache="set-cookie,set-cookie2"
    Expires: Thu, 01 Jan 1970 00:00:00 GMT
    Set-Cookie: sesessionid=0001DV51K5P5GZ40PGFTEV3AKJY;Path=/
    Keep-Alive: timeout=30
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/html;charset=8859_1
    Content-Language: en

  • CSS arrowpoint cookie load balancing issue

    Hi guys,
    I need some advice on a load balancing issue.
    We have connections hitting the CSS via a proxy environment. As a result i see only one source ip address. I want to use arrowpoint cookies for session stickeyness. However when i enable the rule the tcp session negotiation fails. The CSS sends a TCP/RST which terminates the session.
    Here's the rule config:
    content HTTP_rule
    add service ZSTS299102
    add service ZSTS281101
    vip address <filtered>
    add service LONS299102
    add service LONS281101
    balance weightedrr
    change service ZSTS299102 weight 5
    change service ZSTS281101 weight 5
    advanced-balance arrowpoint-cookie
    protocol tcp
    port 80
    url "/*"
    active
    Any help would be much appreciated.

    Remko,
    in L3/L4 the CSS sends the SYN directly to the server.
    So when the FIN comes in, we simply pass it to the server.
    With L5 the CSS spoofs the connection and we select the server only after receiving the GET.
    If there was some delay between the GET and the FIN, the CSS would have time to establish a connection with the server and the FIN could be simply forwarded.
    Unfortunately, in this case the FIN is right after the GET with no delay.
    Gilles.

  • SELECT command using String

    Hi
    How can I do to select data using string with range:
    srch_strA = notcr-low.
    srch_strb = notcr-high.
    * Building selection
    IF srch_strA IS NOT INITIAL AND srch_strB IS INITIAL.
      CONCATENATE '%' srch_strA '%' INTO srch_strA.
    *document header
      SELECT bukrs belnr gjahr bktxt bldat xblnr
        FROM bkpf INTO CORRESPONDING FIELDS OF TABLE it_bkpf
        WHERE bukrs EQ p_bukrs AND
              belnr IN belnr AND
              gjahr EQ p_gjahr
              AND xblnr IN xblnr
              AND BKTXT LIKE srch_strA.
    ENDIF.
    IF srch_strA NE '' AND srch_strB NE ''.
      CONCATENATE '*' srch_strA '*' INTO srch_strA.
      CONCATENATE '*' srch_strB '*' INTO srch_strB.
      ti_nc-sign    =  'I'.
      ti_nc-option  =  'BT'.
      ti_nc-low     =  srch_strA.
      ti_nc-high    =  srch_strB.
      append ti_nc. clear ti_nc.
    *document header
      SELECT bukrs belnr gjahr bktxt bldat xblnr
      FROM bkpf INTO CORRESPONDING FIELDS OF TABLE it_bkpf
        WHERE bukrs EQ p_bukrs AND
              belnr IN belnr AND
              gjahr EQ p_gjahr
              AND xblnr IN xblnr
              AND BKTXT IN ti_nc.
      ENDIF.
    Thanks in advance.
    Moderator message - Please use code tags around your code
    Edited by: Rob Burbank on Nov 27, 2009 5:26 PM

    Hi,
    Pls. use this code and check if its working...
    srch_strA = notcr-low.
    srch_strb = notcr-high.
    * Building selection
    IF srch_strA IS NOT INITIAL AND srch_strB IS INITIAL.
      CONCATENATE '%' srch_strA '%' INTO srch_strA.
    *document header
      SELECT bukrs belnr gjahr bktxt bldat xblnr
        FROM bkpf INTO CORRESPONDING FIELDS OF TABLE it_bkpf
        WHERE bukrs EQ p_bukrs AND
              belnr IN belnr AND
              gjahr EQ p_gjahr
              AND xblnr IN xblnr
              AND BKTXT LIKE srch_strA.
    ENDIF.
    IF srch_strA NE '' AND srch_strB NE ''.
      CONCATENATE srch_strA '*' INTO srch_strA.
      CONCATENATE srch_strB '*' INTO srch_strB.
      ti_nc-sign    =  'I'.
      ti_nc-option  =  'BT'.
      ti_nc-low     =  srch_strA.
      ti_nc-high    =  srch_strB.
      append ti_nc. clear ti_nc.
    *document header
      SELECT bukrs belnr gjahr bktxt bldat xblnr
      FROM bkpf INTO CORRESPONDING FIELDS OF TABLE it_bkpf
        WHERE bukrs EQ p_bukrs AND
              belnr IN belnr AND
              gjahr EQ p_gjahr
              AND xblnr IN xblnr
              AND BKTXT IN ti_nc.
      ENDIF.
    Thanks,
    Sid

  • Problems with Arrowpoint cookies for clients behind a Proxy

    I have in a WebSite clients being load balanced using Arrowpoint cookies to a virtual Server. The CSS load balance between three Apache real servers.
    I have some clients that are behind some kind of Proxy Cache and I have seen with a sniffer that the proxies causing the problem Re-use proxy to our server connections for different requests for multiple clients.
    Then, as I understand the CSS make the forwarding decission based on the cookie of the first request for the first client behind the proxy after establishing the HTTP connection, but when there is a request from other client using this same connection (that must be forwarded to other real server) the request is forwarded to the original web server and fails because we need sticky connections.
    I thought that this wasn't correct but I have read some documents that say that this is called a Proxy role as a "connection cache". Then my question is if there is any workaround for this problem.
    Thanks

    I believe your problem is that the proxy open a few persistent connections with the CSS and loadbalance your client's request over them.
    Once the CSS has associated a connection with a service, it does not look into the request anymore.
    The solution is to disable persistence on the CSS with the command 'no persistent' and 'persistence reset'.
    Find more info at :
    http://www.cisco.com/en/US/products/hw/contnetw/ps789/products_tech_note09186a0080093e06.shtml#crp
    Gilles.

  • Suggestion on handling cookies using filter

    hi all,
    in your opinoion haw can handle cookies using filter?
    I have to capture request towards a delivery enviroment (i can't touch it!) which use cookie to select the appropriate style sheet.
    As soon as my filter capture the request i would like to add a cookie according to my rules.
    in your opinion is there a way to do it, also using something else other filter?
    thank you,
    Luca

    Presumably, though you cannot touch it, the request still gets directed to your application before the third-party system. You have two options:
    Use a filter
    Use a HttpServletI would opt for the former. Here is some sample code, untested, but should point you in the right direction.
        final public void doPost(final HttpServletRequest request, final HttpServletResponse response)
             throws IOException, ServletException {
            StringBuffer header = new StringBuffer();
            // Output request header
            header.append("POST www.foo.com/otherServlet HTTP/1.1\r\n");
            // Output all headers except cookies
            Enumeration headers = request.getHeaderNames();
            while (headers.hasMoreElements()) {
                String keyCurrent = (String) headers.nextElement();
                // Ignore cookies and content length (will be handled later)
                if ((! keyCurrent.equalsIgnoreCase("cookie")) &&
                    (! keyCurrent.equalsIgnoreCase("content-length"))) {
                     String keyValue = request.getHeader(keyCurrent);
                     header.append(keyCurrent + ": " + keyValue + "\r\n");
            // Output all cookies
            Cookie[] cookies = request.getCookies();
            if (cookies != null) {
                for (int current = 0; current < cookies.length; current++) {
                    Cookie intercepted = interceptCookie(cookies[current]);
                    header.append(intercepted.toString() + "\r\n");
            // Build the request parameters (FORM values) in a separate buffer (to calculate content length)
            StringBuffer payload = new StringBuffer();
            Enumeration parameters = request.getParameterNames();
            int parameterCounter = 0;
            while (parameters.hasMoreElements()) {
                String key = (String) parameters.nextElement();
                String[] values = request.getParameterValues(key);
                if (values != null) {
                    for (int current = 0; current < values.length; current++) {
                        if (parameterCounter > 0)
                            payload.append("&");
                        payload.append(key + "=" + values[current]);
                        parameterCounter++;
            payload.append("\r\n\r\n");
            // Now calculate the content length and add as a header
            header.append("Content-Length: " + payload.length() + "\r\n");
            Socket socket = new Socket("www.foo.com", 80);
            OutputStream out = socket.getOutputStream();
            out.write(header.toString().getBytes());
            out.write("\r\n".getBytes());  // delimter between headers and payload
            out.write(payload.toString().getBytes());
            out.flush();
            out.close();
            socket.close();
        private Cookie interceptCookie(final Cookie target) {
            return target;  // Intercept here and create your own Cookie (if needed)
        }There may be some existing API's that will do this for you. That's just the brute force method that I know.
    - Saish

  • Problems with Arrowpoint Cookies

    I have a CSS 11503 set up in a DMZ that is load balancing 2 Netsilica proxies. All worked ok when I used Sticky Scrcip.
    We are also using Akamai externally, they said clients ip may change during use. Tried to use arrowpoint cookies.
    service
    strig xyz
    content rule
    balance aca
    advance balance arrowpoint-cookie
    arrowpoint-cookie expiration 01:00:01:01
    this seems to bounce the users from proxy to proxy.
    Need sticky non source IP , any ideas welcome
    Thanks
    Steve

    Steve,
    first, if you can't use sourceip for stickyness there is no other solution than cookie.
    Arrowpoint cookie should work.
    Veriy with a sniffer trace if the client is sending the cookie with each request.
    Some browser disable cookies.
    Gilles.

  • ASR and arrowpoint-cookie

    Is it recommended to use ASR on arrowpoint-cookie content rules? I know that when the primary css fails the backup css will accept cookies issued by the primary and then issue a new to the client one for the same server. I understand the need on sticky-srcip content rules.
    Thanks

    With arrowpoint-cookie, there is no sticky table.
    So ASR does not need to exchange information between the 2 CSS.
    However, ASR is also there to preserve active connections after failover.
    So you should use it for every content rules whatever the loadbalancing option.
    Also, I'd like to clarify one point.
    The backup CSS will not issue a new cookie when receiving new connections.
    Both CSS will use the same cookie, which is why there is no need to exchange sticky table info for arrowpoint-cookie.
    This is also why the backyp can take over new connections and understand the cookie presented by the client.
    Regards,
    Gilles.

  • Regex, String Range

    Hello please,
    Appreciate your help here.
    I have a field string that wants to find if that exists between two range strings on character basis.
    Ex:
    String lower boundary : "ABD"
    String upper boundary : "ALGKP"
    field String : "ABE"
    Now the field string "ABE" exists between "ABD" and "ALGKP".
    Here the comparison is char-by-char. i.e
    A is b/w A & A, true
    B is b/w B and L, true
    E is b/w D and G, true
    So finally returns true.
    Another example:
    For the same above boundaries, if the field string is "ABC", it should return false since C not b/w D & G.
    For the same above boundaries, if the field string is "AB", it should return true.
    Thanks
    Dileep
    Edited by: 828040 on Jan 13, 2011 11:34 AM

    828040 wrote:
    For the same above boundaries, if the field string is "ABC", it should return false since C not b/w D & P.You mean since C is not between D and G, right?
    And I agree: Regex is absolutely NOT the way to go here. Just truncate the upper and lower boundaries to the input String's length, then use String.compareTo() to see if it's lexicographically between the boundaries.
    Edited by: jverd on Jan 13, 2011 11:21 AM

  • How to use String toString?

    hey guys,
    I've 2-D array and i would like to printout using String toString method. I'v used that method to printout non-array values but I really don't know how to display 2-D array using the String toString method. Can someone please help me? thanks in advance!

    I do not understand your question. Please post
    whatever code you have and indicate where you are
    stuck.I'm sure you're aware of the String toString method which is often used to display the output in different classes without the main method.
    I've following code:
    public static int bingoCard [][] = new int[SIZE][SIZE]; 
    public BingoCard()   {
            Integer ran = 0;
            for (i = 0; i < SIZE; i ++) {
                 if (i == 0) {
                    min = 1;
                    max = 15;
                } else {
                    min = max + 1;
                    max += 15;
    //             System.out.println("Min: " + min + " " + "Max: " + max);
                // generate all 15 balls in this range
                for (j = min; j <= max; j++) {
                    bC.add(new Integer(j));               
    //             // randomize the 15 balls           
                for (j = 0; j < SIZE; j++) {
                    while (bingoCard[i][j] == 0) {
                        ran = (Integer)bC.removeRandom(); // get Integer object back
                        if (max <= 15 && (ran.intValue() >= 1 && ran.intValue() <= 15))
                            bingoCard[i][j] = ran.intValue();              
                        else if(max <= 30 && (ran.intValue() >= 16 && ran.intValue() <= 30))
                            bingoCard[i][j] = ran.intValue();           
                        else if(max <= 45 && (ran.intValue() >= 31 && ran.intValue() <= 45))
                            bingoCard[i][j] = ran.intValue();              
                        else if(max <= 60 && (ran.intValue() >= 46 && ran.intValue() <= 60))
                            bingoCard[i][j] = ran.intValue();             
                        else if(max <= 75 && (ran.intValue() >= 61 && ran.intValue() <= 75))
                            bingoCard[i][j] = ran.intValue();
    //                 System.out.println("Numbers in the card: " +  bingoCard[i][j]);
            bingoCard[2][2] = 0;       
    Now, i want to dipslay the bingoCard[][] using following method
    public String toString () { // return that array } instead of using following method which displays it for now
    public static void display () {
            for ( i = 0; i < SIZE; i++) {
                 System.out.print(" "+ columnTitles[i] +"   ");
            System.out.println(); 
            for (i = 0; i < SIZE; i++) {  
                for (j = 0; j < SIZE; j++) {               
                    System.out.print(" "+bingoCard[j] +" ");
    if (bingoCard[j][i] < 10)
    System.out.print(" ");
    System.out.println();
    Any help would be really apperciated. =]

  • Arrowpoint cookie HTTP Only flag set.

    Hi All,
    I have a site running an application on which we have identified a vulnerability we wish to close. The CSS11501 is using the advance balance arrowpoint cookie method, however tests are showing that the HTTP only parameter is not set. I am unable to find a way of doing this at present. Does anyone know how to acheive this?
    Until I can do so there is a remote possibilty I am leaving my application open to cross site scripting attacks.
    Microsoft use the HTTPOnly cookie option which sets a HTTPOnly flag. he following url has some information for review.
    Thanks in advance for your help.
    Alfie...

    Alfie,
    your security test tool assume the CSS is a webserver and therefore complains when seeing some missing *flag*.
    However, you won't be able to attack the CSS with whatever method that works against a webserver.
    We have our own onboard DOS feature.
    So, there is no option to use this microsoft HTTPOnly flag because there is no need for it.
    Make sure the servers behind the CSS are protected and have your HTTPOnly flag.
    Gilles.

  • Arrowpoint Cookies, Reverse Proxy and Multiplexed Client Requests

    Hi,
    I have a reverse proxy which is performing SSL offload and making backend connections to two web servers. Between the reverse proxy and the two webservers, a CSS is in place to load balance between the web servers. There is a requirement for session stickiness on the web servers and since client IP details are lost through the reverse proxy I have used the arrowpoint-cookie method to load balance connections.
    However, the reverse proxy seems to make only a handful of connections to the servers compared to the number incoming client connections and we have noticed that stickiness is broken. Now, I would assume this is correct if arrowpoint-cookie makes a load balancing based on the first HTTP get in a tcp stream and not on a per transaction basis AND our reverse proxy is multiplexing client requests. However, I can not convince myself of how the arrowpoint-cookie method actually works.
    I wondered if anyone had any insight on this or had experienced similar issues with arrowpoint cookies?

    Hi Gilles,
    I have implemented this today, and we are still seeing issues with requests hitting the wrong server.
    A bit more info, the reverse proxy is an AXG Web Aopplication Firewall. I have been looking at this and am considering disabling connection re-use on here.
    However I am also wondering if this might be to do with the flow timeout multiplier I am using which is 5 (80 seconds). Perhaps this is too low?
    Thanks, David.

  • Arrowpoint cookies and state changes

    We have an 11050 6.10 build 4 (replacing it soon with a 11501) that is setting a cookie so we can stick a client to a server. The application is also setting a JSESSION cookie. The service is doing a HEAD to a specific page to verify the service is up. The service can change state often (say 1000 times in 2 hours) but the service is not always marked as down. It may only be marked as down 5 to 10 times in those 2 hours. The users are experiencing slow response and are getting kicked out of the application and going back to a login screen. My questions are:
    1. State Change Counters. If I go from alive to dying to alive is that 1 or 2 state changes?
    2. If a service is dying and a client connects to the service with the cookie already set will the CSS send them to the dying server or will it send them to the alive server? If it sends them to the alive server does it reset the cookie?
    3. If the service is down does the CSS send a RST to the client or does it just over write the cookie and send it to the alive server?
    4. Service timeouts. Is it true that the timeout for a service is the frequency -1? So if I have a frequency of 5 seconds if the CSS doesn't get a response within 4 seconds the service would go to the dying state?
    Thanks

    Thanks for the response. According to the Cisco documentation below when a service is down the client will be directed to the alive server. If clients aren't automatically sent to the alive server how would they ever get off the down service?
    The service isn't strange it's the app that's strange ;-) Basically they're getting slow response and the clients are getting kicked out of the app. As usual they want to blame every thing else but the app.
    The increase that I thought I was seeing in the state counters might not be accurate. When I did the show service it said the counters had been cleared this morning and they were already up to 1300. However, no one logged into the CSS except our Ciscoworks server. I'm not sure why it said they were cleared this morning unless CW2K is doing it. I cleared the counters and they're back to zero so I'll monitor it.
    ---Cisco Doc-------
    When a client comes in with a valid cookie request but the sticky server is not available, the CSS uses the sticky-serverdown-failover configuration to handle the request.
    By default, the sticky-serverdown-failover is configured as balance. The sticky-serverdown-failover balance method will treat the client's request as an initial request without the ArrowPoint cookie. It uses the load-balancing algorithm to choose a server, and then redirects the request with a generated ArrowPoint cookie.
    The other option is a failover type of redirect. In this case, the CSS redirects the request to the specified URL.
    The command sticky-no-cookie-found-action should not be configured in an ArrowPoint cookie content rule. Not only will this command not work, it produces many irregularities in the CSS.
    http://www.cisco.com/en/US/products/hw/contnetw/ps789/products_tech_note09186a00801c8c2f.shtml

  • Special characters in XML structure when prepared using String

    Hi,
       I am preparing an XML structure using 'String'. I print the prepared XML structure in the server log. Issue is that I am seeing extra characters([[ and ]]) that I am not printing.
    Please let me know how to get rid of those.
    Code Excerpt
            String xmlHeader = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
            String lsb_xmlcon = xmlHeader;
            logger.info("ReqXMLString Process  1  --->" + lsb_xmlcon);
            lsb_xmlcon = lsb_xmlcon +("\n");
            logger.info("ReqXMLString Process  1.1  --->" + lsb_xmlcon);
            lsb_xmlcon = lsb_xmlcon +("<REQUEST>");
            lsb_xmlcon = lsb_xmlcon +("\n");
            logger.info("ReqXMLString Process  1.2  --->" + lsb_xmlcon);
    Log
    ReqXMLString Process  1  ---><?xml version="1.0" encoding="utf-8" ?>
    ReqXMLString Process  1.1  ---><?xml version="1.0" encoding="utf-8" ?>[[
    ReqXMLString Process  1.2  ---><?xml version="1.0" encoding="utf-8" ?>[[
    <REQUEST>
    Thanks,
    Message was edited by: 996913
    This issue is observed only while running the code in server, not from Jdev.
    When we append the additional tags without new line character, "\n", there are no extra characters being added. Also, in other case also. where we used "Marshaller" to prepare the XML, we have seen this issue.
    After we set the below property to false, we got rid of the extra characters.
                            jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);
    Apparently the insertion of new line when the code runs on server(Weblogic 10.3.6.0) is creating the issue.
    Please let me know if anyone has come across a similar scenario.
    Thanks,

    I am building this XML in a servlet so ,right, DOM does process XML (even though a valid HTML file can be loaded into a DOM object) but if you build XML using DOM then write the XML out using PrintWriter and Transformer objects this will cause the XML to print out in your browser. If you view source on this XML you will see that the DOM object has translated all special characters to there &xxxx; equivalent. For a example: when the string (I know "cool" java) gets loaded into a attribute using the DOM object then wrote back out it looks like (I know &xxx;cool&xxx; java) if you view the source in your browser. This is what it should do, but the DOM object is not change the � to the "&xxxxx;". This servlet is acting as a gateway between a Java API and a windows asp. The asp will call the servlet expecting to get XML back and load it directly into a DOM object. When the windows DOM object gets the xml that I am returning in this servlet is throws a exception "invalid character" because the � was not translated to &xxxx; like the other characters were. According to the book HTML 4 in 24 hours (and other references) the eacute; or #233; are how you say "�" in HTML or XML. How do you say it?

  • How to retrieve IndividualStrings from a txt file using String Tokenizer.

    hello can any one help me to retrieve the individual strings from a txt file using string tokenizer or some thing like that.
    the data in my txt file looks like this way.
    Data1;
    abc; cder; efu; frg;
    abc1; cder2; efu3; frg4;
    Data2
    sdfabc; sdfcder; hvhefu; fgfrg;
    uhfhabc; gffjcder; yugefu; hhfufrg;
    Data3
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    i need to read the data as an individual strings and i need to pass those values to diffarent labels,the dat in Data3 i have to read those values and add to an table datamodel as 6 columns and rows depends on the data.
    i try to retrieve data using buffered reader and inputstream reader,but only the way i am retrieving data as an big string of entire line ,i tried with stringtokenizer but some how i was failed to retrive the data in a way i want,any help would be appreciated.
    Regards,

    Hmmm... looks like the file format isn't even very consistent... why the semicolon after Data1 but not after Data2 or Data3??
    Your algorithm is reading character-by-character, and most of the time it's easier to let a StringTokenizer or StreamTokenizer do the work of lexical analysis and let you focus on the parsing.
    I am also going to assume your format is very rigid. E.g. section Data1 will ALWAYS come before section Data2, which will come before section Data3, etc... and you might even make the assumption there can never be a Data4, 5, 6, etc... (this is why its nice to have some exact specification, like a grammar, so you know exactly what is and is not allowed.) I will also assume that the section names will always be the same, namely "DataX" where X is a decimal digit.
    I tend to like to use StreamTokenizer for this sort of thing, but the additional power and flexibility it gives comes at the price of a steeper learning curve (and it's a little buggy too). So I will ignore this class and focus on StringTokenizer.
    I would suggest something like this general framework:
    //make a BufferedReader up here...
    do
      String line = myBufferedReader.readLine();
      if (line!=null && line.trim().length()>0)
        line = line.trim();
        //do some processing on the line
    while (line!=null);So what processing to do inside the if statement?
    Well, you can recognize the DataX lines easily enough - just do something like a line.startsWith("Data") and check that the last char is a digit... you can even ignore the digit if you know the sections come in a certain order (simplifying assumptions can simplify the code).
    Once you figure out which section you're in, you can parse the succeeding lines appropriately. You might instantiate a StringTokenizer, i.e. StringTokenizer strtok = new StringTokenizer(line, ";, "); and then read out the tokens into some Collection, based on the section #. E.g.
    strtok = new StringTokenizer(line, ";, ");
    if (sectionNo==0)
      //read the tokens into the Labels1 collection
    else if (sectionNo==1)
      //read the tokens into the Labels2 collection
    else //sectionNo must be 2
      //create a new line in your table model and populate it with the token values...
    }I don't think the delimiters are necessary if you are using end-of-line's as delimiters (which is implicit in the fact that you are reading the text out line-by-line). So the original file format you listed looks fine (except you might want to get rid of that rogue semicolon).
    Good luck.

Maybe you are looking for

  • What is the best display to replace a 15" matt MacBook Pro?

    Hi everyone this is my first post. I have a dilemma that I need assistance with. I have plans on buying the new Mac Book Pro after two happy years with my current 2.33 GHZ *15" matt* version. However, as most of you will be aware I won't be able to b

  • Getting Error while starting weblogic

    Hi All, I have 2 machines (1M for DB and 1M for OIM). I have taken clone of both machines and i changed their IPS and HOST NAMES(In all locations that needs to be done) . 1. In DB Clone Machine i have created DB repositry successfully and i started D

  • How to open BSP in the same window of WD?

    Hi, I have a WD that I would like to link to a BSP. I added a link and put the relative path to the BSP. Once I click on that link, the BSP is opened in a new window. I want the BSP to open in the same window, replacing the WD. I tried putting in the

  • Declaration of Rabge table Paramater in Global class method

    Hi Friends, I have created a Global class with a method GET_DATA. In that method,i have written the like  : select * from kna1 into table it_kna1where kunnr in S_kunnr. But, I am getting the error with Range table S_KUNNR. Kindly, Let me know how I s

  • Calling Apex Page from third party

    Hi All, I have a requirement where I need to integrate Oracle Apex with third party application. In the third party application, I have to create a link and on the click of the link have to open the APEX application page in another window. Here the u