Re: WML Generation from JSP broken!!!!

2000-12-18 Thread Tom Reilly


Works for me.  Every mime-type usually lays claim to a default suffix
or two and we should definitely pick one and say that there is an
implicit mapping for that prefix.  So if I name my pages jspx then I
don't have to worry about setting any mappings to get a JSP container
to interpret the page as a JSP page written in XML.  We should also do
this for regular old JSP itself.

So here's my proposal:

JSP 1.2 engines have mime type mappings like so (or something like
this):

 *.jsp - application/jsp 
 *.jspx - application/jsp-xml

And documents of type application/jsp and application/jspx (or
whatever names we decide on) are handled appropriately by default
without any special web.xml constructs.

This will also enable one to author a mime-type based servlet filter
that can operate on JSP pages in a standard way.

Miles Sabin [EMAIL PROTECTED] writes:

 Tom Reilly wrote,
  It seems to me there are a couple solutions:
 
  1) look for jsp:root
  2) use DOCTYPE
  3) based it on file extension
 
  I don't like 1 because it adds overhead to the translation 
  process, and you have to deal with cases like: %-- jsp:root 
  --%
 
  I don't like 2 because if your JSP page is generating XML and 
  you want to output a DOCTYPE then you have a collision.
 
  So that leaves 3 which I like the best.  A good standard default 
  would be "jspx".  Of course most app servers allow this to be 
  customized.  I also like this because then different filters can 
  be assigned to JSP pages written in XML and plain old JSP pages.
 
 Yes and no. I agree that it'd be a mistake to handle this by
 inspecting the contents of the document, but I don't think file
 extensions are quite the right way to go.
 
 We should do it based on MIME type, and allow servers to use their
 existing file extension to MIME type mapping mechanisms to do the
 rest.
 
 What is the mime type for an XML-syntax JSP doc?
 application/jsp+xml or text/jsp+xml would seem to be the most
 likely candidates ... presumably they'd need to be registered.
 
 Cheers,
 
 
 Miles
 
 -- 
 Miles Sabin   InterX
 Internet Systems Architect5/6 Glenthorne Mews
 +44 (0)20 8817 4030   London, W6 0LJ, England
 [EMAIL PROTECTED] http://www.interx.com/


-- 
Tom Reilly
Allaire Corp.
http://www.allaire.com



RE: WML Generation from JSP broken!!!!

2000-12-18 Thread Miles Sabin

Tom Reilly wrote,
 So here's my proposal:

 JSP 1.2 engines have mime type mappings like so (or something
 like this):

 *.jsp - application/jsp 
 *.jspx - application/jsp-xml

 And documents of type application/jsp and application/jspx (or
 whatever names we decide on) are handled appropriately by 
 default without any special web.xml constructs.

 This will also enable one to author a mime-type based servlet 
 filter that can operate on JSP pages in a standard way.

That sounds good to me ...

One qualification: the current proposal on the table for XML
MIME types is to use a '+xml' suffix (there are various complicated reasons
why '+' is preferable to '-'). See,

  http://www.imc.org/draft-murata-xml

So the XML JSP type ought to be, 'application/jsp+xml'.

Cheers,


Miles

-- 
Miles Sabin   InterX
Internet Systems Architect5/6 Glenthorne Mews
+44 (0)20 8817 4030   London, W6 0LJ, England
[EMAIL PROTECTED] http://www.interx.com/



RE: WML Generation from JSP broken!!!!

2000-12-14 Thread Miles Sabin

Tom Reilly wrote,
 It seems to me there are a couple solutions:

 1) look for jsp:root
 2) use DOCTYPE
 3) based it on file extension

 I don't like 1 because it adds overhead to the translation 
 process, and you have to deal with cases like: %-- jsp:root 
 --%

 I don't like 2 because if your JSP page is generating XML and 
 you want to output a DOCTYPE then you have a collision.

 So that leaves 3 which I like the best.  A good standard default 
 would be "jspx".  Of course most app servers allow this to be 
 customized.  I also like this because then different filters can 
 be assigned to JSP pages written in XML and plain old JSP pages.

