thank you for your reply!
yes, I do implement doPost() method.
my coding:
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
ServletOutputStream out =
response.getOutputStream ();
// Set the output data's mime type
response.setContentType(CONTENT_TYPE);
// create an input stream from fileURL
String fileURL = "http://com.company.abc.xml";
//Content-disposition header - open in browser
response.setHeader("Content-disposition",
"inline" );
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
URL url = new URL ( fileURL );
try
{
URLConnection conn = url.openConnection();
// Use Buffered Stream for reading/writing.
bis = new
BufferedInputStream(conn.getInputStream());
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
// Simple read/write loop.
while(-1 != (bytesRead = bis.read(buff, 0,
buff.length)))
{
bos.write(buff, 0, bytesRead);
}
out.flush();
bos.flush();
}
catch(final MalformedURLException e)
{
cat.error ( "MalformedURLException." );
throw e;
}
catch(final IOException e) {
cat.error ( "IOException." );
throw e;
}
finally
{
if (bis != null)
bis.close();
if (bos != null)
bos.close();
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
doPost(request, response);
}
julia
--- Richard Yee <[EMAIL PROTECTED]> wrote:
> Julia,
> Did you implement the doPost method in the servlet?
> public void doPost ( HttpServletRequest request,
> HttpServletResponse response)
> throws ServletException, IOException
> {
> doGet(request, response);
> }
>
> Regards,
>
> Richard
>
>
>
> At 11:05 AM 12/31/2001 -0800, you wrote:
> >hi, there:
> >
> >I have a servlet which display xml file on the
> server,
> >it works fine in doGet(), but doesn't work in
> >doPost(),it is the same coding. can any body know
> why?
> >
> >thank you very much!
> >
> >
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Send your FREE holiday greetings online!
> >http://greetings.yahoo.com
> >
>
>___________________________________________________________________________
> >To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> >of the message "signoff SERVLET-INTEREST".
> >
> >Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> >Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> >LISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
>
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html