openamf/src/java/org/openamf/invoker PageableResultSetServiceInvoker.java,1.10,1.11
Sean Sullivan <[email protected]> Sat, 11 Sep 2004 16:39:57 +0000
| Newsgroups | gmane.comp.java.openamf.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/openamf/openamf/src/java/org/openamf/invoker In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13829/src/java/org/openamf/invoker Modified Files: PageableResultSetServiceInvoker.java Log Message: merged code that was submitted by Matthew David Langston [openamf-developer mailing list, Sept 6 2004] Index: PageableResultSetServiceInvoker.java =================================================================== RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/invoker/PageableResultSetServiceInvoker.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PageableResultSetServiceInvoker.java 9 Jul 2004 04:21:14 -0000 1.10 --- PageableResultSetServiceInvoker.java 11 Sep 2004 16:39:54 -0000 1.11 *************** *** 10,14 **** import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; ! import org.openamf.ServiceRequest; import org.openamf.recordset.ASRecordSet; --- 10,16 ---- import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; ! import java.util.Map; ! import org.apache.commons.logging.Log; ! import org.apache.commons.logging.LogFactory; import org.openamf.ServiceRequest; import org.openamf.recordset.ASRecordSet; *************** *** 16,23 **** --- 18,31 ---- /** * @author Jason Calabrese <[email protected]> + * @author Matthew David Langston + * @author Sean C. Sullivan + * * @version $Revision$, $Date$ + * */ public class PageableResultSetServiceInvoker extends ServiceInvoker { + private static final Log log = LogFactory.getLog(PageableResultSetServiceInvoker.class); + public PageableResultSetServiceInvoker( ServiceRequest request, *************** *** 43,52 **** int from = ((Number)getRequest().getParameters().get(1)).intValue() - 1; int count = ((Number)getRequest().getParameters().get(2)).intValue(); ! return recordSet.getRecords(from, count); } private void releaseRecordSet() { ! String rsId = (String)getRequest().getParameters().get(0); ! getHttpServletRequest().getSession().removeAttribute(rsId); } --- 51,107 ---- int from = ((Number)getRequest().getParameters().get(1)).intValue() - 1; int count = ((Number)getRequest().getParameters().get(2)).intValue(); ! ! // ! // 2004.09.06: Matthew D. Langston <[email protected]> ! // ! // I was getting a java.lang.IndexOutOfBoundsException ! // exception when trying to find the RecordSet ID in the ! // session during this call: ! // ! // String rsId = (String)getRequest().getParameters().get(0); ! // ! // The problem is that Macromedia doesn't send the RecordSet ID ! // when calling RecordSet.release() on the client, which meant ! // there was no request parameter, making the call to ! // getRequest().getParameters().get(0) throw the exception. ! // ! // The solution was to test whether all of the records have ! // been read, and then to remove the ASRecordSet from session ! // scope when they have. This needs to occur on the client's ! // last call to get the remaining records when we still have ! // access to the RecordSet ID. ! // ! // This means the client's call to RecordSet.release() is ! // useless, since the RecordSet ID isn't sent. We therefore ! // simply ignore the call. ! // ! // For more information, see the comment on lines 103-104 in ! // C:\Program Files\Macromedia\Flash MX 2004\en\First Run\Classes\mx\remoting\RecordSet.as: ! // ! // "if id is non-null, there are more records still on the server. ! // this therefore is a server-associated RecordSet" ! // ! Map records = recordSet.getRecords(from, count); ! int lastRecordIndex = from + count; ! if (lastRecordIndex == recordSet.getTotalCount()) ! { ! log.debug("sent record " + lastRecordIndex + " out of " + recordSet.getTotalCount()); ! log.debug("Releasing RecordSet " + rsId); ! getHttpServletRequest().getSession().removeAttribute(rsId); ! } ! if (lastRecordIndex > recordSet.getTotalCount()) ! { ! log.debug("session scope memory leak"); ! } ! return records; } private void releaseRecordSet() { ! java.util.List parameters = getRequest().getParameters(); ! if (parameters.size() > 0) ! { ! String rsId = (String) parameters.get(0); ! getHttpServletRequest().getSession().removeAttribute(rsId); ! } } ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php