You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Kenneth Ramirez <ke...@yahoo.com> on 2004/09/15 07:49:07 UTC

Need help with Context level Init-Params

Hello All,

I never got an answer to the following question, so I'm trying again in the hopes that someone can help, or at least point me in
the right direction. 

I'm trying to access and list the Portlet Context
Init-Params, but am coming back with an empty names-enumeration. Keep in mind, that I am deploying
this portlet manually, as I have with about a dozen
others and they all work correctly. Is there some
special deployment that has to be done for Application
Context Init-Params to work?

The following example includes both the modifications
I made to my Portlet's web.xml in my project web-inf and the
actual code in my portlet's doView method:

// Init-Params within the web.xml
//
<servlet>
  <servlet-name>CtxInitParamListPortlet</servlet-name>
    <display-name>CtxInitParamListPortlet
Wrapper</display-name>
    <description>Automated generated Portlet
Wrapper</description>
 
<servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
        <init-param>
            <param-name>portlet-class</param-name>
           
<param-value>CtxInitParamListPortlet</param-value>
        </init-param>
        <init-param>
            <param-name>portlet-guid</param-name>
	   
<param-value>CtxInitParamListPortlet.CtxInitParamListPortlet</param-value>
        </init-param>
        <init-param>
            <param-name>foreground-color</param-name>
            <param-value>White</param-value>
        </init-param>
    </servlet>
 
