lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeffrey Sanford (JIRA)" <j...@apache.org>
Subject [jira] Created: (LUCENE-1065) Session Time Out For UNLOGGED IN USER During Search -pls help!
Date Sat, 24 Nov 2007 04:19:43 GMT
Session Time Out For UNLOGGED IN USER During Search -pls help!
--------------------------------------------------------------

                 Key: LUCENE-1065
                 URL: https://issues.apache.org/jira/browse/LUCENE-1065
             Project: Lucene - Java
          Issue Type: Bug
          Components: Analysis, Build, Javadocs, Query/Scoring, QueryParser, Search
    Affects Versions: 2.1
         Environment: JDK1.5,JBoss4.0,Spring, Eclipse,mysql 5.0.4, tortoise cvs, clamwin0.91.1,
apache-ant 1.7
            Reporter: Jeffrey Sanford
            Priority: Critical


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.
I m herein pasting the code of the searchresultscontroller.java file, but please feel free
to ask for anyother related file whose code you might want to see.
You're sure to find all the required files in the search.zip folder attached herein.Letme
know if you need anyother files to resolve this issue asap.
In order to download the entire web folder which has all the related files - pls download
it from this url -http://files-upload.com/files/630754/beta-gg-web.zip
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;
}
} 



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message