You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ode.apache.org by Milinda Pathirage <mi...@gmail.com> on 2008/07/27 10:31:14 UTC

DeplymentBrowser return content type

Hi,
Is there any way I can change the content type of returned .bpel files and
wsdl files. I tried response.setContentType("application/html") and
response.setHeader("Content-Type","application/xml") inside
DeploymentBrowser.java like following:
else if (segments.length > 2) {

                        List<QName> processes =
_store.listProcesses(segments[1]);
                        if (processes != null) {
                            List<File> files =
_store.getProcessConfiguration(processes.get(0)).getFiles();
                            for (final File file : files) {
                                String relativePath =
requestURI.substring(deplUri + 12 + 9 + segments[1].length());
                                if (file.getPath().endsWith(relativePath)) {
                                    response.setHeader("Content-Type",
"application/xml");
                                    renderXml(response, new DocBody() {
                                        public void render(Writer out)
throws IOException {
                                            write(out, file.getPath());
                                        }
                                    });
                                    return true;
                                }
                            }

But it always return the bpels and wsdl files with Content Type 'text/xml'.
Because of the 'text/xml' content type I can't get the full xml content of
bpel definition with XMLHttpRequest Ajax call. If XMLHttpRequest to work
correctly for xml. content type must be 'application/xml'.
I am using ODE1_x branch and I want to know thing I have done is correct or
do I have to set the content type in any other place to make it work as I
expect.

Thanks
Milinda

-- 
http://mpathirage.com
http://wso2.org "Oxygen for Web Service Developers"
http://wsaxc.blogspot.com "Web Services With Axis2/C"

Re: DeplymentBrowser return content type

Posted by Matthieu Riou <ma...@offthelip.org>.
On Mon, Jul 28, 2008 at 1:46 AM, Milinda Pathirage <
milinda.pathirage@gmail.com> wrote:

> Hi,
> It's my mistake. I found the place that I can set the content type.
>

Great!

Thanks,
Matthieu


>
> Thanks
> Milinda
>
> On Sun, Jul 27, 2008 at 2:01 PM, Milinda Pathirage <
> milinda.pathirage@gmail.com> wrote:
>
> > Hi,
> > Is there any way I can change the content type of returned .bpel files
> and
> > wsdl files. I tried response.setContentType("application/html") and
> > response.setHeader("Content-Type","application/xml") inside
> > DeploymentBrowser.java like following:
> > else if (segments.length > 2) {
> >
> >                         List<QName> processes =
> > _store.listProcesses(segments[1]);
> >                         if (processes != null) {
> >                             List<File> files =
> > _store.getProcessConfiguration(processes.get(0)).getFiles();
> >                             for (final File file : files) {
> >                                 String relativePath =
> > requestURI.substring(deplUri + 12 + 9 + segments[1].length());
> >                                 if
> (file.getPath().endsWith(relativePath))
> > {
> >                                     response.setHeader("Content-Type",
> > "application/xml");
> >                                     renderXml(response, new DocBody() {
> >                                         public void render(Writer out)
> > throws IOException {
> >                                             write(out, file.getPath());
> >                                         }
> >                                     });
> >                                     return true;
> >                                 }
> >                             }
> >
> > But it always return the bpels and wsdl files with Content Type
> 'text/xml'.
> > Because of the 'text/xml' content type I can't get the full xml content
> of
> > bpel definition with XMLHttpRequest Ajax call. If XMLHttpRequest to work
> > correctly for xml. content type must be 'application/xml'.
> > I am using ODE1_x branch and I want to know thing I have done is correct
> or
> > do I have to set the content type in any other place to make it work as I
> > expect.
> >
> > Thanks
> > Milinda
> >
> > --
> > http://mpathirage.com
> > http://wso2.org "Oxygen for Web Service Developers"
> > http://wsaxc.blogspot.com "Web Services With Axis2/C"
> >
>
>
>
> --
> http://mpathirage.com
> http://wso2.org "Oxygen for Web Service Developers"
> http://wsaxc.blogspot.com "Web Services With Axis2/C"
>

Re: DeplymentBrowser return content type

Posted by Milinda Pathirage <mi...@gmail.com>.
Hi,
It's my mistake. I found the place that I can set the content type.

Thanks
Milinda

On Sun, Jul 27, 2008 at 2:01 PM, Milinda Pathirage <
milinda.pathirage@gmail.com> wrote:

> Hi,
> Is there any way I can change the content type of returned .bpel files and
> wsdl files. I tried response.setContentType("application/html") and
> response.setHeader("Content-Type","application/xml") inside
> DeploymentBrowser.java like following:
> else if (segments.length > 2) {
>
>                         List<QName> processes =
> _store.listProcesses(segments[1]);
>                         if (processes != null) {
>                             List<File> files =
> _store.getProcessConfiguration(processes.get(0)).getFiles();
>                             for (final File file : files) {
>                                 String relativePath =
> requestURI.substring(deplUri + 12 + 9 + segments[1].length());
>                                 if (file.getPath().endsWith(relativePath))
> {
>                                     response.setHeader("Content-Type",
> "application/xml");
>                                     renderXml(response, new DocBody() {
>                                         public void render(Writer out)
> throws IOException {
>                                             write(out, file.getPath());
>                                         }
>                                     });
>                                     return true;
>                                 }
>                             }
>
> But it always return the bpels and wsdl files with Content Type 'text/xml'.
> Because of the 'text/xml' content type I can't get the full xml content of
> bpel definition with XMLHttpRequest Ajax call. If XMLHttpRequest to work
> correctly for xml. content type must be 'application/xml'.
> I am using ODE1_x branch and I want to know thing I have done is correct or
> do I have to set the content type in any other place to make it work as I
> expect.
>
> Thanks
> Milinda
>
> --
> http://mpathirage.com
> http://wso2.org "Oxygen for Web Service Developers"
> http://wsaxc.blogspot.com "Web Services With Axis2/C"
>



-- 
http://mpathirage.com
http://wso2.org "Oxygen for Web Service Developers"
http://wsaxc.blogspot.com "Web Services With Axis2/C"