KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > deliver > controllers > kernel > impl > simple > IntegrationDeliveryController


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.deliver.controllers.kernel.impl.simple;
25
26 import javax.servlet.http.HttpServletRequest JavaDoc;
27
28 import org.infoglue.cms.exception.SystemException;
29 import org.infoglue.deliver.applications.databeans.DeliveryContext;
30 import org.infoglue.deliver.util.HttpUtilities;
31
32
33 public class IntegrationDeliveryController
34 {
35     
36     /**
37      * Private constructor to enforce factory-use
38      */

39     
40     private IntegrationDeliveryController(Integer JavaDoc siteNodeId, Integer JavaDoc languageId, Integer JavaDoc contentId) throws SystemException, Exception JavaDoc
41     {
42     }
43     
44     
45     /**
46      * Factory method
47      */

48     
49     public static IntegrationDeliveryController getIntegrationDeliveryController(Integer JavaDoc siteNodeId, Integer JavaDoc languageId, Integer JavaDoc contentId) throws SystemException, Exception JavaDoc
50     {
51         return new IntegrationDeliveryController(siteNodeId, languageId, contentId);
52     }
53     
54     /**
55      * Factory method
56      */

57     
58     public static IntegrationDeliveryController getIntegrationDeliveryController(DeliveryContext deliveryContext) throws SystemException, Exception JavaDoc
59     {
60         return new IntegrationDeliveryController(deliveryContext.getSiteNodeId(), deliveryContext.getLanguageId(), deliveryContext.getContentId());
61     }
62     
63     /**
64      * This method gets an remote URL's content.
65      */

66     
67     public String JavaDoc getUrlContent(String JavaDoc url, HttpServletRequest JavaDoc request, boolean includeRequest) throws SystemException, Exception JavaDoc
68     {
69         String JavaDoc response = "";
70         
71         response = HttpUtilities.getUrlContent(url, request, includeRequest);
72         
73         return response;
74     }
75
76     /**
77      * This method gets an remote URL's content.
78      */

79     
80     public String JavaDoc getUrlContent(String JavaDoc url, HttpServletRequest JavaDoc request, boolean includeRequest, String JavaDoc encoding) throws SystemException, Exception JavaDoc
81     {
82         String JavaDoc response = "";
83         
84         response = HttpUtilities.getUrlContent(url, request, includeRequest, encoding);
85         
86         return response;
87     }
88
89
90     /**
91      * @param classname
92      * @param request
93      * @return
94      */

95     public Object JavaDoc getObjectWithName(String JavaDoc className, HttpServletRequest JavaDoc request) throws InstantiationException JavaDoc, IllegalAccessException JavaDoc, ClassNotFoundException JavaDoc
96     {
97         Class JavaDoc theClass = null;
98         
99         try
100         {
101             theClass = Thread.currentThread().getContextClassLoader().loadClass( className );
102         }
103         catch (ClassNotFoundException JavaDoc e)
104         {
105             theClass = getClass().getClassLoader().loadClass( className );
106         }
107         
108         return theClass.newInstance();
109     }
110
111
112 }
Popular Tags