Yes and no. I agree that it'd be a mistake to handle this by
inspecting the contents of the document, but I don't think file
extensions are quite the right way to go.

We should do it based on MIME type, and allow servers to use their
existing file extension to MIME type mapping mechanisms to do the
rest.

What is the mime type for an XML-syntax JSP doc?
application/jsp+xml or text/jsp+xml would seem to be the most
likely candidates ... presumably they'd need to be registered.

Cheers,


Miles

-- 
Miles Sabin   InterX
Internet Systems Architect5/6 Glenthorne Mews
+44 (0)20 8817 4030   London, W6 0LJ, England
[EMAIL PROTECTED] http://www.interx.com/



RE: WML Generation from JSP broken!!!!

2000-12-14 Thread Miles Sabin

Nathan Abramson wrote,
 I don't think it should be done through a server's MIME type 
 mapping - that means that someone writing a web app needs to 
 know about the mappings installed on the target server, which 
 makes the web app less portable.

Hmm ... not convinced.

I'd have thought that configuring MIME types essential for the
operation of a JSP engine would be an basic part of the
installation of said engine. If that can't be done there's a
problem with the install mechanism, or the host server (or its 
administrator).

 Another approach is to declare each document's type in the 
 web.xml, or to declare categorization rules in web.xml (e.g., 
 XMLJSP == *.[jspx|jsx]), but that seems much clumsier to me.

Well, this is as near as makes no difference to specifying a MIME 
mapping in web.xml.

 Is there anything wrong with going by extension?  I'll bet 
 that's what a lot of tools are starting to do anyway, so we 
 might as well standardize it...

File extensions aren't more portable than MIME types, quite the 
reverse ... ie. some platforms don't use them at all (albeit a 
very small minority of those platforms which which are Servlet/JSP 
capable). And even where they are used there are issues with case-
sensitivity (ie. .JSP in the file system might be equivalent to 
.jsp on one platform but not on another).

Cheers,


Miles

-- 
Miles Sabin   InterX
Internet Systems Architect5/6 Glenthorne Mews
+44 (0)20 8817 4030   London, W6 0LJ, England
[EMAIL PROTECTED] http://www.interx.com/



Re: WML Generation from JSP broken!!!!

2000-12-13 Thread Tom Reilly


It seems to me there are a couple solutions:

1) look for jsp:root
2) use DOCTYPE
3) based it on file extension

I don't like 1 because it adds overhead to the translation process,
and you have to deal with cases like: %-- jsp:root --%

I don't like 2 because if your JSP page is generating XML and you want
to output a DOCTYPE then you have a collision.

So that leaves 3 which I like the best.  A good standard default would
be "jspx".  Of course most app servers allow this to be customized.  I
also like this because then different filters can be assigned to JSP
pages written in XML and plain old JSP pages.

Hans Bergsten [EMAIL PROTECTED] writes:

 Danno Ferrin wrote:
  
  I am sorry to start this thread here, but I believe that jasper-4.0's
  behavior is in error.  The behavior I think the spec calls for in
  determining if a page is a JSP Document (xml jsp) or an XMl document
  with JSP markup is the presence or absence of a jsp:root element.
  [...]
 
 I agree. JSP 1.1 says that everything that's not a JSP element is
 treated as template text, and that any type of markup (text) language
 can be used as template text. This means that a pure XML document,
 with an ?xml version="1.0? element at the top, is a valid JSP
 page using the JSP 1.1 syntax.
 
 The best (only?) way to identify a page that uses the JSP 1.2 XML syntax
 is what you suggest: look for a jsp:root element. This should be
 clarified in the JSP 1.2 spec.
 
 Hans
 -- 
 Hans Bergsten [EMAIL PROTECTED]
 Gefion Software   http://www.gefionsoftware.com


