fixes:
[mir.git] / source / mircoders / servlet / ServletModuleContent.java
1 /*\r
2  * Copyright (C) 2001, 2002  The Mir-coders group\r
3  *\r
4  * This file is part of Mir.\r
5  *\r
6  * Mir is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 2 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Mir is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with Mir; if not, write to the Free Software\r
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
19  *\r
20  * In addition, as a special exception, The Mir-coders gives permission to link\r
21  * the code of this program with the com.oreilly.servlet library, any library\r
22  * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
23  * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
24  * the above that use the same license as the above), and distribute linked\r
25  * combinations including the two.  You must obey the GNU General Public\r
26  * License in all respects for all of the code used other than the above\r
27  * mentioned libraries.  If you modify this file, you may extend this exception\r
28  * to your version of the file, but you are not obligated to do so.  If you do\r
29  * not wish to do so, delete this exception statement from your version.\r
30  */\r
31 \r
32 package mircoders.servlet;\r
33 \r
34 import java.io.IOException;\r
35 import java.util.GregorianCalendar;\r
36 import java.util.Map;\r
37 import java.util.HashMap;\r
38 import java.util.Iterator;\r
39 import java.util.List;\r
40 import java.util.Map;\r
41 \r
42 import javax.servlet.http.HttpServletRequest;\r
43 import javax.servlet.http.HttpServletResponse;\r
44 import javax.servlet.http.HttpSession;\r
45 \r
46 import mir.entity.adapter.EntityAdapterModel;\r
47 import mir.entity.adapter.EntityIteratorAdapter;\r
48 import mir.log.LoggerWrapper;\r
49 import mir.misc.StringUtil;\r
50 import mir.module.ModuleException;\r
51 import mir.servlet.ServletModule;\r
52 import mir.servlet.ServletModuleException;\r
53 import mir.storage.StorageObjectFailure;\r
54 import mir.util.CachingRewindableIterator;\r
55 import mir.util.HTTPRequestParser;\r
56 import mir.util.JDBCStringRoutines;\r
57 import mir.util.SQLQueryBuilder;\r
58 import mir.util.URLBuilder;\r
59 import mircoders.entity.EntityContent;\r
60 import mircoders.entity.EntityUsers;\r
61 import mircoders.global.MirGlobal;\r
62 import mircoders.module.ModuleContent;\r
63 import mircoders.search.IndexUtil;\r
64 import mircoders.storage.DatabaseComment;\r
65 import mircoders.storage.DatabaseContent;\r
66 import mircoders.storage.DatabaseContentToTopics;\r
67 \r
68 import org.apache.lucene.index.IndexReader;\r
69 \r
70 import freemarker.template.SimpleHash;\r
71 \r
72 /*\r
73  *  ServletModuleContent -\r
74  *  deliver html for the article admin form.\r
75  *\r
76  * @version $Id: ServletModuleContent.java,v 1.38 2003/03/04 22:00:54 zapata Exp $\r
77  * @author rk, mir-coders\r
78  *\r
79  */\r
80 \r
81 public class ServletModuleContent extends ServletModule\r
82 {\r
83   private String editTemplate = configuration.getString("ServletModule.Content.ObjektTemplate");;\r
84   private String listTemplate = configuration.getString("ServletModule.Content.ListTemplate");\r
85 \r
86   private static ServletModuleContent instance = new ServletModuleContent();\r
87   public static ServletModule getInstance() { return instance; }\r
88 \r
89   private ServletModuleContent() {\r
90     super();\r
91     logger = new LoggerWrapper("ServletModule.Content");\r
92     try {\r
93 \r
94       templateListString = configuration.getString("ServletModule.Content.ListTemplate");\r
95       templateObjektString = configuration.getString("ServletModule.Content.ObjektTemplate");\r
96       templateConfirmString = configuration.getString("ServletModule.Content.ConfirmTemplate");\r
97 \r
98       mainModule = new ModuleContent(DatabaseContent.getInstance());\r
99     }\r
100     catch (StorageObjectFailure e) {\r
101       logger.error("servletmodulecontent konnte nicht initialisiert werden");\r
102     }\r
103   }\r
104 \r
105   public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException\r
106   {\r
107     HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
108 \r
109     String where = requestParser.getParameter("where");\r
110     String order = requestParser.getParameterWithDefault("order", "webdb_create desc");\r
111     int offset = requestParser.getIntegerWithDefault("offset", 0);\r
112     String selectArticleUrl = requestParser.getParameter("selectarticleurl");\r
113 \r
114     returnArticleList(aRequest, aResponse, where, order, offset, selectArticleUrl);\r
115   }\r
116 \r
117   public void search(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException {\r
118     try {\r
119       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
120       SQLQueryBuilder queryBuilder = new SQLQueryBuilder();\r
121       String searchField = requestParser.getParameterWithDefault("searchfield", "");\r
122       String searchValue = requestParser.getParameterWithDefault("searchvalue", "").trim();\r
123       String searchOrder = requestParser.getParameterWithDefault("searchorder", "");\r
124       String searchispublished = requestParser.getParameterWithDefault("searchispublished", "");\r
125       String searchArticleType = requestParser.getParameterWithDefault("searcharticletype", "");\r
126       String selectArticleUrl = requestParser.getParameter("selectarticleurl");\r
127 \r
128       if (searchValue.length()>0) {\r
129         if (searchField.equals("contents"))\r
130           queryBuilder.appendAndCondition(\r
131             "(lower(content_data) like " + "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%')"+\r
132             " or (lower(description) like " + "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%')");\r
133         else\r
134           queryBuilder.appendAndCondition(\r
135             "lower("+ searchField + ") like " +\r
136             "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%'");\r
137       }\r
138 \r
139       if (searchispublished.length()>0) {\r
140         if (searchispublished.equals("0"))\r
141           queryBuilder.appendAndCondition("is_published='f'");\r
142         else\r
143           queryBuilder.appendAndCondition("is_published='t'");\r
144       }\r
145 \r
146       if (searchArticleType.length()>0) {\r
147         queryBuilder.appendAndCondition("to_article_type="+Integer.parseInt(searchArticleType));\r
148       }\r
149 \r
150       if (searchOrder.length()>0) {\r
151         if (searchOrder.equals("datedesc"))\r
152           queryBuilder.appendAscendingOrder("webdb_create");\r
153         else if (searchOrder.equals("dateasc"))\r
154           queryBuilder.appendDescendingOrder("webdb_create");\r
155         else if (searchOrder.equals("title"))\r
156           queryBuilder.appendDescendingOrder("title");\r
157         else if (searchOrder.equals("creator"))\r
158           queryBuilder.appendDescendingOrder("creator");\r
159       }\r
160 \r
161       returnArticleList(aRequest, aResponse, queryBuilder.getWhereClause(), queryBuilder.getOrderByClause(), 0, selectArticleUrl);\r
162     }\r
163     catch (Throwable e) {\r
164       throw new ServletModuleException(e.toString());\r
165     }\r
166   }\r
167 \r
168   public void add(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException {\r
169     _showObject(null, req, res);\r
170   }\r
171 \r
172 \r
173   public void insert(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
174   {\r
175 //theLog.printDebugInfo(":: content :: trying to insert");\r
176     try {\r
177       EntityUsers   user = _getUser(req);\r
178       Map withValues = getIntersectingValues(req, DatabaseContent.getInstance());\r
179 \r
180       String now = StringUtil.date2webdbDate(new GregorianCalendar());\r
181       withValues.put("date", now);\r
182       withValues.put("publish_path", StringUtil.webdbDate2path(now));\r
183       withValues.put("to_publisher", user.getId());\r
184       withValues.put("is_produced", "0");\r
185       if (!withValues.containsKey("is_published"))\r
186         withValues.put("is_published","0");\r
187       if (!withValues.containsKey("is_html"))\r
188         withValues.put("is_html","0");\r
189 \r
190       String id = mainModule.add(withValues);\r
191       DatabaseContentToTopics.getInstance().setTopics(id,req.getParameterValues("to_topic"));\r
192 \r
193       _showObject(id, req, res);\r
194     }\r
195     catch (StorageObjectFailure e) {\r
196       throw new ServletModuleException(e.toString());\r
197     }\r
198     catch (ModuleException e) {\r
199       throw new ServletModuleException(e.toString());\r
200     }\r
201   }\r
202 \r
203   public void delete(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
204   {\r
205     EntityUsers   user = _getUser(req);\r
206 \r
207     String idParam = req.getParameter("id");\r
208     if (idParam == null) throw new ServletModuleException("Invalid call: id missing");\r
209 \r
210     String confirmParam = req.getParameter("confirm");\r
211     String cancelParam = req.getParameter("cancel");\r
212 \r
213     logger.info("where = " + req.getParameter("where"));\r
214 \r
215     if (confirmParam == null && cancelParam == null) {\r
216 \r
217       SimpleHash mergeData = new SimpleHash();\r
218       mergeData.put("module", "Content");\r
219       mergeData.put("infoString", "Content: " + idParam);\r
220       mergeData.put("id", idParam);\r
221       mergeData.put("where", req.getParameter("where"));\r
222       mergeData.put("order", req.getParameter("order"));\r
223       mergeData.put("offset", req.getParameter("offset"));\r
224       deliver(req, res, mergeData, templateConfirmString);\r
225     }\r
226     else {\r
227       if (confirmParam!= null && !confirmParam.equals("")) {\r
228         try {\r
229           mainModule.deleteById(idParam);\r
230 \r
231           /** @todo the following two should be implied in\r
232            *  DatabaseContent */\r
233 \r
234           //delete rows in the content_x_topic-table\r
235           DatabaseContentToTopics.getInstance().deleteByContentId(idParam);\r
236           //delete rows in the comment-table\r
237           DatabaseComment.getInstance().deleteByContentId(idParam);\r
238           //delete from lucene index, if any\r
239           String index = configuration.getString("IndexPath");\r
240           if (IndexReader.indexExists(index)){\r
241             IndexUtil.unindexID(idParam,index);\r
242           }\r
243 \r
244         }\r
245         catch (ModuleException e) {\r
246           throw new ServletModuleException(e.toString());\r
247         }\r
248         catch (StorageObjectFailure e) {\r
249           throw new ServletModuleException(e.toString());\r
250         }\r
251         catch (IOException e) {\r
252           throw new ServletModuleException(e.toString());\r
253         }\r
254         list(req,res);\r
255       }\r
256       else {\r
257         // Datensatz anzeigen\r
258         _showObject(idParam, req, res);\r
259       }\r
260     }\r
261   }\r
262 \r
263   public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
264   {\r
265     String idParam = req.getParameter("id");\r
266     if (idParam == null)\r
267       throw new ServletModuleException("Invalid call: id not supplied ");\r
268     _showObject(idParam, req, res);\r
269   }\r
270 \r
271 // methods for attaching media file\r
272   public void attach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
273   {\r
274     String  mediaIdParam = req.getParameter("mid");\r
275     String  idParam = req.getParameter("cid");\r
276     if (idParam == null||mediaIdParam==null) throw new ServletModuleException("smod content :: attach :: cid/mid missing");\r
277 \r
278     try {\r
279       EntityContent entContent = (EntityContent)mainModule.getById(idParam);\r
280       entContent.attach(mediaIdParam);\r
281     }\r
282     catch(ModuleException e) {\r
283       logger.error("smod content :: attach :: could not get entityContent");\r
284     }\r
285     catch(StorageObjectFailure e) {\r
286       logger.error("smod content :: attach :: could not get entityContent");\r
287     }\r
288 \r
289     _showObject(idParam, req, res);\r
290   }\r
291 \r
292   public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
293   {\r
294     String  cidParam = req.getParameter("cid");\r
295     String  midParam = req.getParameter("mid");\r
296     if (cidParam == null) throw new ServletModuleException("smod content :: dettach :: cid missing");\r
297     if (midParam == null) throw new ServletModuleException("smod content :: dettach :: mid missing");\r
298 \r
299     try {\r
300       EntityContent entContent = (EntityContent)mainModule.getById(cidParam);\r
301       entContent.dettach(cidParam,midParam);\r
302     }\r
303     catch(ModuleException e) {\r
304       logger.error("smod content :: dettach :: could not get entityContent");\r
305     }\r
306     catch(StorageObjectFailure e) {\r
307       logger.error("smod content :: dettach :: could not get entityContent");\r
308     }\r
309 \r
310     _showObject(cidParam, req, res);\r
311   }\r
312 \r
313   public void update(HttpServletRequest aRequest, HttpServletResponse aResponse)\r
314       throws ServletModuleException\r
315   {\r
316     try {\r
317       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
318 \r
319       String returnUrl = requestParser.getParameter("returnurl");\r
320 \r
321       String idParam = aRequest.getParameter("id");\r
322       if (idParam == null) throw new ServletModuleException("Wrong call: (id) is missing");\r
323 \r
324       Map withValues = getIntersectingValues(aRequest, DatabaseContent.getInstance());\r
325       String[] topic_id = aRequest.getParameterValues("to_topic");\r
326       String content_id = aRequest.getParameter("id");\r
327 \r
328       withValues.put("is_produced", "0");\r
329       if (!withValues.containsKey("is_published"))\r
330         withValues.put("is_published","0");\r
331       if (!withValues.containsKey("is_html"))\r
332         withValues.put("is_html","0");\r
333 \r
334       String id = mainModule.set(withValues);\r
335       DatabaseContentToTopics.getInstance().setTopics(aRequest.getParameter("id"),topic_id);\r
336 \r
337       String whereParam = aRequest.getParameter("where");\r
338       String orderParam = aRequest.getParameter("order");\r
339 \r
340       if (returnUrl!=null){\r
341         redirect(aResponse, returnUrl);\r
342       }\r
343       else\r
344         _showObject(idParam, aRequest, aResponse);\r
345     }\r
346     catch (Throwable e) {\r
347       throw new ServletModuleException(e.toString());\r
348     }\r
349   }\r
350 \r
351 /*\r
352   * HelperMethod shows the basic article editing form.\r
353   *\r
354   * if the "id" parameter is null, it means show an empty form to add a new\r
355   * article.\r
356 */\r
357   public void _showObject(String id, HttpServletRequest aRequest, HttpServletResponse aResponse)\r
358       throws ServletModuleException {\r
359 \r
360     try {\r
361       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
362       Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
363       EntityAdapterModel model = MirGlobal.localizer().dataModel().adapterModel();\r
364       Map article;\r
365       URLBuilder urlBuilder = new URLBuilder();\r
366 \r
367       urlBuilder.setValue("module", "Content");\r
368       urlBuilder.setValue("do", "edit");\r
369       urlBuilder.setValue("id", id);\r
370       urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));\r
371 \r
372       if (id!=null) {\r
373         responseData.put("new", Boolean.FALSE);\r
374         article = model.makeEntityAdapter("content", mainModule.getById(id));\r
375       }\r
376       else {\r
377         List fields = DatabaseContent.getInstance().getFields();\r
378         responseData.put("new", Boolean.TRUE);\r
379         article = new HashMap();\r
380         Iterator i = fields.iterator();\r
381         while (i.hasNext()) {\r
382           article.put(i.next(), null);\r
383         }\r
384 \r
385         article.put("to_topics", null);\r
386 \r
387         MirGlobal.localizer().adminInterface().initializeArticle(article);\r
388       }\r
389       responseData.put("article", article);\r
390 \r
391       responseData.put("returnurl", requestParser.getParameter("returnurl"));\r
392       responseData.put("thisurl", urlBuilder.getQuery());\r
393 \r
394       ServletHelper.generateResponse(aResponse.getWriter(), responseData, editTemplate);\r
395     }\r
396     catch (Exception e) {\r
397       throw new ServletModuleException(e.toString());\r
398     }\r
399   }\r
400 \r
401   public void returnArticleList(\r
402        HttpServletRequest aRequest,\r
403        HttpServletResponse aResponse,\r
404        String aWhereClause,\r
405        String anOrderByClause,\r
406        int anOffset,\r
407        String aSelectArticleUrl) throws ServletModuleException {\r
408 \r
409     HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
410     URLBuilder urlBuilder = new URLBuilder();\r
411     EntityAdapterModel model;\r
412     int nrArticlesPerPage = 20;\r
413     int count;\r
414 \r
415     try {\r
416       Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
417       model = MirGlobal.localizer().dataModel().adapterModel();\r
418 \r
419       Object articleList =\r
420           new CachingRewindableIterator(\r
421             new EntityIteratorAdapter( aWhereClause, anOrderByClause, nrArticlesPerPage,\r
422                MirGlobal.localizer().dataModel().adapterModel(), "content", nrArticlesPerPage, anOffset)\r
423       );\r
424 \r
425       responseData.put("nexturl", null);\r
426       responseData.put("prevurl", null);\r
427 \r
428       count=mainModule.getSize(aWhereClause);\r
429 \r
430       urlBuilder.setValue("module", "Content");\r
431       urlBuilder.setValue("do", "list");\r
432       urlBuilder.setValue("where", aWhereClause);\r
433       urlBuilder.setValue("order", anOrderByClause);\r
434 \r
435 \r
436       urlBuilder.setValue("searchfield", requestParser.getParameter("searchfield"));\r
437       urlBuilder.setValue("searchvalue", requestParser.getParameter("searchvalue"));\r
438       urlBuilder.setValue("searchispublished", requestParser.getParameter("searchispublished"));\r
439       urlBuilder.setValue("searchorder", requestParser.getParameter("searchorder"));\r
440       urlBuilder.setValue("searcharticletype", requestParser.getParameter("searcharticletype"));\r
441       urlBuilder.setValue("selectarticleurl", aSelectArticleUrl);\r
442 \r
443       responseData.put("searchfield", requestParser.getParameter("searchfield"));\r
444       responseData.put("searchvalue", requestParser.getParameter("searchvalue"));\r
445       responseData.put("searchispublished", requestParser.getParameter("searchispublished"));\r
446       responseData.put("searchorder", requestParser.getParameter("searchorder"));\r
447       responseData.put("searcharticletype", requestParser.getParameter("searcharticletype"));\r
448       responseData.put("selectarticleurl", aSelectArticleUrl);\r
449 \r
450       urlBuilder.setValue("offset", anOffset);\r
451       responseData.put("offset" , new Integer(anOffset).toString());\r
452       responseData.put("thisurl" , urlBuilder.getQuery());\r
453 \r
454       if (count>=anOffset+nrArticlesPerPage) {\r
455         urlBuilder.setValue("offset", (anOffset + nrArticlesPerPage));\r
456         responseData.put("nexturl" , urlBuilder.getQuery());\r
457       }\r
458 \r
459       if (anOffset>0) {\r
460         urlBuilder.setValue("offset", Math.max(anOffset - nrArticlesPerPage, 0));\r
461         responseData.put("prevurl" , urlBuilder.getQuery());\r
462       }\r
463 \r
464       responseData.put("articles", articleList);\r
465 \r
466       responseData.put("from" , Integer.toString(anOffset+1));\r
467       responseData.put("count", Integer.toString(count));\r
468       responseData.put("to", Integer.toString(Math.min(anOffset+nrArticlesPerPage, count)));\r
469       responseData.put("offset" , Integer.toString(anOffset));\r
470       responseData.put("order", anOrderByClause);\r
471       responseData.put("where" , aWhereClause);\r
472 \r
473       ServletHelper.generateResponse(aResponse.getWriter(), responseData, listTemplate);\r
474     }\r
475     catch (Throwable e) {\r
476       throw new ServletModuleException(e.toString());\r
477     }\r
478   }\r
479 \r
480   public void selectparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException\r
481   {\r
482     try {\r
483       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
484       URLBuilder urlBuilder = new URLBuilder();\r
485 \r
486       urlBuilder.setValue("module", "Content");\r
487       urlBuilder.setValue("do", "setparent");\r
488       urlBuilder.setValue("childid", requestParser.getParameter("id"));\r
489       urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));\r
490 \r
491       returnArticleList(aRequest, aResponse, "", "", 0, urlBuilder.getQuery());\r
492     }\r
493     catch (Throwable e) {\r
494       throw new ServletModuleException(e.getMessage());\r
495     }\r
496   }\r
497 \r
498   public void listchildren(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException\r
499   {\r
500     try {\r
501       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
502       String articleId = requestParser.getParameter("article_id");\r
503 \r
504       if (articleId == null)\r
505         throw new ServletModuleException("ServletModuleContent.listchildren: article_id not set!");\r
506 \r
507       returnArticleList(aRequest, aResponse, "to_content = " + articleId, "", 0, null);\r
508     }\r
509     catch (Throwable e) {\r
510       throw new ServletModuleException(e.getMessage());\r
511     }\r
512   }\r
513 \r
514   public void setparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException\r
515   {\r
516     HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
517     String articleId = aRequest.getParameter("childid");\r
518     String parentId  = aRequest.getParameter("id");\r
519     String returnUrl = aRequest.getParameter("returnurl");\r
520 \r
521     try {\r
522       EntityContent article = (EntityContent) mainModule.getById(articleId);\r
523       article.setValueForProperty("to_content", parentId);\r
524       article.setProduced(false);\r
525       article.update();\r
526     }\r
527     catch(Throwable e) {\r
528       logger.error("ServletModuleContent.setparent: " + e.getMessage());\r
529       throw new ServletModuleException("ServletModuleContent.setparent: " + e.getMessage());\r
530     }\r
531 \r
532     redirect(aResponse, returnUrl);\r
533   }\r
534 \r
535   public void clearparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException\r
536   {\r
537     HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
538     String articleId = requestParser.getParameter("id");\r
539     String returnUrl = requestParser.getParameter("returnurl");\r
540 \r
541     try {\r
542       EntityContent article = (EntityContent) mainModule.getById(articleId);\r
543       article.setValueForProperty("to_content", "");\r
544       article.setProduced(false);\r
545       article.update();\r
546     }\r
547     catch(Throwable e) {\r
548       e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
549       logger.error("ServletModuleContent.clearparent: " + e.getMessage());\r
550 \r
551       throw new ServletModuleException("ServletModuleContent.clearparent: " + e.getMessage());\r
552     }\r
553 \r
554     redirect(aResponse, returnUrl);\r
555   }\r
556 \r
557   private EntityUsers _getUser(HttpServletRequest req)\r
558   {\r
559     HttpSession session=req.getSession(false);\r
560 \r
561     return (EntityUsers)session.getAttribute("login.uid");\r
562   }\r
563 }\r