File download using a servlet: Problems with the generated URL
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere Portal Server > File download using a servlet: Problems with the generated URL




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    File download using a servlet: Problems with the generated URL  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-29-06 12:21 AM

Hello, fellows.
I'm trying to implement a file download functionality in an IBM Struts Portl
et. I've read several posts on the subject and I decided to go to the servle
t option. However, I've not found any tested and reliable code that does tha
t and I've not even success
fully generate the URL to the servlet. It's been 3 days and no luck!

This is my progress so far:
I was able to add the servlet to my portlet project. Code fragment in the We
b.xml:

<web-app id="WebApp">
..
<servlet id="Servlet_2">
<servlet-name>FileDownloadServlet</servlet-name>
<display-name>FileDownloadServlet</display-name>
<servlet-class>com.gedas.omegaq.docmgr.servlet.FileDownloadServlet</servlet-
class>
</servlet>
..
<servlet-mapping>
<servlet-name>FileDownloadServlet</servlet-name>
<url-pattern>/FileDownloadServlet</url-pattern>
</servlet-mapping>

Note: The webapp is the same that contains the WpsStrutsPortlet.

And in my JSP I coded the following:

<html:link page='<%=response.encodeURL("FileDownloadServlet")%>'>A File</htm
l:link>

The generated URL stills contains portlet context and therefore it doesn't r
each the servlet:

http://localhost:9081/wps/myportal/!ut/p/_s.7_0_A/7_0_16IE/.cmd/ad/.ar/sa.sp
f_ActionListener/.c/6_0_16FA/.ce/7_0_16IG/.p/5_0_16C5/.d/2?PC_7_0_16IG_spf_s
trutsAction=%212f. OMQ_PSA_Definition%212fFileDownloadServl
et#7_0_16IG

I've read in a topic that the request and response objects should not be the
 portlet ones but I've not found any reference on how to do that.

Any help or reference will be enormously appreciated.
Best regards!






[ Post a follow-up to this message ]



    Re: File download using a servlet: Problems with the generated URL  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-30-06 12:27 PM

I am using render response to do this in my portlet. I think this should als
o
work in the JSP.

String url = response.encodeURL( request.getContextPath() +
"/Servlet");

Thanks,
Mohan






[ Post a follow-up to this message ]



    Re: File download using a servlet: Problems with the generated URL  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-01-06 12:22 AM

Hello, Mohan.
I decided to implement the servlet in a separate WAR project and to call it 
directly using the HTML anchor tag as following:

<a href="/FileDownload/FileDownloadServlet">Something</a>

That finally worked. Thanks anyway!
Cheerz,
Azbel.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:44 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register