InputStreamReader time out

About half the time I catch this exception: java.net.ConnectException: Connection timed out: connect, while connecting to a URL. Is there a way to extend the time out limit?

Ah thanks, but I still can't find anything on timeouts in the API for URL. I'm not using URLConnection.
Here's pretty much what I have:
import java.net.*;
import java.io.*;
import java.util.*;
public class Request
  public Request(String ID)
  { try {
      URL url = new URL("http://www.yahoo.com");
      BufferedReader in = new BufferedReader(new
        InputStreamReader(url.openStream()));
      String line;
      while ((line = in.readLine()) != null) {
        GUI.txtWonIdResults.append(line + "\n");
    } catch(Exception e) {
      System.out.println("Error " + e);
}

Similar Messages

  • Sockets - BufferedReader.read() operation time-out

    Hi all,
    I'm facing some problems to receive data over socket connection from a PC. I send data via BufferedWriter, but I have time-out error (IOException: Operation timed-out) and I can't see why it happens.
    Here is part of my code:
    StringBuffer strBuffer = new StringBuffer();
              int charRead;
              File xmlFile = null;
              FileWriter fw = null;
              try{
                   if(s != null){
                        bufReader = new BufferedReader(new InputStreamReader(s.getInputStream()));
                   xmlFile = new File(fileName);
                   if(xmlFile.exists())
                        xmlFile.delete();
                        xmlFile.createNewFile();
                        fw = new FileWriter(xmlFile);     
                   }else{
                        connect();
                   //while((line = bufReader.readLine()) != null)
                   while((charRead = bufReader.read()) > -1)
                        strBuffer.append((char)charRead );
                   bufReader.close();          
                   String writeString = strBuffer.substring(4);
                   if(fw == null){
                        setErroSocket(true);
                        setMsgErroSocket("I/O Error: Erro recebendo dados via Socket");
                   fw.write(writeString);
                   fw.flush();
              }catch(IOException ioE){
                   setErroSocket(true);
                   setMsgErroSocket("I/O Error: " + ioE.getMessage());
              return xmlFile;
    If nore detailed information is need, please ask me.
    Thanks for any help !

    Hi,
    I believe I found where was the problem. I was a bit confused with setSoTimeout(), because I thought it set the limit of time for read bytes, but in fact it controls the limit of time that conection is off. Looking a little deeper in my code I saw that bytes are read, but the exception occurs the same way.
    I just need to change some things because I need a permanent client socket on-line because I'll need constantly comunication with a server application (Delphi) running on a PC. I believe that I must start with changing my ClientSocket class into a Thread.
    Thanks for your help !

  • Socket mostly times out, connection refused.

    Hello,
    I am writing my own version of dc-hub in Java. This is my first networking program I make.
    The main class has a ServerSocket running on port 411 and it will then make another socket when someone connects. Although at the moment 198 users are connected, it seems that the server mostly gives a time out when you try to connect. It's not a firewall problem, because I get them (localhost) as well. The server also runs on localhost.
    This is the code:
    ServerSocket serverSock = new ServerSocket(411);while(true) {      Socket sock = serverSock.accept();      new ConnectorThread(sock,P,U);}
    I really have no clue why I and a lot of other users get time outs...
    I'll post the results from the client program (DC++):
    [17:39] *** Connection refused by target machine
    [17:39] *** Connecting to localhost...
    [17:39] *** Connection refused by target machine
    [17:39] *** Connecting to localhost...
    [17:40] *** Connection refused by target machine
    [17:40] *** Connecting to localhost...
    [17:40] *** Connected
    [17:40] <Hub-Security> Welcome to Tom's personal hubsoftware V1.0
    Oh... yeah... I get Connection refused, while my friends are receiving "Connection time out..."
    Again: It's not a firewall or router problem... I know that 100% sure...
    I hope someone knows how to fix this problem, I've searched the forum without a result for my problem.
    Thank you in advance,
    Tom

    I am running 1.4.2_05 on win2000
    Client code
    //{{{  Imports
    import java.io.*;
    import java.net.* ;
    * This class provides access to the IOR String via HTTP protocol.
    * Server accepts connection from anywhere
    public class SockClient // extends Thread
    //  public static int HTTPIORPort = 2096;
    //  ServerSocket incommingSocket = null;
    //  private int SockTimeout = 5000; // 5 seconds
      SockClient()
        for (int i = 0 ; i < 40 ; i++)
          try
            new GetThread(i);
          catch (Exception e)
            System.out.println("Caught Exception:");
            e.printStackTrace();
      public static void main (String args[])
        new SockClient();   
      class GetThread extends Thread
        int gen;
        GetThread(int i)
          //setDaemon(true);
          setDaemon(false);
          gen = i;
          start();
        public void run()
          int count = 69;
          try
            Socket socket = new Socket(InetAddress.getByName("localhost"), 2096);
            //System.out.println("timeout="+ socket.getSoTimeout());
            InputStream in = socket.getInputStream();
            OutputStream out = socket.getOutputStream();
            String get = "GET / HTTP/1.1\r\n\r\n";
            out.write(get.getBytes());
            byte[] buf = new byte[1024];
            while (count > 0)
              count = in.read(buf);
          catch (Exception e)
            System.out.println("Caught exception (g="+gen+"):("+count+")"+e.toString());
            //e.printStackTrace();
    }Server code:
    *  Handles HTTP requests
    //{{{  Imports
    import java.io.*;
    import java.net.* ;
    import java.util.* ;
    * This class provides access to the IOR String via HTTP protocol.
    * Server accepts connection from anywhere
    public class SockServer // extends Thread
      public static int HTTPIORPort = 2096;
      ServerSocket incommingSocket = null;
      private int sockTimeout = 5000; // 5 seconds
      public static void main (String args[])
        try
          new SockServer();
        catch (Exception e)
          System.out.println("main: Exception"+e.toString());
      SockServer() throws IOException
        System.out.println("Thread running: HTTPListener");
        Socket incommingRequest = null;
        try
          incommingSocket = new ServerSocket(HTTPIORPort);
          System.out.println("Timeout set to "+incommingSocket.getSoTimeout());
          //incommingSocket.setSoTimeout(sockTimeout); // 5 seconds
        catch (Exception e)
          System.out.println("Unable to start HTTP IOR Server");
          System.exit(1);
        //  Ready to Accept connections
        System.out.println("Started HTTPListener listening on "+HTTPIORPort);
        while (true)
          try
            synchronized(incommingSocket)
              incommingRequest = incommingSocket.accept();
              handleRequest(incommingRequest);
          catch (java.net.SocketTimeoutException to)
          catch (Exception e)
            System.out.println("Could not accept HTTP request: "+e.toString());
            break;
        // Close sockets
        try
          incommingRequest.close();
          incommingSocket.close();
        catch (Exception e) { }
        System.out.println("Thread exit: HTTPListener");
      void handleRequest(Socket ic)
        System.out.println("Received HTTP IOR Request from: "+
            ic.getInetAddress().getHostAddress()+":"+ic.getPort());
        final Socket httpRequest = ic;
        final String qmVersion = "1.0";
        final BufferedReader inData ;
        final OutputStream outData;
        try
          inData = new BufferedReader(new InputStreamReader(httpRequest.getInputStream()));
          //PrintWriter outData = new PrintWriter(httpRequest.getOutputStream(), true);
          //DataOutputStream outData = new DataOutputStream(httpRequest.getOutputStream());
          outData = httpRequest.getOutputStream();
        catch (Exception e)
          System.out.println("Caught set up streams:" +e.toString());
          return;
        new Thread (null, null, "HTTPAnswerThread", 10 * 1024)
            String page = null;
            // Anonymous contructor
              setDaemon(true);
              start();
            // Anonymous Thread to handle http request
            public void run ()
                String input = "starting";
              try
                // Ditch incoming header
                while (input.length() != 0)
                  input = inData.readLine();
                  if (input == null)
                    System.out.println("input == null");
                    break;
                page = "IOR:000000000000002349444C3A515F5175656E74696E2F515F496E7465726E616C506F7274616C3A312E300000000000020000000000000070000102000000000D31302E3136322E36332E3438000011690000001C5374616E64617264496D706C4E616D652F011147170A2C332E013928000000020000000000000008000000004A414300000000010000001C00000000000100010000000105010001000101090000000105010001000000010000002C0000000000000001000000010000001C00000000000100010000000105010001000101090000000105010001";
    //            outData.print(getHeader(page.length()));
    //            outData.print(page);
    //            outData.writeBytes(getHeader(page.length()));
    //            outData.writeBytes(page);
                //byte[] b = getHeader(page.length()).getBytes("ISO-8859-1");
                byte[] b = stringToBytes(getHeader(page.length()));
                outData.write(b);
                outData.flush();
                //byte[]
                //b = page.getBytes("ISO-8859-1");
                b = stringToBytes(page);
                outData.write(b);
                outData.flush();
                outData.close();
                inData.close();
                httpRequest.close();
              catch (Exception e)
                System.out.println("Unhandled http request:");
                e.printStackTrace();
            byte[] stringToBytes(String s)
              ByteArrayOutputStream os = new ByteArrayOutputStream();
              try
                DataOutputStream cob = new DataOutputStream(os);
                cob.writeBytes(s);
                cob.close();
              catch(Exception e)
                System.out.println("Caught unhandled exception:");
                e.printStackTrace();
              return os.toByteArray();
            String getHeader(int len)
              return
                 "HTTP/1.1 200 OK\r\n"+
                 "Date: "+ (new Date()).toString() + "\r\n"+
                 "Content-Type: text/plain\r\n"+
                 "Content-Length: "+ len +"\r\n"+
                 "Server: "+ qmVersion + "\r\n"+
                 "\r\n";
      }

  • SSO Partner Application and Session Time out

    Hi ,
    We have an application on forums.oracle.com which is implementing the Authentication scheme as SSO, that is working well, now we want to implement Session Time out if the user is idle for some time and ask him to login again after the session fails, I have tried to implement this feature as given by Scott in the thread session timeout , well the problem is since we dont have a login page here how do we set the cookies owa_cookie.send(
    name => 'HTMLDB_IDLE_SESSION',
    value => to_char(sysdate+(20/1440),'DD-MON-YYYY HH24:MI:SS'),
    expires => null,
    path => '/',
    domain => null
    and where is the current point to implement it.
    Any help on this is greatly welcome.
    Thanks in Advance.

    Naveen,
    I don't remember how the solution works. But if you don't have a login page you can usually put code in the post-authentication process of your authentication scheme to do whatever the login page process would have done.
    Scott

  • CRM WEB UI - Time out Pop-up

    Dear All,
    We have a business requirement to monitor and optimize the CRM WEB UI timeout and other related issues.
    I would like to have time-out pop-up for the call center agents  and hence they could better manage the sessions .
    This will avoid loosing the valuable customer data for the session and so on.
    We are now working on the following threads with CRM Technical folks.
    Please share your experience or the detailed steps if you had implemented already.
    SAP  note 1877120 - CRM-IC: session timeout issue with CRM 7 EHP1 and higher
    Also , have a look http://scn.sap.com/community/crm/webclient-ui-framework/blog/2012/05/17/session-time-out-warning-message-on-ui
    2092893 - Session Time Out Notification
    Regards
    Venkat

    Hello Venkat,
    For business roles of type IC Webclient, you have to implement SAP Note 1877120. Don't forget to update your view layout in your custom enhancement if you have enhanced CRMCMP_IC_FRAME/HiddenView.
    After implementation of 1887120, also implement 1977631 and 1955366.
    Best Regards,
    Sigrid

  • RCA Connection Pool idle Time-Out takes no effect !

    My question description goes here.
    According to JCA specification, I developed my 'ManagedConnectionImpl' class from the interface 'ManagedConnection'. I realize the 'destroy()' function to send out logout request to the EIS.
    Then I deployed the connector in Sun Java System Application Server, I noticed there are two parameters in Connection Pool part, they are:
    1. Idle Timeout. It said it's the maximum time that a connection can remain idle in the pool. I assume the connection will be removed after the specific time expired and before it's removed it will call the recallable function, 'destroy()', in my concrete class, 'ManagedConnectionImpl'.
    2. Pool Resize Quantity. it said it's number of connections to be removed when pool idle time expired.
    I am weird about it. I think EIS had itself session control strategy, if the specific session time-out expired, it will invalidate this session. So I think we will set 'Idle Timeout' in application server to be shorter than the EIS session time-out. If the 'Idle Timeout' in application server expired, it should remove all connections inside otherwise maybe the connection with invalid session will exist! (the background knowledge is our system will return back soap fault when it meets invalid session, so the invalid connections will not be removed by switching on your configuration item, 'On Any Failure')
    So I set "inital and minimum pool size" to 8, "maximum pool size" to 32 and "Pool Resize Quantity" to 32. (I expect AS to remove all when pool idle time expired)
    After deploying, I send out requests at the first round and wait for the time expired but I can't see the desired logout requests from pool automatically even one. Firstly I guess if my recallable function definition is wrong but when I shut down the Application Server, the desired logout requests are sent out from pool automatically. So I think my recallable function definition is workable.
    What's your comments on it?
    P.S.
    I am using Sun Java System Application Server 8.1.
    Thanks in advance!
    BRs
    /Leo

    I have had following test to ensure I sent out notification to listener.
    [#|2005-08-23T16:14:25.061+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    It's in managed env!|#]
    [#|2005-08-23T16:14:25.062+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    enter matchManagedConnections() !|#]
    [#|2005-08-23T16:14:25.062+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    try to find a matching and existing one, reuse it!|#]
    [#|2005-08-23T16:14:25.062+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    Found a matching and existing one, reuse it!|#]
    [#|2005-08-23T16:14:25.495+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    tearDown() is called, the application-level connection is released!|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    enter calling close() of managed connection.|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    Start calling close() of managed connection.|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    start to notify the listener the completeness of connection.|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    notify the listener the completeness of connection successfully.|#]
    Whether it's related with the initial and minimum number parameter? Although I found it will not be created during AS start-up and will be created at the first request.
    Whether it shall be kept to meet the minimum requirement? I have failed to set it to 0.

  • Getting time out error when running the assigned verification in DRM 9.3.2.

    Hi,
    I have installed DRM 9.3.2.0.0 in my system (windows 7), when i am trying to run assigned verifications i am getting the time out error within a minute.
    As suggested by oracle,I have added DWORD with value 480000 under Master Data Management in Registry editor. But still getting the error.
    Please suggest a solution for this issue.
    regards,
    sathiya

    Please suggest me the solution.
    regards,
    sathiya

  • Session time out when trying to redeem card!?

    hi, I have tried to redeem my card 5 times now, and itunes keeps saying "session time out your sessions has timed out please try this operation from beginning" I am dualbooting windows xp and windows 7, I have used both OS's and still the same thing. when I try to redeem it on my ipod touch it tells me I have the wrong code. I do not have a mac availble im on vecation and only brought the PC laptop.
    if it matters im using the itunes canadian store.

    This worked for me:
    Establish in her router a WEP 128 bit data encryption password. (Post back if you need help on this). Apparently macs have slightly different Airport drivers and work better with WEP 128 bit than with WPA although this doesn't explain why my friend's MB had your mum-in-law's problem but could connect to my WPA protected network - go figure! Anyway, try a different password encryption and see if that works.
    As for not sending mail, check with your Mail Server what the SMTP setting should be.
    Joe

  • Session time out app store

    I keep getting session time out whenever I try to purchase apps on iPhone 5. It keeps asking me to verify my credit card security number and then when I click DONE, it tells me session time out. Anyone can help?

    Having problem with internet connectivity on WIFI - anything that depends on DNS for data whether it is a web browser or an app while using WIFI.  I call this problem "WIFI Lockout".
    This happens on iphone 4, ipad 2 and ipad 3 that has been updated to iOS 6.
    I am not talking about the issue of the missing apple page (day 1) or the inability to turn on/configure WIFI after updating to iOS 6.
    This is what i have discovered so far.
    You could be in the middle of surfing or using any app that makes data calls based on DNS (when you type google.com that is translated in the background so your device knows where to go - summary only) and suddenly you can go no where or do nothing!
    Sometimes conectivity goes trouble free for long periods, other times it is repetitive "WIFI Lockout".
    Yea sure, you can restart the WIFI connection, but WHO wants to CONTINUALLY do that?
    Interestingly enought the device is still successfully connected to the internet via WIFI, but DNS request fail to pass successfully from the iOS 6 device.
    Apple (or any curious iOS 6 user that wants to see my point), when this happens "WIFI Lockout" open up a browser before you reset the WIFI  connection and type type 74.125.227.144 (google) and then “go” (I tried both safari and chrome).  A google search page will come up and you will be able to execute a search (of course any link you click on will not work as it is dependant on DNS resolution).
    The above IP connection to google proves NON DNS traffic works, so the issue is not the WIFI connection to the access point that is the problem.  It is not an access point configuration/firmware or security protocol issue either because data does pass when the above steps are followed.
    I KNOW THIS IS NOT ALL OF THE PROBLEMS WITH iOS 6, BUT THIS IS A HUGE PROBLEM NOT BEING ABLE TO SURF OR GET DATA THE iOS 6 DEVICE IS REQUESTING WHILE ON WIFI.

  • Session time out

    Hi,
    Is there any way to set ovm manager gui session time out.
    as of now, if there is no action in gui for 2 mins,
    session gets timed out.
    Importing a template takes lot of time and session is
    getting timed out just after 2 mins.
    I have another question. Even if session times out,
    does importing template continue?
    Thanks
    Ram

    887506 wrote:
    Is there any way to set ovm manager gui session time out.There is a way to increase the WebLogic timeout, but I'm not 100% sure on the process. Best thing to do is open an SR with Oracle Support so they can provide the exact steps.
    I have another question. Even if session times out,
    does importing template continue?Yes, this all happens on the Server/Manager side and doesn't require you to remain logged into the UI while the job runs.

  • Session time out in EP & webdynpro

    Hi can any body tell me how to control webdynpro session & portal session?
    I have created a webdynpro application & integrated in EP. I want to control the session time out for my application because if i run my application in Ep & the session time is out, i need to refresh my dynpro application.
    I want to control this session time out.
    Thanks,
    Siva

    Hi siva..
    Chk this link..
    Tabstrip: navigate with buttons instead of tabs
    Regards,
    GS

  • Session time out problem

    Hi guys
    I am using WSAD 5.0. the problem that i am having is that i have a properties file where i give the session time out value along with many other things. and when a user logs in a servlet takes those values from the properties file and sets the session time out value, using session.setMaxInactiveInterval(). but the problem is the session is still maintained even after the stipulated inactive time. Can any one tell me what could be the problem.
    Note: when i say session.getMaxInactiveInterval(), i get the value that i have set in the properties file.
    Thanks

    You're sure you specified seconds rather than milliseconds?
    - Saish

  • Session time out in BIP

    All,
    I have set the BIP security as Oracle BI SERVER and able to successfully log in from dashboards, answers to BIP. but after some time BIP is getting timed out.
    where can I set the session time out parameter? and
    how to make the BIP session valid as long as OBI presentation services session is valid?
    Thanks in advance.

    Post Author: amr_foci
    CA Forum: Authentication
    go to the universe which this report based on, get the parameters window from (File->Paramaters)
    check the CONTROL tab
    see those parameters and configure them as you want
    good luck
    Amr

  • Session Time Out For UNLOGGED IN USER During Search -pls help SIR!

    Hi,
    The problem lies in searchresultscontroller.java/searchcontroller.java file under search/web/handler of an application that supports educational note sharing.
    The problem is that -
    When I search with query strings in different fields(as you will find in the above mentioned java files)..the keywords in resourcedto and get some files as search results.
    Then I click on one of the file from within the search result and visit the file.
    Here if I m logged in as an user, and the session time out is set to 1 minute in the web.xml file of the web folder not the admin folder then when I hit the BACK TO SEARCH button it easily goes back to the previous search result page along with the queries string that I had input previously.
    The problem is that when I m NOT LOGGED in as an user, and I've performed a search with queries and other dropdowns in the search panel, I get the search result page, I visit the file by clicking on one of them but when I hit the BACK TO SEARCH button I don't see the previous search result page from where I had navigated to view the file.
    Please suggest on what changes shall I make in the code so that even if I m not logged in as an user, I get back to the search result page on hitting the BACK TO SEARCH button from the file view page.Sir I m herein pasting the code of the searchresultscontroller.java file, but please feel free to ask for anyother file whose code you might want to see.SEARCHRESULTSCONTROLLER.JAVA FILE CONTENT-
    package com.mgh.sps.search.web.handler;
    import java.util.Map;
    import java.util.regex.Pattern;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.log4j.Logger;
    import org.springframework.validation.BindException;
    import org.springframework.validation.Errors;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.SimpleFormController;
    import com.mgh.sps.search.business.facade.Search;
    import com.mgh.sps.common.dto.ResourceDTO;
    import com.mgh.sps.common.util.SessionAttributeKey;
    import com.mgh.sps.common.util.SessionManager;
    import com.mgh.sps.fileusage.web.constants.FileUsageWebConstants;
    public class SearchResultsController extends SimpleFormController {
    * SearchResults Controller
    * @author Muralikrishna.s
    * @Codedondate DD-MM-YY=26-07-07
    * @Usecase/s associated =UC504
    private static final Logger logger = Logger
    .getLogger(SearchResultsController.class.getName());
    private final static String REG_EXP = "^[A-Za-z0-9]*$";
    private final static Pattern EMAIL_PATTERN_REG = Pattern.compile(REG_EXP);
    * Spring framework method used to hold reference data
    * @param request
    * HttpServletRequest
    * @param command
    * Object
    * @param arg2
    * Errors
    * @return Map
    * @throws Exception
    @Override
    protected Map referenceData(HttpServletRequest request, Object command,
    Errors errors) throws Exception {
    logger.debug("SearchResultsController.referenceData() method entered:"
    + request + "," + command + "," + errors);
    SessionManager.setSessionAttribute(SessionAttributeKey.tabIndex,
    FileUsageWebConstants.TAB_SEARCH, request);
    Search search = (Search) super.getWebApplicationContext().getBean(
    "searchfacade");
    ResourceDTO resourceDto = (ResourceDTO) command;
    String[] allValues = new String[7];
    if (null != (String[]) SessionManager.getSessionAttribute(
    SessionAttributeKey.allValues, request)) {
    allValues = (String[]) SessionManager.getSessionAttribute(
    SessionAttributeKey.allValues, request);
    resourceDto.setKeywords(allValues[0]);
    resourceDto.setCountry(allValues[1]);
    resourceDto.setUniversityName(allValues[2]);
    resourceDto.setSubjectArea(allValues[3]);
    resourceDto.setQualification(allValues[4]);
    resourceDto.setYearLevel(allValues[5]);
    resourceDto.setSpecificType(allValues[6]);
    logger.debug("%%%%%%%%%%%%%%%%%qualification%%%%%%%%%%%%%%%"
    + resourceDto.getQualification());
    String flag = (String) request.getParameter("id");
    resourceDto.setFlag(flag);
    logger.debug("SearchResultsController.referenceData() method exited:");
    return search.retrieveReferenceData(resourceDto);
    * Spring framework method used to hold OnSubmit
    * @param request
    * HttpServletRequest
    * @param response
    * HttpServletResponse
    * @param command
    * Object
    * @param arg3
    * BindException
    * @return ModelAndView
    * @throws Exception
    @Override
    protected ModelAndView onSubmit(HttpServletRequest request,
    HttpServletResponse response, Object command, BindException errors)
    throws Exception {
    SessionManager.cleanup(request);
    logger.debug("SearchResultsController.onSubmit() method entered:"
    + request + "," + command + "," + response + "," + errors);
    Search search = (Search) super.getWebApplicationContext().getBean(
    "searchfacade");
    Map dynamic = (Map) getServletContext().getAttribute("config");
    ResourceDTO resourceDto = (ResourceDTO) command;
    SessionManager.removeSessionAttribute(SessionAttributeKey.allValues,
    request);
    //changed by sreelatha on sep21
    //resourceDto.setKeywords(request.getParameter("keywords"));
    //String key = request.getParameter("keywords");
    //logger.debug("&&&&&&&&&&&&& key &&&&&&&&&&&&" + key);
    String keywords = (request.getParameter("keywords"));
    if(null!=keywords) {
    keywords = keywords.trim();
    resourceDto.setKeywords(keywords);
    // changes end
    resourceDto.setUniversityName(request.getParameter("universityName"));
    resourceDto.setSubjectArea(request.getParameter("subjectArea"));
    resourceDto.setCountry(request.getParameter("country"));
    resourceDto.setQualification(request.getParameter("qualification"));
    resourceDto.setYearLevel(request.getParameter("yearLevel"));
    resourceDto.setSpecificType(request.getParameter("specificType"));
    String[] allValues = new String[7];
    //changed by sreelatha on sep21
    //allValues[0] = request.getParameter("keywords");
    allValues[0] = resourceDto.getKeywords();
    //changes end
    allValues[1] = request.getParameter("country");
    allValues[2] = request.getParameter("universityName");
    allValues[3] = request.getParameter("subjectArea");
    allValues[4] = request.getParameter("qualification");
    allValues[5] = request.getParameter("yearLevel");
    allValues[6] = request.getParameter("specificType");
    SessionManager.setSessionAttribute(SessionAttributeKey.allValues,
    allValues, request);
    if(null!=keywords) {
    keywords = keywords.trim();
    String words="";
    for(int i=0;i<keywords.length();i++) {
    String key=String.valueOf(keywords.charAt(i));
    if(key.contains("*")) {
    key = key.replace("*"," ");
    } else if(key.contains("?")) {
    key = key.replace("?"," ");
    } else if(key.contains("[")) {
    key = key.replace("["," ");
    } else if(key.contains("{")) {
    key = key.replace("{"," ");
    } else if(key.contains("(")) {
    key = key.replace("("," ");
    } else if(key.contains(")")) {
    key = key.replace(")"," ");
    } else if(key.contains("+")) {
    key = key.replace("+"," ");
    } else if(key.contains("
    key = key.replace("
    } else if(key.contains(" ")) {
    key = key.replace(" "," ");
    } else if(key.contains("_")) {
    key = key.replace("","");
    } else if(!EMAIL_PATTERN_REG.matcher(key).matches()) {
    key = key.replaceAll(key," ");
    words = words + key;
    keywords = words;
    resourceDto.setKeywords(keywords);
    SessionManager.setSessionAttribute(SessionAttributeKey.test, search.setInputValues(resourceDto, dynamic), request);
    String name = (String) SessionManager.getSessionAttribute(SessionAttributeKey.tempName, request);
    String flag1 = request.getParameter("id");
    String status="";
    if (flag1 !=null && flag1.equals("loggedInUser"))
    if(name==null)
    return new ModelAndView();
    if (flag1 !=null && flag1.equals("loggedInUser")){
    status = "redirect:SearchResults.htm?id=loggedInUser";
    }else if(flag1 !=null && flag1.equals("nonLoggedInUser"))
    status = "redirect:SearchResultsnlu.htm?id=nonLoggedInUser";
    super.setSuccessView(status);
    ModelAndView mav = new ModelAndView(super.getSuccessView());
    logger.debug("SearchResultsController.onSubmit() method exited:");
    return mav;
    }

    Cross-posted in many forums. Don't answer this one.

  • Session Time Out For UNLOGGED USER During Search -pls help

    Hi,
    The problem lies in searchresultscontroller.java/searchcontroller.java file under search/web/handler of an application that supports educational note sharing.
    The problem is that -
    When I search with query strings in different fields(as you will find in the above mentioned java files)..the keywords in resourcedto and get some files as search results.
    Then I click on one of the file from within the search result and visit the file.
    Here if I m logged in as an user, and the session time out is set to 1 minute in the web.xml file of the web folder not the admin folder then when I hit the BACK TO SEARCH button it easily goes back to the previous search result page along with the queries string that I had input previously.
    The problem is that when I m NOT LOGGED in as an user, and I've performed a search with queries and other dropdowns in the search panel, I get the search result page, I visit the file by clicking on one of them but when I hit the BACK TO SEARCH button I don't see the previous search result page from where I had navigated to view the file.
    Please suggest on what changes shall I make in the code so that even if I m not logged in as an user, I get back to the search result page on hitting the BACK TO SEARCH button from the file view page.Sir I m herein pasting the code of the searchresultscontroller.java file, but please feel free to ask for anyother file whose code you might want to see.
    SEARCHRESULTSCONTROLLER.JAVA FILE CONTENT-
    package com.mgh.sps.search.web.handler;
    import java.util.Map;
    import java.util.regex.Pattern;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.log4j.Logger;
    import org.springframework.validation.BindException;
    import org.springframework.validation.Errors;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.SimpleFormController;
    import com.mgh.sps.search.business.facade.Search;
    import com.mgh.sps.common.dto.ResourceDTO;
    import com.mgh.sps.common.util.SessionAttributeKey;
    import com.mgh.sps.common.util.SessionManager;
    import com.mgh.sps.fileusage.web.constants.FileUsageWebConstants;
    public class SearchResultsController extends SimpleFormController {
         * SearchResults Controller
         * @author Muralikrishna.s
         * @Codedondate DD-MM-YY=26-07-07
         * @Usecase/s associated =UC504
         private static final Logger logger = Logger
                   .getLogger(SearchResultsController.class.getName());
         private final static String REG_EXP = "^[A-Za-z0-9]*$";
         private final static Pattern EMAIL_PATTERN_REG = Pattern.compile(REG_EXP);
         * Spring framework method used to hold reference data
         * @param request
         * HttpServletRequest
         * @param command
         * Object
         * @param arg2
         * Errors
         * @return Map
         * @throws Exception
         @Override
         protected Map referenceData(HttpServletRequest request, Object command,
                   Errors errors) throws Exception {
              logger.debug("SearchResultsController.referenceData() method entered:"
                        + request + "," + command + "," + errors);
              SessionManager.setSessionAttribute(SessionAttributeKey.tabIndex,
                        FileUsageWebConstants.TAB_SEARCH, request);
              Search search = (Search) super.getWebApplicationContext().getBean(
                        "searchfacade");
              ResourceDTO resourceDto = (ResourceDTO) command;
              String[] allValues = new String[7];
              if (null != (String[]) SessionManager.getSessionAttribute(
                        SessionAttributeKey.allValues, request)) {
                   allValues = (String[]) SessionManager.getSessionAttribute(
                             SessionAttributeKey.allValues, request);
                   resourceDto.setKeywords(allValues[0]);
                   resourceDto.setCountry(allValues[1]);
                   resourceDto.setUniversityName(allValues[2]);
                   resourceDto.setSubjectArea(allValues[3]);
                   resourceDto.setQualification(allValues[4]);
                   resourceDto.setYearLevel(allValues[5]);
                   resourceDto.setSpecificType(allValues[6]);
              logger.debug("%%%%%%%%%%%%%%%%%qualification%%%%%%%%%%%%%%%"
                        + resourceDto.getQualification());
              String flag = (String) request.getParameter("id");
              resourceDto.setFlag(flag);
              logger.debug("SearchResultsController.referenceData() method exited:");
              return search.retrieveReferenceData(resourceDto);
         * Spring framework method used to hold OnSubmit
         * @param request
         * HttpServletRequest
         * @param response
         * HttpServletResponse
         * @param command
         * Object
         * @param arg3
         * BindException
         * @return ModelAndView
         * @throws Exception
         @Override
         protected ModelAndView onSubmit(HttpServletRequest request,
                   HttpServletResponse response, Object command, BindException errors)
                   throws Exception {
              SessionManager.cleanup(request);
              logger.debug("SearchResultsController.onSubmit() method entered:"
                        + request + "," + command + "," + response + "," + errors);
              Search search = (Search) super.getWebApplicationContext().getBean(
                        "searchfacade");
              Map dynamic = (Map) getServletContext().getAttribute("config");
              ResourceDTO resourceDto = (ResourceDTO) command;
              SessionManager.removeSessionAttribute(SessionAttributeKey.allValues,
                        request);
              //changed by sreelatha on sep21
              //resourceDto.setKeywords(request.getParameter("keywords"));
              //String key = request.getParameter("keywords");
              //logger.debug("&&&&&&&&&&&&& key &&&&&&&&&&&&" + key);
              String keywords = (request.getParameter("keywords"));
              if(null!=keywords) {
                   keywords = keywords.trim();
              resourceDto.setKeywords(keywords);
    //          changes end
              resourceDto.setUniversityName(request.getParameter("universityName"));
              resourceDto.setSubjectArea(request.getParameter("subjectArea"));
              resourceDto.setCountry(request.getParameter("country"));
              resourceDto.setQualification(request.getParameter("qualification"));
              resourceDto.setYearLevel(request.getParameter("yearLevel"));
              resourceDto.setSpecificType(request.getParameter("specificType"));
              String[] allValues = new String[7];
              //changed by sreelatha on sep21
              //allValues[0] = request.getParameter("keywords");
              allValues[0] = resourceDto.getKeywords();
              //changes end
              allValues[1] = request.getParameter("country");
              allValues[2] = request.getParameter("universityName");
              allValues[3] = request.getParameter("subjectArea");
              allValues[4] = request.getParameter("qualification");
              allValues[5] = request.getParameter("yearLevel");
              allValues[6] = request.getParameter("specificType");
              SessionManager.setSessionAttribute(SessionAttributeKey.allValues,
                        allValues, request);
                   if(null!=keywords) {
                   keywords = keywords.trim();
                   String words="";
                   for(int i=0;i<keywords.length();i++) {               
                        String key=String.valueOf(keywords.charAt(i));
                        if(key.contains("*")) {
                                  key = key.replace("*"," ");
                             } else if(key.contains("?")) {
                                  key = key.replace("?"," ");
                             } else if(key.contains("[")) {
                                  key = key.replace("["," ");
                             } else if(key.contains("{")) {
                                  key = key.replace("{"," ");
                             } else if(key.contains("(")) {
                                  key = key.replace("("," ");
                             } else if(key.contains(")")) {
                                  key = key.replace(")"," ");
                             } else if(key.contains("+")) {
                                  key = key.replace("+"," ");
                             } else if(key.contains("\\")) {
                                  key = key.replace("\\"," ");
                             } else if(key.contains(" ")) {
                                  key = key.replace(" "," ");
                             } else if(key.contains("_")) {
                                  key = key.replace("_","_");
                             } else if(!EMAIL_PATTERN_REG.matcher(key).matches()) {
                                  key = key.replaceAll(key," ");
                        words = words + key;
                   keywords = words;
                   resourceDto.setKeywords(keywords);
              SessionManager.setSessionAttribute(SessionAttributeKey.test, search.setInputValues(resourceDto, dynamic), request);
              String name = (String) SessionManager.getSessionAttribute(SessionAttributeKey.tempName, request);
              String flag1 = request.getParameter("id");
              String status="";
              if (flag1 !=null && flag1.equals("loggedInUser"))
              if(name==null)
                        return new ModelAndView();
              if (flag1 !=null && flag1.equals("loggedInUser")){
                   status = "redirect:SearchResults.htm?id=loggedInUser";
              }else if(flag1 !=null && flag1.equals("nonLoggedInUser"))
                   status = "redirect:SearchResultsnlu.htm?id=nonLoggedInUser";     
              super.setSuccessView(status);
              ModelAndView mav = new ModelAndView(super.getSuccessView());
              logger.debug("SearchResultsController.onSubmit() method exited:");
              return mav;
    }

    Cross-posted in many forums. Don't answer this one.

Maybe you are looking for

  • Report builder  crash on aix.

    I am trying to run report builder on AIX. Got below error.Can you please help me out. rwbuilder.sh Jan 23, 2013 9:42:57 AM oracle.security.jps.internal.common.util.XmlSchemaValidationUtil$StrictErrorHandler warning WARNING: Failed to validate the xml

  • PO Qty and Net Price Issue

    Hi All, My requirement is : Once PO is created on the basis PR,The Qty and Price is copied from PR,the requirement is that user cant change the QTY and Price in PO.If the user wants to change,they need to edit the Project and the change should happen

  • Can't Import TIFF -- File Error

    I am trying to import a TIFF image into my FCP project; something I've done a hundred times. This time, however, the file will not come in. "File Error". This image was made by someone else, but it opens in my ancient Photoshop CS2..so why won't it c

  • Mandatory parameter in Oracle BI Publisher 10g

    Can we define a parameter to be mandatory so that user needs to enter some value for it in Oracle BI Publisher 10g? If yes how do we do that? Edited by: 933296 on Aug 23, 2012 7:49 PM

  • Personalization in End Placement of contingent workers

    Hi, I am unable to get the PERSON_ID reference in the End Placement screen. The PER_PERIOD_PLACEMENT block doesn't have PERSON_ID in the field. What can be done if Personalization has to be written based on the Person_ID in this screen? Thanks qars