We're going an awfully long way here to solve what could be cleanly done
with a simple:

<jsp:include page="relativeURL" flush="true" />

Don't you think? All the container has to do is default the MIME type for
unknown extensions to "text/html". Remember this is a JSP -- a scripting
language which was originally designed to simplify life for web designers
and other non-programmers. Having to open every included file manually with
java code defeats that purpose.

Thanks,
--jeff

----- Original Message -----
From: "August Detlefsen" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Monday, December 10, 2001 1:21 PM
Subject: RE: Unable to include *.sum files (Again)


> What text format are your .sum files using? Sounds like it may be UTF8.
> Try this:
>
>    /**
>     * Returns the String contents of a UTF8 file.
>     *
>     * This method throws any fileIO errors.
>     *
>     * @param sFileName   Full file path.
>     * @return String   The contents of the file as a String object.
>     * @throws Exception   Any fileIO errors
>     */
>     public static String getUTF8FileAsString(String sFileName) throws
> Exception {
>         RandomAccessFile inputFile = new
> RandomAccessFile(sFileName,"r");
>         String output = inputFile.readUTF();
>         inputFile.close();
>         return output;
>     }
>
>
> This method should work if your files are in ASCII:
>
>    /**
>     * Returns the String contents of an ASCII file.
>     *
>     * This method throws any fileIO errors.
>     *
>     * @param sFileName   Full file path.
>     * @return String   The contents of the file as a String object.
>     * @throws Exception   Any fileIO errors
>     */
>     public static String getFileAsString(String sFileName) throws
> Exception {
>         RandomAccessFile inputFile = new
> RandomAccessFile(sFileName,"r");
>         byte[] inputbytes = new byte[(int)inputFile.length()];
>         int numread = inputFile.read(inputbytes);
>         inputFile.close();
>         return new String(inputbytes);
>     }
>
>
>
> --- Micael Padraig Og mac Grene <[EMAIL PROTECTED]> wrote:
> > At 08:14 AM 12/10/01 +0200, you wrote:
> > >Hi all,
> > >
> > >Thanks for all the responses(including the debate) to this question!
> > It made
> > >some real interesting reading material after the SHORT weekend! To
> > get back
> > >to August's suggestion: we've tried it but our problem is that the
> > file
> > >content is generated by a VB program and
> > >contains some funny characters e.g. "CPI" rather than "CPI". When we
> > >translate these to a string it either comes out as ?CPI? or as
> > illustrated
> > >in the attached image(This is also how
> > >it displays in JBuilder).
> > >
> > >Regarding the debate I tend to agree with Jeff. If you want to
> > display the
> > >pure contents of a file you should be able to include the file using
> > ><jsp:include> without having to define a mime type. I mean what
> > happens if
> > >you want to include a "code" example, for example a code snippet
> > that
> > >illustrates how to code something in C,C++,Java etc. If you define
> > the mime
> > >type it will try to translate it, which is not what we want in this
> > case...
> > >You could define it as type text but now you need to maintain two
> > mime types
> > >for one extension? Just doesn't sound right to me. The other thing
> > that
> > >bothers me is the fact that it works for the <%@ include...%>
> > directive but
> > >not for the <jsp:include.../> surely they should perform similar
> > actions
> > >simply using a different syntax?
> > >
> > >Thanks again,
> > >Jonathan
> >
> > I still don't see, Jonathan, why you don't just use code in your
> > include
> > which catches the mime types and deals with them?  Why is the include
> >
> > important to you in the first instance?  I think the people in this
> > list
> > might be able to help you, if we knew what the facets of the problem
> > are.  This sounds like a problem that can be solved, but I am not
> > sure what
> > the situation is.
> >
> > Micael
> >
> >
> > --
> > To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> > For additional commands: <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: <mailto:[EMAIL PROTECTED]>
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Send your FREE holiday greetings online!
> http://greetings.yahoo.com
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to