You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Christophe Lombart <ch...@sword-technologies.com> on 2005/02/13 14:51:27 UTC
Sertlet & J2 services
Is it possible to access to a J2 service from a servlet ?
I'm building a Graffito Browser portlet which display documents,
folders, .... in the view mode and in the edit mode gives the
possibility to edit documents, change the security settings, upload
docs, ...
When I click on a binary document (like a PDF, Ms word doc, ...) in this
portlet, I want to use a servlet which send to the client browser the
document stream (like a classic HTTP GET).
All Graffito components are J2 services. So, This servlet has to access
to a Graffito J2 service. Is it possible ? What d you think about this
kind of design ?
Thanks,
Christophe
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
Re: Sertlet & J2 services
Posted by David Sean Taylor <da...@bluesunrise.com>.
Christophe Lombart wrote:
>
> Is it possible to access to a J2 service from a servlet ?
>
yes
PortletServices services = JetspeedPortletServices.getSingleton();
services.getService(serviceName);
> I'm building a Graffito Browser portlet which display documents,
> folders, .... in the view mode and in the edit mode gives the
> possibility to edit documents, change the security settings, upload
> docs, ...
> When I click on a binary document (like a PDF, Ms word doc, ...) in this
> portlet, I want to use a servlet which send to the client browser the
> document stream (like a classic HTTP GET).
> All Graffito components are J2 services. So, This servlet has to access
I actually have a servlet that does this in my graffito app, although
its not going thru Jetspeed services but Spring, it would be easy enough
to replace the getBean with a getService call:
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException
{
String uri = request.getParameter("uri");
ContentModelService cms =(ContentModelService)
SpringAccessor.getBean("cmsModelImpl");
Document doc = cms.getDocument(uri);
response.setContentType(doc.getContentType());
drain(doc.getContent().getContentStream(),
response.getOutputStream());
> to a Graffito J2 service. Is it possible ? What d you think about this
> kind of design ?
>
I think its fine, but we need to ensure that secure access is enforced.
The one thing I don't like is that by using a servlet we are not
enforcing portal security.
If the cms.getDocument call was integrated with portal security, perhaps
that would work.
--
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773-4646
[mobile] +01 707 529 9194
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org