-- 
Tom Reilly
Allaire Corp.
http://www.allaire.com



Re: WML Generation from JSP broken!!!!

2000-11-30 Thread Danno Ferrin

I am sorry to start this thread here, but I believe that jasper-4.0's 
behavior is in error.  The behavior I think the spec calls for in 
determining if a page is a JSP Document (xml jsp) or an XMl document 
with JSP markup is the presence or absence of a jsp:root element.

This is further supported by the content of one of the spec examples  
(pg. 36 from the JSP 1.2 PD1 draft), specifically it encourages the use 
of the ?xml version="1.0? header in a document with jsp pages and not 
jsp documents

p125 sec. 7.2.1 also would imply that it is the presence of the jsp:root 
element at the root of the document that makes an xml document into a 
jsp document.

I am also forwarding this to the jsr-053 expert group, that's where the 
clarification should come.  I am ok with it being either way, but I 
think the current spec is a little vague and leans towards the 
presence/absence of a jsp:root element (and then for the jsp:root QName 
only with no concern as to the namespace url.).

--Danno

Craig R. McClanahan wrote:

 
 Davanum Srinivas wrote:
 
 Hi all,
 Attached is a JSP Sample file which generates WML. It works with no problems on 
Tomcat3.1, but
 fails miserably with the latest dev nightly snapshot and m4. Can someone shed light?
 
 
 Well, your page certainly doesn't work under Tomcat 4.0 (which implements JSP 1.2).  
Furthermore, it
 *should* not.
 
 Because you are starting this page with an ?xml version="1.0"? directive, the JSP 
compiler assumes that
 you have created this page in the XML syntax for JSP pages, as described in the 1.2 
spec
 http://java.sun.com/products/jsp/download.html.  However, this page violates 
several of the rules:
 * It does not start with a jsp:root element (this is
   what the parse error is complaining about).
 * It uses % % for a scriptlet, instead of the
   required jsp:scriptlet element.
 
 You will need to rewrite your page conforming to the new syntax rules in order for 
it to work correctly
 under 4.0.
 
 Thanks in advance,
 dims
 
 PS: Am not currently subscribed to the list. So please CC me at "[EMAIL PROTECTED]"
 
 
 Craig McClanahan
 
 PS:  Why did it work under 3.1?  Because 3.1 didn't support the XML syntax, so it 
just passed the ?xml?
 directive through as template text.
 
 
 
 
 
 




Re: WML Generation from JSP broken!!!!

2000-11-30 Thread Hans Bergsten

Danno Ferrin wrote:
 
 I am sorry to start this thread here, but I believe that jasper-4.0's
 behavior is in error.  The behavior I think the spec calls for in
 determining if a page is a JSP Document (xml jsp) or an XMl document
 with JSP markup is the presence or absence of a jsp:root element.
 [...]

I agree. JSP 1.1 says that everything that's not a JSP element is
treated as template text, and that any type of markup (text) language
can be used as template text. This means that a pure XML document,
with an ?xml version="1.0? element at the top, is a valid JSP
page using the JSP 1.1 syntax.

The best (only?) way to identify a page that uses the JSP 1.2 XML syntax
is what you suggest: look for a jsp:root element. This should be
clarified in the JSP 1.2 spec.

