Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Serving XUL, setting content-header

  1. #1
    Join Date
    Nov 2006
    Posts
    9

    Default Serving XUL, setting content-header

    Hello,
    I want to XUL application as the front-end for the Pentaho-platform.
    I tried to get the data from al relational process action and formed a XUL list using
    javascript. Now I want to send the result to the client browser.
    Therefore I need to set the Content-Header of the reponse to 'application/vnd.mozilla.xul+xml'.

    I experimented around but I was not able to manipulate the content-header. The only way I found out to set the content header was using a jsp.

    But my intention is, to have a function like ViewAction or ServiceAction which I can call to serve XUL documents.

    So my questions:
    Is it necessary to create its own component which can serve XUL documents ? (like discribed in the Bulding-Components.pdf document)
    Or can I use built in functionality to set the content-header for the result?

    Thank you

    mbfip

  2. #2

    Default

    You can define your HTTP headers as outputs of your Action Sequence.
    Try to ouput a variable named "Content-type" in the response, that contains.... the content type ! (i.e "application/vnd.mozilla.xul+xml")
    Hope this helps.
    Fabien

  3. #3
    Join Date
    Nov 2006
    Posts
    9

    Default

    Thank you for your response,
    I will try your suggestion. I am not shure if the content of the variable will be wrapped in HTML - so I am afraid that the content of the variable will be sent but not the correct content-type.

    As soon as I know I will post the outcome.

    Thank you

  4. #4
    Join Date
    Nov 2006
    Posts
    9

    Default

    As you suggested I tried to output a varable with the content-type in the response, but in all cases the output was wrapped in html.

    For the moment, I generated a simple xul template which I serve via jsp. Here setting the content-type is simple.

    I will continue to look for a simple solution setting the content-header for the output of an xaction.

    Maybe someone has a good idea or even the solution.

    Ciao

  5. #5

    Default

    Sounds weird, since I've managed to make an HTTP redirection as output of an xaction, just setting a response output.

    You make me doubt : maybe it was an HTML redirection ?
    I can't verifiy for now, maybe an admin will have some better informations.
    Fabien

  6. #6
    Join Date
    Nov 2006
    Posts
    9

    Default My Solution

    To serve XUL applications using pentaho the following steps can be used:
    1. generate a XUL file which you want to be served (i.e. xulExample.xul)
    2. create a new xaction with the following content:

    Process Inputs:
    Code:
     resources:
      Name:template
      Location:xulExample.xul
      Source Type: solution-file
      Mime Type: application/vnd.mozilla.xul+xml
    Note: it is important to name the resource "template" otherwise it will not be processed. Maybe it is inetrnally wired with the "Template Message" component.

    Process Actions:
    Code:
    Process Action: Message Template
      Name: rule
      Template Source: String Parameter
      String Parameter: <null>
      Output Name: xul
    Template Parameters: <null>
    3. switch to the XML Source View and replace the following fragment:
    Code:
    <output-message type="string" mapping="xul"/>
    with
    Code:
    <xul type="content"/>
    and
    Code:
    <component-definition/>
    with
    Code:
          <component-definition> 
            <mime-type>application/vnd.mozilla.xul+xml</mime-type> 
          </component-definition>
    4. switch back to the Define Process view
    drag the xul output from process Actions to the Process Outputs section

    5. click on the xul element in the Process Outputs section and define the following as Output Destination:
    Code:
    Name: xul
    Type of Output: conte
    Output Destination:
    Destination: response
    Name: content
    Definitions:
    Code:
    <null> means no input, the field is left empty
    I have attached a simple zip file which contains a sample soultion. You only need to extract it anywhere in your pentaho-solutions directory.

    Maybe there are other solutions. I will post as soon as I found other solutions.
    Attached Files Attached Files

  7. #7
    Join Date
    Jun 2006
    Posts
    102

    Thumbs up

    hi,

    i was thinking about setting up a filter to handels header but your solution is much better.

    have a good day
    Yassine
    ***********************
    join us @ freenode ##pentaho

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.