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
[EMAIL PROTECTED]
[office] +01 707 773-4646
[mobile] +01 707 529 9194

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to