Hans
-- 
Hans Bergsten   [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com



Re: WML Generation from JSP broken!!!!

2000-11-29 Thread Davanum Srinivas

Thanks Craig. I was mixing two things.I got it to work by removing the ?xml 
version="1.0"?
directive for now.

-- dims

--- "Craig R. McClanahan" [EMAIL PROTECTED] wrote:
 
 
 Davanum Srinivas wrote:
 
  Hi all,
  Attached is a JSP Sample file which generates WML. It works with no problems on 
Tomcat3.1, but
  fails miserably with the latest dev nightly snapshot and m4. Can someone shed 
light?
 
 
 Well, your page certainly doesn't work under Tomcat 4.0 (which implements JSP 1.2). 
 Furthermore, it
 *should* not.
 
 Because you are starting this page with an ?xml version="1.0"? directive, the JSP 
compiler
 assumes that
 you have created this page in the XML syntax for JSP pages, as described in the 1.2 
spec
 http://java.sun.com/products/jsp/download.html.  However, this page violates 
several of the
 rules:
 * It does not start with a jsp:root element (this is
   what the parse error is complaining about).
 * It uses % % for a scriptlet, instead of the
   required jsp:scriptlet element.
 
 You will need to rewrite your page conforming to the new syntax rules in order for 
it to work
 correctly
 under 4.0.
 
 
  Thanks in advance,
  dims
 
  PS: Am not currently subscribed to the list. So please CC me at "[EMAIL PROTECTED]"
 
 
 Craig McClanahan
 
 PS:  Why did it work under 3.1?  Because 3.1 didn't support the XML syntax, so it 
just passed
 the ?xml?
 directive through as template text.
 
 
 


=
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



WML Generation from JSP broken!!!!

2000-11-29 Thread Davanum Srinivas

Hi all,
Attached is a JSP Sample file which generates WML. It works with no problems on 
Tomcat3.1, but
fails miserably with the latest dev nightly snapshot and m4. Can someone shed light? 

Thanks in advance,
dims

PS: Am not currently subscribed to the list. So please CC me at "[EMAIL PROTECTED]"

= Begin Stack Trace =
org.apache.jasper.compiler.ParseException:
D:\jakarta-tomcat-4.0\bin\..\webapps\examples\jsp\datewml.jsp(4,-1) Document root 
element is
missing.
at org.apache.jasper.compiler.ParserXJspSax.parse(ParserXJspSax.java:194)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:213)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:166)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:193)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:464)
at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:435)
at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:156)
at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:168)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:393)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:251)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:177)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:443)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2014)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:159)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:807)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:886)
at java.lang.Thread.run(Thread.java:484)
= End Stack Trace =


=
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

?xml version="1.0"?
!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"

%
response.setContentType("text/vnd.wap.wml");
out.println("wml");
out.println("card title=\"MobileDate\"");
out.println(" p align=\"center\"");
out.println("Date and Time Servicebr/");
out.println("Date is: "+ new java.util.Date());
out.println("/p");
out.println("/card");
out.println("/wml");
%



Re: WML Generation from JSP broken!!!!

2000-11-29 Thread Alex Tang

Is there a way to get the compiler to ignore the "?xml version="1.0"?" syntax?

Otherwise this means that serving any page that is XML compliant (WML, XHTML, etc) now 
requires a complete
rewrite of all JSP files to run in 4.0.

Thanks.

...alex...


"Craig R. McClanahan" wrote:

 Davanum Srinivas wrote:

  Hi all,
  Attached is a JSP Sample file which generates WML. It works with no problems on 
Tomcat3.1, but
  fails miserably with the latest dev nightly snapshot and m4. Can someone shed 
light?
 

 Well, your page certainly doesn't work under Tomcat 4.0 (which implements JSP 1.2).  
Furthermore, it
 *should* not.

 Because you are starting this page with an ?xml version="1.0"? directive, the JSP 
compiler assumes that
 you have created this page in the XML syntax for JSP pages, as described in the 1.2 
spec
 http://java.sun.com/products/jsp/download.html.  However, this page violates 
several of the rules:
 * It does not start with a jsp:root element (this is
   what the parse error is complaining about).
 * It uses % % for a scriptlet, instead of the
   required jsp:scriptlet element.

 You will need to rewrite your page conforming to the new syntax rules in order for 
it to work correctly
 under 4.0.

 
  Thanks in advance,
  dims
 
  PS: Am not currently subscribed to the list. So please CC me at "[EMAIL PROTECTED]"
 

 Craig McClanahan

 PS:  Why did it work under 3.1?  Because 3.1 didn't support the XML syntax, so it 
just passed the ?xml?
 directive through as template text.