// doView method within the Portlet
//
public void doView(RenderRequest request,
RenderResponse response)
            throws PortletException, IOException
    {
        response.setContentType("text/html");

        PrintWriter out = response.getWriter();
        StringBuffer text = new StringBuffer();
        
        PortletContext pc = getPortletContext();
        Enumeration enum = pc.getInitParameterNames();
        while (enum.hasMoreElements())
        {
            String name = (String) enum.nextElement();
            String value = pc.getInitParameter(name);
            if (value != null) {
                text.append(name).append(" =
").append(value);
                text.append("<br/>");
            }
        }
        out.println(text);
    }

Thanks,
 
Ken

		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

RE: Need help with Context level Init-Params

Posted by Kenneth Ramirez <ke...@yahoo.com>.
It worked like a charm. I didn't have to change one
line of code. I only added the <context-param>
directly  under the <web-app> tag and it ran
flawlessly. Thanks for the help once again.

Ken

--- "David H. DeWolf" <dd...@apache.org> wrote:

> Yes, I agree, that's exactly what the issue is.  I
> have added a test to the
> testsuite to test several peices of context
> init-parameter functionality.  
>  
> David
> 
> -----Original Message-----
> From: Kenneth Ramirez [mailto:ken_ramirez@yahoo.com]
> 
> Sent: Wednesday, September 15, 2004 10:03 AM
> To: pluto-user@portals.apache.org
> Subject: Re: Need help with Context level
> Init-Params
> 
> 
> So, I think what you are saying is that these
> parameters should have been
> placed in:
>  
> <web-app>
>   <context-param>
>     <param-name>foreground-color</param-name>
>     <param-value>White</param-value>
>    </context-param>
> </web-app>
>  
> Instead of the <servlet> tag. Now thinking about it,
> this actually does make
> sense (if I remember correctly), the init-params
> within the <servlet> tag
> are pulled out using
> ServletConfig.getInitParameter(). They are unique to
> the individual servlet. In the above example, you'd
> use
> ServletContext.getInitParameter() and thus, you'd
> also get to it using
> PortletContext.getInitParameter(). 
>  
> Am I right? Did you try putting the values in the
> <web-app><context-param>
> yet? If so, did it do the job. Otherwise, I will
> definitely try it and
> report back to let you all know if it worked or not.
>  
> Thanks a bunch,
>  
> Ken
> 
> Michael Blum <bl...@apache.org> wrote:
> 
> Kenneth,
> 
> when using the getInitParameterNames() from
> PortletContext you might 
> expect context parameter from the web application
> like
> 
> dummy-name
> dummy-value
> 
> 
> Michael
> 
> Otott Zsofia wrote:
> > Hello!
> > 
> > It works fine for me.... I think you should put
> the init parameters in the
> > portlet.xml not in the web.xml.
> > 
> > Zsofi
> > ----- Original Message ----- 
> > From: "David H. DeWolf" 
> > To: 
> > Sent: Wednesday, September 15, 2004 2:22 PM
> > Subject: RE: Need help with Context level
> Init-Params
> > 
> > 
> > Kenneth,
> > 
> > On quick review everything looks ok. I'll take
> some more time to look
> > through your example and test out pluto sometime
> in the next day or two --
> > unless someone beats me to it.
> > 
> > Actually, context init-params are something I
> don't think we have a test
> for
> > yet (in the testsuite). It's probably a good one
> to implement.
> > 
> > David
> > 
> > 
> > 
> > -----Original Message-----
> > From: Kenneth Ramirez
> [mailto:ken_ramirez@yahoo.com]
> > Sent: Wednesday, September 15, 2004 12:49 AM
> > To: Pluto-List
> > Subject: Need help with Context level Init-Params
> > 
> > 
> > Hello All,
> > 
> > I never got an answer to the following question,
> so I'm trying again in
> the
> > hopes that someone can help, or at least point me
> in
> > the right direction.
> > 
> > I'm trying to access and list the Portlet Context
> > Init-Params, but am coming back with an empty
> names-enumeration. Keep in
> > mind, that I am deploying
> > this portlet manually, as I have with about a
> dozen
> > others and they all work correctly. Is there some
> > special deployment that has to be done for
> Application
> > Context Init-Params to work?
> > 
> > The following example includes both the
> modifications
> > I made to my Portlet's web.xml in my project
> web-inf and the
> > actual code in my portlet's doView method:
> > 
> > // Init-Params within the web.xml
> > //
> > 
> > CtxInitParamListPortlet
> > CtxInitParamListPortlet
> > Wrapper
> > Automated generated Portlet
> > Wrapper
> > 
> > org.apache.pluto.core.PortletServlet
> > 
> > portlet-class
> > 
> > CtxInitParamListPortlet
> > 
> > 
> > portlet-guid
> > 
> > CtxInitParamListPortlet.CtxInitParamListPortlet
> > 
> > 
> > foreground-color
> > White
> > 
> > 
> > 
> > // doView method within the Portlet
> > //
> > public void doView(RenderRequest request,
> > RenderResponse response)
> > throws PortletException, IOException
> > {
> > response.setContentType("text/html");
> > 
> > PrintWriter out = response.getWriter();
> > StringBuffer text = new StringBuffer();
> > 
> > PortletContext pc = getPortletContext();
> > Enumeration enum = pc.getInitParameterNames();
> > while (enum.hasMoreElements())
> > {
> > String name = (String) enum.nextElement();
> > String value = pc.getInitParameter(name);
> > if (value != null) {
> > text.append(name).append(" =
> > ").append(value);
> > text.append("
> ");
> > }
> > }
> > out.println(text);
> > }
> > 
> > Thanks,
> > 
> > Ken
> > 
> > 
> > Do you Yahoo!?
> > vote.yahoo.com - Register online to vote today!
> > 
> > 
> > 
> > 
> 
> 
> 
> 
> 
> 
=== message truncated ===



		
__________________________________
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now. 
http://messenger.yahoo.com

RE: Need help with Context level Init-Params

Posted by "David H. DeWolf" <dd...@apache.org>.
Yes, I agree, that's exactly what the issue is.  I have added a test to the
testsuite to test several peices of context init-parameter functionality.  
 
David

-----Original Message-----
From: Kenneth Ramirez [mailto:ken_ramirez@yahoo.com] 
Sent: Wednesday, September 15, 2004 10:03 AM
To: pluto-user@portals.apache.org
Subject: Re: Need help with Context level Init-Params


So, I think what you are saying is that these parameters should have been
placed in:
 
<web-app>
  <context-param>
    <param-name>foreground-color</param-name>
    <param-value>White</param-value>
   </context-param>
</web-app>
 
Instead of the <servlet> tag. Now thinking about it, this actually does make
sense (if I remember correctly), the init-params within the <servlet> tag
are pulled out using ServletConfig.getInitParameter(). They are unique to
the individual servlet. In the above example, you'd use
ServletContext.getInitParameter() and thus, you'd also get to it using
PortletContext.getInitParameter(). 
 
Am I right? Did you try putting the values in the <web-app><context-param>
yet? If so, did it do the job. Otherwise, I will definitely try it and
report back to let you all know if it worked or not.
 
Thanks a bunch,
 
Ken

Michael Blum <bl...@apache.org> wrote:

Kenneth,

when using the getInitParameterNames() from PortletContext you might 
expect context parameter from the web application like

dummy-name
dummy-value


Michael

Otott Zsofia wrote:
> Hello!
> 
> It works fine for me.... I think you should put the init parameters in the
> portlet.xml not in the web.xml.
> 
> Zsofi
> ----- Original Message ----- 
> From: "David H. DeWolf" 
> To: 
> Sent: Wednesday, September 15, 2004 2:22 PM
> Subject: RE: Need help with Context level Init-Params
> 
> 
> Kenneth,
> 
> On quick review everything looks ok. I'll take some more time to look
> through your example and test out pluto sometime in the next day or two --
> unless someone beats me to it.
> 
> Actually, context init-params are something I don't think we have a test
for
> yet (in the testsuite). It's probably a good one to implement.
> 
> David
> 
> 
> 
> -----Original Message-----
> From: Kenneth Ramirez [mailto:ken_ramirez@yahoo.com]
> Sent: Wednesday, September 15, 2004 12:49 AM
> To: Pluto-List
> Subject: Need help with Context level Init-Params
> 
> 
> Hello All,
> 
> I never got an answer to the following question, so I'm trying again in
the
> hopes that someone can help, or at least point me in
> the right direction.
> 
> I'm trying to access and list the Portlet Context
> Init-Params, but am coming back with an empty names-enumeration. Keep in
> mind, that I am deploying
> this portlet manually, as I have with about a dozen
> others and they all work correctly. Is there some
> special deployment that has to be done for Application
> Context Init-Params to work?
> 
> The following example includes both the modifications
> I made to my Portlet's web.xml in my project web-inf and the
> actual code in my portlet's doView method:
> 
> // Init-Params within the web.xml
> //
> 
> CtxInitParamListPortlet
> CtxInitParamListPortlet
> Wrapper
> Automated generated Portlet
> Wrapper
> 
> org.apache.pluto.core.PortletServlet
> 
> portlet-class
> 
> CtxInitParamListPortlet
> 
> 
> portlet-guid
> 
> CtxInitParamListPortlet.CtxInitParamListPortlet
> 
> 
> foreground-color
> White
> 
> 
> 
> // doView method within the Portlet
> //
> public void doView(RenderRequest request,
> RenderResponse response)
> throws PortletException, IOException
> {
> response.setContentType("text/html");
> 
> PrintWriter out = response.getWriter();
> StringBuffer text = new StringBuffer();
> 
> PortletContext pc = getPortletContext();
> Enumeration enum = pc.getInitParameterNames();
> while (enum.hasMoreElements())
> {
> String name = (String) enum.nextElement();
> String value = pc.getInitParameter(name);
> if (value != null) {
> text.append(name).append(" =
> ").append(value);
> text.append("
");
> }
> }
> out.println(text);
> }
> 
> Thanks,
> 
> Ken
> 
> 
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today!
> 
> 
> 
> 





  _____  

Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download
<http://us.rd.yahoo.com/mail_us/taglines/msgr/evt=26089/*http://messenger.ya
hoo.com> now.


Re: Need help with Context level Init-Params

Posted by Kenneth Ramirez <ke...@yahoo.com>.
So, I think what you are saying is that these parameters should have been placed in:
 
<web-app>
  <context-param>
    <param-name>foreground-color</param-name>
    <param-value>White</param-value>
   </context-param>
</web-app>
 
Instead of the <servlet> tag. Now thinking about it, this actually does make sense (if I remember correctly), the init-params within the <servlet> tag are pulled out using ServletConfig.getInitParameter(). They are unique to the individual servlet. In the above example, you'd use ServletContext.getInitParameter() and thus, you'd also get to it using PortletContext.getInitParameter(). 
 
Am I right? Did you try putting the values in the <web-app><context-param> yet? If so, did it do the job. Otherwise, I will definitely try it and report back to let you all know if it worked or not.
 
Thanks a bunch,
 
Ken

Michael Blum <bl...@apache.org> wrote:
Kenneth,

when using the getInitParameterNames() from PortletContext you might 
expect context parameter from the web application like


dummy-name


dummy-value



Michael

Otott Zsofia wrote:
> Hello!
> 
> It works fine for me.... I think you should put the init parameters in the
> portlet.xml not in the web.xml.
> 
> Zsofi
> ----- Original Message ----- 
> From: "David H. DeWolf" 
   
> To: 

> Sent: Wednesday, September 15, 2004 2:22 PM
> Subject: RE: Need help with Context level Init-Params
> 
> 
> Kenneth,
> 
> On quick review everything looks ok. I'll take some more time to look
> through your example and test out pluto sometime in the next day or two --
> unless someone beats me to it.
> 
> Actually, context init-params are something I don't think we have a test for
> yet (in the testsuite). It's probably a good one to implement.
> 
> David
> 
> 
> 
> -----Original Message-----
> From: Kenneth Ramirez [mailto:ken_ramirez@yahoo.com]
> Sent: Wednesday, September 15, 2004 12:49 AM
> To: Pluto-List
> Subject: Need help with Context level Init-Params
> 
> 
> Hello All,
> 
> I never got an answer to the following question, so I'm trying again in the
> hopes that someone can help, or at least point me in
> the right direction.
> 
> I'm trying to access and list the Portlet Context
> Init-Params, but am coming back with an empty names-enumeration. Keep in
> mind, that I am deploying
> this portlet manually, as I have with about a dozen
> others and they all work correctly. Is there some
> special deployment that has to be done for Application
> Context Init-Params to work?
> 
> The following example includes both the modifications
> I made to my Portlet's web.xml in my project web-inf and the
> actual code in my portlet's doView method:
> 
> // Init-Params within the web.xml
> //
> 
> CtxInitParamListPortlet
> CtxInitParamListPortlet
> Wrapper
> Automated generated Portlet
> Wrapper
> 
> org.apache.pluto.core.PortletServlet
> 
> 
portlet-class

> 
> 
CtxInitParamListPortlet

> 
> 
> 
portlet-guid

> 
> 
CtxInitParamListPortlet.CtxInitParamListPortlet

> 
> 
> 
foreground-color

> 
White

> 
> 
> 
> // doView method within the Portlet
> //
> public void doView(RenderRequest request,
> RenderResponse response)
> throws PortletException, IOException
> {
> response.setContentType("text/html");
> 
> PrintWriter out = response.getWriter();
> StringBuffer text = new StringBuffer();
> 
> PortletContext pc = getPortletContext();
> Enumeration enum = pc.getInitParameterNames();
> while (enum.hasMoreElements())
> {
> String name = (String) enum.nextElement();
> String value = pc.getInitParameter(name);
> if (value != null) {
> text.append(name).append(" =
> ").append(value);
> text.append("
");
> }
> }
> out.println(text);
> }
> 
> Thanks,
> 
> Ken
> 
> 
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today!
> 
> 
> 
> 


		
---------------------------------
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.

Re: Need help with Context level Init-Params

Posted by Michael Blum <bl...@apache.org>.
Kenneth,

when using the getInitParameterNames() from PortletContext you might 
expect context parameter from the web application like
     <context-param>
         <param-name>dummy-name</param-name>
         <param-value>dummy-value</param-value>
     </context-param>

Michael

Otott Zsofia wrote:
> Hello!
> 
> It works fine for me.... I think you should put the init parameters in the
> portlet.xml not in the web.xml.
> 
> Zsofi
> ----- Original Message ----- 
> From: "David H. DeWolf" <dd...@apache.org>
> To: <pl...@portals.apache.org>
> Sent: Wednesday, September 15, 2004 2:22 PM
> Subject: RE: Need help with Context level Init-Params
> 
> 
> Kenneth,
> 
> On quick review everything looks ok.  I'll take some more time to look
> through your example and test out pluto sometime in the next day or two --
> unless someone beats me to it.
> 
> Actually, context init-params are something I don't think we have a test for
> yet (in the testsuite).  It's probably a good one to implement.
> 
> David
> 
> 
> 
> -----Original Message-----
> From: Kenneth Ramirez [mailto:ken_ramirez@yahoo.com]
> Sent: Wednesday, September 15, 2004 12:49 AM
> To: Pluto-List
> Subject: Need help with Context level Init-Params
> 
> 
> Hello All,
> 
> I never got an answer to the following question, so I'm trying again in the
> hopes that someone can help, or at least point me in
> the right direction.
> 
> I'm trying to access and list the Portlet Context
> Init-Params, but am coming back with an empty names-enumeration. Keep in
> mind, that I am deploying
> this portlet manually, as I have with about a dozen
> others and they all work correctly. Is there some
> special deployment that has to be done for Application
> Context Init-Params to work?
> 
> The following example includes both the modifications
> I made to my Portlet's web.xml in my project web-inf and the
> actual code in my portlet's doView method:
> 
> // Init-Params within the web.xml
> //
> <servlet>
>   <servlet-name>CtxInitParamListPortlet</servlet-name>
>     <display-name>CtxInitParamListPortlet
> Wrapper</display-name>
>     <description>Automated generated Portlet
> Wrapper</description>
> 
> <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
>         <init-param>
>             <param-name>portlet-class</param-name>
> 
> <param-value>CtxInitParamListPortlet</param-value>
>         </init-param>
>         <init-param>
>             <param-name>portlet-guid</param-name>
> 
> <param-value>CtxInitParamListPortlet.CtxInitParamListPortlet</param-value>
>         </init-param>
>         <init-param>
>             <param-name>foreground-color</param-name>
>             <param-value>White</param-value>
>         </init-param>
>     </servlet>
> 
> // doView method within the Portlet
> //
> public void doView(RenderRequest request,
> RenderResponse response)
>             throws PortletException, IOException
>     {
>         response.setContentType("text/html");
> 
>         PrintWriter out = response.getWriter();
>         StringBuffer text = new StringBuffer();
> 
>         PortletContext pc = getPortletContext();
>         Enumeration enum = pc.getInitParameterNames();
>         while (enum.hasMoreElements())
>         {
>             String name = (String) enum.nextElement();
>             String value = pc.getInitParameter(name);
>             if (value != null) {
>                 text.append(name).append(" =
> ").append(value);
>                 text.append("<br/>");
>             }
>         }
>         out.println(text);
>     }
> 
> Thanks,
> 
> Ken
> 
> 
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today!
> 
> 
> 
> 


Re: Need help with Context level Init-Params

Posted by Kenneth Ramirez <ke...@yahoo.com>.
If you put what's supposed to be Context-Wide Init-Params into the Portlet.xml file and you are able to pull them out using PortletContext.getInitParameter() method, then there is something seriously wrong. Context-Wide Init-Params are suppose to share the same context space as Servlets and JSPs belonging to the same application. This is the reason why they belong in the web.xml file (check out page 41 of the Portlet Specification for more details). Portlet-wide initialization parameters on the other hand belong in the portlet.xml file. They are pulled out using PortletConfig.getInitParameter() method. Portlet-wide initialization parameters work fine (as you can tell by the TestSuiite which makes use of them). However, Context-wide initialization parameters is what's giving me a hard time.
 
Thanks for the replies and I hope we can resolve this one. I tried a few more things and still can't get it to work. If anyone has any ideas to try, please let me know and I'll give them a shot.
 
Thanks,
Ken

Otott Zsofia <zs...@rndsoft.hu> wrote:
Hello!

It works fine for me.... I think you should put the init parameters in the
portlet.xml not in the web.xml.

Zsofi
----- Original Message ----- 
From: "David H. DeWolf" 
   
To: 

Sent: Wednesday, September 15, 2004 2:22 PM
Subject: RE: Need help with Context level Init-Params


Kenneth,

On quick review everything looks ok. I'll take some more time to look
through your example and test out pluto sometime in the next day or two --
unless someone beats me to it.

Actually, context init-params are something I don't think we have a test for
yet (in the testsuite). It's probably a good one to implement.

David



-----Original Message-----
From: Kenneth Ramirez [mailto:ken_ramirez@yahoo.com]
Sent: Wednesday, September 15, 2004 12:49 AM
To: Pluto-List
Subject: Need help with Context level Init-Params


Hello All,

I never got an answer to the following question, so I'm trying again in the
hopes that someone can help, or at least point me in
the right direction.

I'm trying to access and list the Portlet Context
Init-Params, but am coming back with an empty names-enumeration. Keep in
mind, that I am deploying
this portlet manually, as I have with about a dozen
others and they all work correctly. Is there some
special deployment that has to be done for Application
Context Init-Params to work?

The following example includes both the modifications
I made to my Portlet's web.xml in my project web-inf and the
actual code in my portlet's doView method:

// Init-Params within the web.xml
//

CtxInitParamListPortlet
CtxInitParamListPortlet
Wrapper
Automated generated Portlet
Wrapper

org.apache.pluto.core.PortletServlet


portlet-class



CtxInitParamListPortlet




portlet-guid



CtxInitParamListPortlet.CtxInitParamListPortlet




foreground-color


White




// doView method within the Portlet
//
public void doView(RenderRequest request,
RenderResponse response)
throws PortletException, IOException
{
response.setContentType("text/html");

PrintWriter out = response.getWriter();
StringBuffer text = new StringBuffer();

PortletContext pc = getPortletContext();
Enumeration enum = pc.getInitParameterNames();
while (enum.hasMoreElements())
{
String name = (String) enum.nextElement();
String value = pc.getInitParameter(name);
if (value != null) {
text.append(name).append(" =
").append(value);
text.append("
");
}
}
out.println(text);
}

Thanks,

Ken


Do you Yahoo!?
vote.yahoo.com - Register online to vote today!



		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

Re: Need help with Context level Init-Params

Posted by Otott Zsofia <zs...@rndsoft.hu>.
Hello!

It works fine for me.... I think you should put the init parameters in the
portlet.xml not in the web.xml.

Zsofi
----- Original Message ----- 
From: "David H. DeWolf" <dd...@apache.org>
To: <pl...@portals.apache.org>
Sent: Wednesday, September 15, 2004 2:22 PM
Subject: RE: Need help with Context level Init-Params


Kenneth,

On quick review everything looks ok.  I'll take some more time to look
through your example and test out pluto sometime in the next day or two --
unless someone beats me to it.

Actually, context init-params are something I don't think we have a test for
yet (in the testsuite).  It's probably a good one to implement.

David



-----Original Message-----
From: Kenneth Ramirez [mailto:ken_ramirez@yahoo.com]
Sent: Wednesday, September 15, 2004 12:49 AM
To: Pluto-List
Subject: Need help with Context level Init-Params


Hello All,

I never got an answer to the following question, so I'm trying again in the
hopes that someone can help, or at least point me in
the right direction.

I'm trying to access and list the Portlet Context
Init-Params, but am coming back with an empty names-enumeration. Keep in
mind, that I am deploying
this portlet manually, as I have with about a dozen
others and they all work correctly. Is there some
special deployment that has to be done for Application
Context Init-Params to work?

The following example includes both the modifications
I made to my Portlet's web.xml in my project web-inf and the
actual code in my portlet's doView method:

// Init-Params within the web.xml
//
<servlet>
  <servlet-name>CtxInitParamListPortlet</servlet-name>
    <display-name>CtxInitParamListPortlet
Wrapper</display-name>
    <description>Automated generated Portlet
Wrapper</description>

<servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
        <init-param>
            <param-name>portlet-class</param-name>

<param-value>CtxInitParamListPortlet</param-value>
        </init-param>
        <init-param>
            <param-name>portlet-guid</param-name>

<param-value>CtxInitParamListPortlet.CtxInitParamListPortlet</param-value>
        </init-param>
        <init-param>
            <param-name>foreground-color</param-name>
            <param-value>White</param-value>
        </init-param>
    </servlet>

// doView method within the Portlet
//
public void doView(RenderRequest request,
RenderResponse response)
            throws PortletException, IOException
    {
        response.setContentType("text/html");

        PrintWriter out = response.getWriter();
        StringBuffer text = new StringBuffer();

        PortletContext pc = getPortletContext();
        Enumeration enum = pc.getInitParameterNames();
        while (enum.hasMoreElements())
        {
            String name = (String) enum.nextElement();
            String value = pc.getInitParameter(name);
            if (value != null) {
                text.append(name).append(" =
").append(value);
                text.append("<br/>");
            }
        }
        out.println(text);
    }

Thanks,

Ken


Do you Yahoo!?
vote.yahoo.com - Register online to vote today!



RE: Need help with Context level Init-Params

Posted by Kenneth Ramirez <ke...@yahoo.com>.
Please feel free to borrow the iteration code I sent in for the Test Suite.
 
Thanks and let me know if you come up with something regarding the problem I'm running into.
 
Ken

"David H. DeWolf" <dd...@apache.org> wrote:
Kenneth,

On quick review everything looks ok. I'll take some more time to look
through your example and test out pluto sometime in the next day or two --
unless someone beats me to it.

Actually, context init-params are something I don't think we have a test for
yet (in the testsuite). It's probably a good one to implement.

David



-----Original Message-----
From: Kenneth Ramirez [mailto:ken_ramirez@yahoo.com] 
Sent: Wednesday, September 15, 2004 12:49 AM
To: Pluto-List
Subject: Need help with Context level Init-Params


Hello All,

I never got an answer to the following question, so I'm trying again in the
hopes that someone can help, or at least point me in
the right direction. 

I'm trying to access and list the Portlet Context
Init-Params, but am coming back with an empty names-enumeration. Keep in
mind, that I am deploying
this portlet manually, as I have with about a dozen
others and they all work correctly. Is there some
special deployment that has to be done for Application
Context Init-Params to work?

The following example includes both the modifications
I made to my Portlet's web.xml in my project web-inf and the
actual code in my portlet's doView method:

// Init-Params within the web.xml
//

CtxInitParamListPortlet
CtxInitParamListPortlet
Wrapper
Automated generated Portlet
Wrapper

org.apache.pluto.core.PortletServlet


portlet-class



CtxInitParamListPortlet




portlet-guid



CtxInitParamListPortlet.CtxInitParamListPortlet




foreground-color


White




// doView method within the Portlet
//
public void doView(RenderRequest request,
RenderResponse response)
throws PortletException, IOException
{
response.setContentType("text/html");

PrintWriter out = response.getWriter();
StringBuffer text = new StringBuffer();

PortletContext pc = getPortletContext();
Enumeration enum = pc.getInitParameterNames();
while (enum.hasMoreElements())
{
String name = (String) enum.nextElement();
String value = pc.getInitParameter(name);
if (value != null) {
text.append(name).append(" =
").append(value);
text.append("
");
}
}
out.println(text);
}

Thanks,

Ken


Do you Yahoo!?
vote.yahoo.com - Register online to vote today!


		
---------------------------------
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.

RE: Need help with Context level Init-Params

Posted by "David H. DeWolf" <dd...@apache.org>.
Kenneth,

On quick review everything looks ok.  I'll take some more time to look
through your example and test out pluto sometime in the next day or two --
unless someone beats me to it.

Actually, context init-params are something I don't think we have a test for
yet (in the testsuite).  It's probably a good one to implement.

David



-----Original Message-----
From: Kenneth Ramirez [mailto:ken_ramirez@yahoo.com] 
Sent: Wednesday, September 15, 2004 12:49 AM
To: Pluto-List
Subject: Need help with Context level Init-Params


Hello All,

I never got an answer to the following question, so I'm trying again in the
hopes that someone can help, or at least point me in
the right direction. 

I'm trying to access and list the Portlet Context
Init-Params, but am coming back with an empty names-enumeration. Keep in
mind, that I am deploying
this portlet manually, as I have with about a dozen
others and they all work correctly. Is there some
special deployment that has to be done for Application
Context Init-Params to work?

The following example includes both the modifications
I made to my Portlet's web.xml in my project web-inf and the
actual code in my portlet's doView method:

// Init-Params within the web.xml
//
<servlet>
  <servlet-name>CtxInitParamListPortlet</servlet-name>
    <display-name>CtxInitParamListPortlet
Wrapper</display-name>
    <description>Automated generated Portlet
Wrapper</description>

<servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
        <init-param>
            <param-name>portlet-class</param-name>
           
<param-value>CtxInitParamListPortlet</param-value>
        </init-param>
        <init-param>
            <param-name>portlet-guid</param-name>
   
<param-value>CtxInitParamListPortlet.CtxInitParamListPortlet</param-value>
        </init-param>
        <init-param>
            <param-name>foreground-color</param-name>
            <param-value>White</param-value>
        </init-param>
    </servlet>

// doView method within the Portlet
//
public void doView(RenderRequest request,
RenderResponse response)
            throws PortletException, IOException
    {
        response.setContentType("text/html");

        PrintWriter out = response.getWriter();
        StringBuffer text = new StringBuffer();
        
        PortletContext pc = getPortletContext();
        Enumeration enum = pc.getInitParameterNames();
        while (enum.hasMoreElements())
        {
            String name = (String) enum.nextElement();
            String value = pc.getInitParameter(name);
            if (value != null) {
                text.append(name).append(" =
").append(value);
                text.append("<br/>");
            }
        }
        out.println(text);
    }

Thanks,

Ken


Do you Yahoo!?
vote.yahoo.com - Register online to vote today!