Hi,

I’m new to gwt so pardon me if this is trivial.

I have a situation where the SOA server creates and passes back to my
GTW client a SOAP message attachment.  I have written a file handler
class (down in my gwt server folder area) to stream in the data and
write it to the disk on the machine the web app is deployed to – no
problem.  When developing on the PC I set the file path in the file
handler to

String dirPath = "C:\\Attachments\\attachclient_filereceive";

And when deploying (to a Sun Workstation) I edit the code and change
the path to: (though I’m not really sure where the best place
(location) is to write these files (attachments), so for now I toss
them into /tmp
String dirPath = "/tmp;

However, after deployment and when running tha application when I try
to click on the gwt Hyperlink and open the file I get the Error 404 –
Not Found error.  I did not get this when running / testing in hosted
mode it worked fine – and by fine I mean it opened a new window and
displayed the pdf or jpeg file.

So my question is how do I open the attachment?  When I click on the
hyperlink I get the following in a new window

Error 404 – Not Found
>From RFC 2068 Hypertext Transfer Protocol – HTTP/1.1:
10.4.5 404 Not Found

And the URL of the new window is
http://svr1:7001/tmp/UST_FSWSV.pdf

If I get on that node and cd /tmp the file is there as expected

And when I right click on the Hyperlink and look at Properties I get:

Protocol – unknown
Type - Adobe Acrobat Document
Address URL - #/tmp/UST_FSWSV.pdf

Any help would be greatly appreciated.  Thanks.
-John

Source Code is here:

package blah.client.dra;

//imports omitted

public class DraQueryResults extends Composite implements
ClickListener {

        private FlexTable draHeaderTable = null;
        private FlexTable draResultsTable = null;
        private FlexTable emptyTable = null;
        private VerticalPanel resultsPanel = new VerticalPanel();
        private TextArea errorMsg =  null;
        private Button close_tab = null;
        private Hyperlink pdfFile = null;
        //private String dirPath = "C:\\Attachments\\attachclient_filereceive\
\";
        private String dirPath = "/tmp/";

        private String returnStatus = null;
        private String fileName = null;
        private String strWindowFeatures =
"width=1000,height=800,menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";

        public DraQueryResults (GwtDraResultsContainer results, GwtDraRequest
draRequest) {

                returnStatus = new String(results.getReturnStatus());
                fileName = new String(results.getPdfFileName());
                close_tab = new Button("Close Tab");
                close_tab.addClickListener(this);
                close_tab.setTitle("Close Tab");
                resultsPanel.add(close_tab);


                        
if(results.getReturnStatus().equalsIgnoreCase("success")) {


                                draHeaderTable = 
populateDraGraphicalTable(results, draRequest);

                                Label header = new Label("DRA Graphical 
Report");
                                header.setHorizontalAlignment
(HasHorizontalAlignment.ALIGN_CENTER);
                                header.setStylePrimaryName("subHeaderLabel");
                                resultsPanel.setHorizontalAlignment
(HasHorizontalAlignment.ALIGN_CENTER);
                                resultsPanel.add(header);
                                resultsPanel.add(draHeaderTable);

                                // Look Here !
                                pdfFile = new 
Hyperlink(results.getPdfFileName(), dirPath +
results.getPdfFileName());
                                pdfFile.setTitle("imageFile");
                                pdfFile.setHTML(results.getPdfFileName());
                                pdfFile.addClickListener(this);
                                        resultsPanel.add(pdfFile);
                                // This window never opens
                                        Window.open(dirPath + fileName,"Dra", 
strWindowFeatures);
                                resultsPanel.setHeight("100%");

                                initWidget(resultsPanel);
                        }

                        else 
if(results.getReturnStatus().equalsIgnoreCase("failure")) {
                                //Stubbed out – just display an error message
                        }
                }
        }

        private FlexTable populateDraGraphicalTable(GwtDraResultsContainer
results, GwtDraRequest draRequest){
                //System.out.println("Entering
populateDraGraphicalTable");

FlexTable ht = new FlexTable();
        ht.setStylePrimaryName("gwt-Flextable");
        ht.setCellPadding(5);
        ht.setBorderWidth(1);

        ht.getRowFormatter().addStyleName(0, "blueHeader");
        //Add the table Header cells
        ht.getFlexCellFormatter().setHorizontalAlignment
(0,0,HasHorizontalAlignment.ALIGN_CENTER);
                ht.setHTML(0, 0, "Vehicle");
        ht.getFlexCellFormatter().setHorizontalAlignment
(0,1,HasHorizontalAlignment.ALIGN_CENTER);
                ht.setHTML(0, 1, "Configuration");
        ht.getFlexCellFormatter().setHorizontalAlignment
(0,2,HasHorizontalAlignment.ALIGN_CENTER);
                ht.setHTML(0, 2, "Start Time");
        ht.getFlexCellFormatter().setHorizontalAlignment
(0,3,HasHorizontalAlignment.ALIGN_CENTER);
                ht.setHTML(0, 3, "Stop Time");
                ht.getFlexCellFormatter().setHorizontalAlignment
(0,3,HasHorizontalAlignment.ALIGN_CENTER);
                ht.setHTML(0, 4, "PDF FileId");


// Add the data portion to the table.
        ht.setCellPadding(5);
        ht.getFlexCellFormatter().setHorizontalAlignment
(1,0,HasHorizontalAlignment.ALIGN_CENTER);
                ht.setHTML(1, 0, draRequest.getVehicle());

        ht.getFlexCellFormatter().setHorizontalAlignment
(1,1,HasHorizontalAlignment.ALIGN_CENTER);
                ht.setHTML(1, 1, draRequest.getConfig());

       ht.getFlexCellFormatter().setHorizontalAlignment
(1,2,HasHorizontalAlignment.ALIGN_CENTER);
                ht.setHTML(1, 2, draRequest.getStartTime());

        ht.getFlexCellFormatter().setHorizontalAlignment
(1,3,HasHorizontalAlignment.ALIGN_CENTER);
                ht.setHTML(1, 3, draRequest.getStopTime());

                ht.getFlexCellFormatter().setHorizontalAlignment
(1,4,HasHorizontalAlignment.ALIGN_CENTER);
                ht.setHTML(1, 4, results.getPdfFileName());

                return ht;
        }

        public void onClick(Widget sender){
                if(sender.getTitle().equals("Close Tab")){
                        //System.out.println("Removing Tab Dra Results");
                        GWTClientHelper.removeTab("Dra Results");
                }
                else if (sender.getTitle().equals("imageFile")){
                        if (returnStatus.equalsIgnoreCase("success")){
                                Window.open(dirPath + fileName,"Dra", 
strWindowFeatures);
                        }
                }
        }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to