-
1. Re: How to define content type
julien1 Sep 8, 2003 8:50 AM (in response to wolfie)you have to use the getResource method and override it.
take a look at mp3player it is doing that actually.
julien -
2. Re: How to define content type
wolfie Sep 9, 2003 12:55 AM (in response to wolfie)Thanks - that made a lot of things clearer! :)
/Ulf -
3. Re: How to define content type
wolfie Sep 11, 2003 3:39 AM (in response to wolfie)Hi again! Now I have another problem that you might be able to solve (hopefully). I need to access some objects stored as session attributes from the getResource method. How do I accomplish that?
If it is not possible to access the session attributes, is there any other way to pass temporary objects to the getResource method?
/Ulf -
4. Re: How to define content type
julien1 Sep 11, 2003 9:33 AM (in response to wolfie)you are right, it is not possible now, we have to think about it. Maybe we could pass the HttpServletRequest to the getResource method.
do you have an idea ? I am a bit in refactoring stuff these days :-)
julien -
5. Re: How to define content type
wolfie Sep 12, 2003 1:12 AM (in response to wolfie)I think that passing the HttpServletRequest object is just fine! :)
/Ulf -
6. Re: How to define content type
julien1 Sep 12, 2003 6:54 AM (in response to wolfie)I my movement to refactorise stuff, I slightly changed the way resource are handled.
On component support there are two methods :
public void getResource(ResourceRequest req, ResourceResponse resp) {
String id = req.getPath();
Resource res = manager.get(id);
if (res == null)
{
res = getResource(id);
manager.add(id, res);
}
resp.setResource(res);
}
public Resource getResource(String path) { // like before }
you can overrride the getResource a-la-servlet and get all the info you want from the request. To give the resource to nukes, use the setResource on the response.
I added a resource manager on the components so when a component is stopped it stops all the streaming resources at the same time. For instance a client listening for an mp3 being streamed will se the connection close when the mp3 player module is removed from nukes.
julien