cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vjacheslav Borisov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5625) Server side xslt transformation using @XMLInstruction
Date Fri, 21 Mar 2014 05:10:44 GMT

    [ https://issues.apache.org/jira/browse/CXF-5625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13942798#comment-13942798
] 

Vjacheslav Borisov commented on CXF-5625:
-----------------------------------------

I think, that setting stylesheet in @XMLInstruction  has no alternative when you do not want
to use spring.
But it lacks server-side transformation currently.

And there is no possibility to specify to which  mimeType applies stylesheet in @XMLInstruction

this is why I need to hardcode that stylesheet in @XMLInstruction  applies to *second* mimeType
in @Produces annotation

https://github.com/bystrobank/testappjava/blob/master/src/main/java/ru/ilb/testappjava/DocumentResourceImpl.java

   @GET
    @Produces({"text/xml", "application/xhtml+xml"})
    @Path("/list")
    @XMLInstruction("<?xml-stylesheet type=\"text/xsl\" href=\"../../stylesheets/testappjava/document.xsl\"?>")
    @XSISchemaLocation(resolve = false, value = "../../schemas/testappjava/document.xsd")
    public DocumentListResponse listget(@QueryParam("") DocumentListRequest documentlistrequest)
{
        return list(documentlistrequest);
    }

Alternatively XsiXSLTJaxbProvider.java could look in stylesheet and parse 
<xsl:output
		media-type="application/xhtml+xml" ..
to determine to which mimetype applies this stylesheet 
( https://github.com/bystrobank/testappjava/blob/master/src/main/webapp/stylesheets/testappjava/document.xsl)

But this adds some overhead to processing, at least without cache.

Or @XMLInstruction could have parameter mimeType to which it applies



> Server side xslt transformation using @XMLInstruction
> -----------------------------------------------------
>
>                 Key: CXF-5625
>                 URL: https://issues.apache.org/jira/browse/CXF-5625
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 3.0.0-milestone2
>            Reporter: Vjacheslav Borisov
>            Priority: Minor
>
> XSLTJaxbProvider could look to @XMLInstruction to determine path to xslt transformation,
like this
>     @Produces({"text/xml", "application/xhtml+xml"})
>     @XMLInstruction("<?xml-stylesheet type=\"text/xsl\" href=\"../../stylesheets/testappjava/document.xsl\"?>")
> Like this
> https://github.com/bystrobank/testappjava/blob/master/src/main/java/ru/ilb/common/rs/XsiXSLTJaxbProvider.java
> But realisation is hardcoded that xslt is applied to second mime type in @Produces annotation
("application/xhtml+xml")  
> May be this hardcode is not applicable in public library
> This can be used to write service that can be used both with server-side and client-side
xslt transformation identically or to serve xml or html  based on Accept: header
> Deployed application
> http://tomcat-bystrobank.rhcloud.com/testappjava/web/document/list



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message