You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by venky221 <ve...@splashnote.com> on 2007/12/19 21:26:47 UTC

How to flush the markup stream in getMarkupResourceStream() method

Hi,

I am trying to create the markup(generating html) using
IMarkupResourceStreamProvider at runtime.
The scenario is as follows.

I am using a java class called DisplayPage

public class DisplayPage extends WebPage implements
IMarkupResourceStreamProvider{
	
	String HTMLString="";
	
  	public DisplayPage () {
		String type= getRequest().getParameter("type");
		HTMLString = generateHTML(type);
	}

         public IResourceStream getMarkupResourceStream(MarkupContainer
container, java.lang.Class
                                                                                                       
containerClass){
		return new StringResourceStream(HTMLString);
	}

       public String generateHTML(String type){
            if(type.equalsIgnoreCase("image")){
	          createImage("image1");
	          add(new Image("image1"));
            }else if(type.equalsIgnoreCase("text")){
	          createLabel("text1");
	         add(new Label("text1"));
            }
	}
}

These methods creaImage() and creteLabel() will construct the html tags for
Image and label with wicket-ids image1 and text1 respectually.

The problem now here is, when I call this class from my browser using the
url
http://localhost:8080/myapp/displaypage?type=image
It displays the image that I am returning in my createImage() method.

If I again call by passing the text parameter using the url
http://localhost:8080/myapp/displaypage?type=text
it gives the error saying that the component with id 'image1' is not found.

If I restart my tomcat between the two requests, it works fine but I can not
flush the markup content that I was getting from getMarkupResourceStream()
method if I am making the two requests without restarting my server.
I tried to debug the content that getMarkupResourceStream() is returning,
but the method will be called only once when the first request is made. The
second time this method will not be called.

Is there any way I can solve this problem.

Thanks,
Venkat


-- 
View this message in context: http://www.nabble.com/How-to-flush-the-markup-stream-in-getMarkupResourceStream%28%29-method-tp14424660p14424660.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to flush the markup stream in getMarkupResourceStream() method

Posted by venky221 <ve...@splashnote.com>.
Thanks Igor,

I tired by returning null in getCacheKey() method and is working great.
Even 'Matthijs Wensveen' replied to my mail with the same explanation.

Thanks,
Venkat


igor.vaynberg wrote:
> 
> public class DisplayPage extends WebPage implements
> IMarkupResourceStreamProvider, **IMarkupCacheKeyProvider** {...}
> 
> -igor
> 
> 
> On Dec 19, 2007 11:34 PM, Gabor Szokoli <sz...@gmail.com> wrote:
>> Me Too!
>>
>> Well, not exactly, but similar issue:
>>
>> We read markup files from the file systems, and consider implementing
>> a JMX trigger for reloading them, but what should the triggered method
>> actually do?
>>
>> (In the mean time I realised the solution to my problem is probably
>> different from vekys, but I assume mine resembles "flush" more, so
>> dibs on his subject line! :-) )
>>
>>
>> Gabor Szokoli
>>
>> On Dec 19, 2007 9:26 PM, venky221 <ve...@splashnote.com> wrote:
>> >
>> > If I restart my tomcat between the two requests, it works fine but I
>> can not
>> > flush the markup content that I was getting from
>> getMarkupResourceStream()
>> > method if I am making the two requests without restarting my server.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-flush-the-markup-stream-in-getMarkupResourceStream%28%29-method-tp14424660p14460441.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to flush the markup stream in getMarkupResourceStream() method

Posted by Igor Vaynberg <ig...@gmail.com>.
public class DisplayPage extends WebPage implements
IMarkupResourceStreamProvider, **IMarkupCacheKeyProvider** {...}

-igor


On Dec 19, 2007 11:34 PM, Gabor Szokoli <sz...@gmail.com> wrote:
> Me Too!
>
> Well, not exactly, but similar issue:
>
> We read markup files from the file systems, and consider implementing
> a JMX trigger for reloading them, but what should the triggered method
> actually do?
>
> (In the mean time I realised the solution to my problem is probably
> different from vekys, but I assume mine resembles "flush" more, so
> dibs on his subject line! :-) )
>
>
> Gabor Szokoli
>
> On Dec 19, 2007 9:26 PM, venky221 <ve...@splashnote.com> wrote:
> >
> > If I restart my tomcat between the two requests, it works fine but I can not
> > flush the markup content that I was getting from getMarkupResourceStream()
> > method if I am making the two requests without restarting my server.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to flush the markup stream in getMarkupResourceStream() method

Posted by Gabor Szokoli <sz...@gmail.com>.
Me Too!

Well, not exactly, but similar issue:

We read markup files from the file systems, and consider implementing
a JMX trigger for reloading them, but what should the triggered method
actually do?

(In the mean time I realised the solution to my problem is probably
different from vekys, but I assume mine resembles "flush" more, so
dibs on his subject line! :-) )


Gabor Szokoli

On Dec 19, 2007 9:26 PM, venky221 <ve...@splashnote.com> wrote:
>
> If I restart my tomcat between the two requests, it works fine but I can not
> flush the markup content that I was getting from getMarkupResourceStream()
> method if I am making the two requests without restarting my server.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org