Statistics
| Revision:

root / trunk / libraries / libArcIMS / src / org / gvsig / remoteClient / arcims / ArcImsProtImageHandler.java @ 8109

History | View | Annotate | Download (24.2 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Prodevelop and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *   +34 963862235
28
 *   gvsig@gva.es
29
 *   www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Prodevelop Integraci?n de Tecnolog?as SL
34
 *   Conde Salvatierra de ?lava , 34-10
35
 *   46004 Valencia
36
 *   Spain
37
 *
38
 *   +34 963 510 612
39
 *   +34 963 510 968
40
 *   gis@prodevelop.es
41
 *   http://www.prodevelop.es
42
 */
43

    
44
package org.gvsig.remoteClient.arcims;
45

    
46
import org.apache.log4j.Logger;
47

    
48
import org.cresques.cts.IProjection;
49

    
50
import org.gvsig.remoteClient.arcims.exceptions.ArcImsException;
51
import org.gvsig.remoteClient.arcims.utils.ArcImsDownloadUtils;
52
import org.gvsig.remoteClient.arcims.utils.GetImageTags;
53
import org.gvsig.remoteClient.arcims.utils.ServiceInfoTags;
54
import org.gvsig.remoteClient.arcims.utils.ServiceInformation;
55
import org.gvsig.remoteClient.arcims.utils.ServiceInformationLayer;
56
import org.gvsig.remoteClient.exceptions.ServerErrorException;
57
import org.gvsig.remoteClient.utils.BoundaryBox;
58

    
59
import org.kxml2.io.KXmlParser;
60

    
61
import org.xmlpull.v1.XmlPullParserException;
62

    
63
import java.awt.Rectangle;
64
import java.awt.geom.Area;
65
import java.awt.geom.Rectangle2D;
66

    
67
import java.io.BufferedReader;
68
import java.io.File;
69
import java.io.FileNotFoundException;
70
import java.io.FileReader;
71
import java.io.IOException;
72
import java.io.Reader;
73

    
74
import java.net.ConnectException;
75
import java.net.MalformedURLException;
76
import java.net.URL;
77

    
78
import java.util.Vector;
79

    
80

    
81
/**
82
 * <p>
83
 * Describes the handler to communicate to a ArcIMS ImageServer
84
 * </p>
85
 */
86
public class ArcImsProtImageHandler extends ArcImsProtocolHandler {
87
    private static Logger logger = Logger.getLogger(ArcImsProtImageHandler.class.getName());
88

    
89
    /**
90
     * Method to obtain the correct extent of the Service in a specific SRS
91
     * @param srsFlyr The SRS of the View
92
     * @param status
93
     * @return Rectangle2D The boundary box of the Service
94
     * @throws ArcImsException
95
     */
96
    public Rectangle2D getServiceExtent(IProjection srsFlyr, ArcImsStatus status)
97
        throws ArcImsException {
98
        Rectangle2D rect = new Rectangle();
99

    
100
        try {
101
            //System.err.println("Requesting the Extent of the Service");
102
            URL url = new URL(this.buildCapabilitiesRequest(status));
103

    
104
            /**
105
             * The seriveInfo
106
             */
107
            ServiceInformation si = status.getServiceInfo();
108

    
109
            /**
110
            * Gets de Decimal Separator and SRS from the status.ServiceInfo
111
            */
112
            char ds = si.getSeparators().getDs();
113
            String srsSI = si.getFeaturecoordsys();
114

    
115
            /**
116
                 * The EPSG code that image requested will have,
117
                 * the ArcIMS server will reproject data into this
118
                 * code, see <a href="http://www.epsg.org">EPSG</a>
119
                 */
120
            String srsView = srsFlyr.getAbrev();
121

    
122
            /**
123
                 * We suppose that status.getSrs() allways will give a
124
                 * string started by this string
125
                 */
126
            String ini_srs = ServiceInfoTags.vINI_SRS;
127

    
128
            /**
129
                 * Assign the srs from the status
130
                 * @see org.gvsig.remoteClient.RemoteClientStatus#getSrs()
131
                 */
132
            if (srsView.startsWith(ini_srs)) {
133
                srsView = srsView.substring(ini_srs.length()).trim();
134
            }
135

    
136
            /**
137
                 * If both SRS are the same or status we pass empty strings
138
                 */
139
            if (srsView.equalsIgnoreCase(srsSI)) {
140
                srsView = "";
141
                srsSI = "";
142
            }
143

    
144
            /**
145
             * Build the custom request for this extent
146
             */
147
            String request = ArcXMLImage.getCustomExtentRequest(srsSI, 
148
                //ServiceInfo SRS
149
                null, //envelope 
150
                    srsView, //SRS of the view
151
                    ds, //Decimal separator
152
                    null, //Image size
153
                    "", si.getLayer(0).getId() //A valid Layer Id
154
                );
155

    
156
            if (status.verbose) {
157
                System.err.println(request);
158
            }
159

    
160
            logger.info("Requesting Service Extent XML");
161

    
162
            File response = ArcImsDownloadUtils.doRequestPost(url, request,
163
                    "getServiceExtent.xml");
164
            rect = parseEnvelopeTag(new FileReader(response), ds);
165
        } catch (MalformedURLException e) {
166
            logger.error(e.getMessage(), e);
167
            throw new ArcImsException("arcims_server_error");
168
        } catch (FileNotFoundException e) {
169
            logger.error(e.getMessage(), e);
170
            throw new ArcImsException("arcims_server_error");
171
        }
172

    
173
        return rect;
174
    }
175

    
176
    /**
177
    * <p>It will send a GetFeatureInfo request to the ArcIms
178
    * Parsing the response and redirecting the info to the ArcIms client</p>
179
     * @throws ArcImsException
180
    */
181
    public String getElementInfo(ArcImsStatus status, int x, int y,
182
        int featureCount) throws ArcImsException {
183
        double iViewX;
184
        double iViewY;
185
        double iServiceX;
186
        double iServiceY;
187
        double xReal;
188
        double yReal;
189

    
190
        // double dist;
191
        int ratio;
192
        double currentScale;
193

    
194
        /**
195
         * ServiceInformation of the current Service
196
         */
197
        ServiceInformation si = status.getServiceInfo();
198
        char ds = si.getSeparators().getDs();
199

    
200
        /**
201
         * Determine the SRS to do all the requests, if the ServiceInformation
202
         * doesn't provide a valid SRS, then we use the status srs
203
         */
204
        String srs = status.getSrs().substring(ServiceInfoTags.vINI_SRS.length())
205
                           .trim();
206

    
207
        /**
208
         * The geographic extent of the current window
209
         */
210
        Rectangle2D geoServiceExtent = new Rectangle();
211
        Rectangle2D geoViewExtent = status.getExtent();
212

    
213
        /**
214
         * If the SRS's are different we need a reprojection, using a properly
215
         * formed ArcIms GETIMAGE request
216
         */
217
        if (!si.getFeaturecoordsys().equalsIgnoreCase(srs)) {
218
            try {
219
                logger.info("Requesting the Extent of the Image");
220

    
221
                URL url = new URL(this.buildCapabilitiesRequest(status));
222
                String request = ArcXMLImage.getCustomExtentRequest(srs,
223
                        status.getExtent(), si.getFeaturecoordsys(), ds, null,
224
                        "", si.getLayer(0).getId());
225

    
226
                if (status.verbose) {
227
                    System.err.println(request);
228
                }
229

    
230
                File response = ArcImsDownloadUtils.doRequestPost(url, request,
231
                        "getInfoImageExtent.xml");
232
                geoServiceExtent = parseEnvelopeTag(new FileReader(response), ds);
233
            } catch (MalformedURLException e) {
234
                logger.error(e.getMessage(), e);
235
                throw new ArcImsException("arcims_server_error");
236
            } catch (FileNotFoundException e) {
237
                logger.error(e.getMessage(), e);
238
                throw new ArcImsException("arcims_server_error");
239
            }
240
        } else {
241
            geoServiceExtent = status.getExtent();
242
        }
243

    
244
        /**
245
         * URL for the requests of info
246
         */
247
        URL requestF;
248
        URL requestI;
249
        URL request;
250

    
251
        /**
252
         * StringBuffer to store the POST info to pass to the server
253
         */
254
        StringBuffer sb = new StringBuffer();
255

    
256
        /**
257
         * Vector of Layers IDs to request
258
         */
259
        Vector idLayers = status.getLayerIds();
260

    
261
        /**
262
         * String with the ArcXML request (GET_FEATURES)
263
         */
264
        String sArcXML = new String();
265

    
266
        /**
267
         * First at all, we build the request for this service
268
         */
269
        try {
270
            requestF = new URL(buildGetFeatureInfoRequest(status,
271
                        ServiceInfoTags.vLAYERTYPE_F));
272
            requestI = new URL(buildGetFeatureInfoRequest(status,
273
                        ServiceInfoTags.vLAYERTYPE_I));
274
        } catch (Exception e) {
275
            e.printStackTrace();
276

    
277
            return "";
278
        }
279

    
280
        sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
281
        sb.append("<FeatureInfoResponse>");
282

    
283
        /**
284
         * We need to obtain the real (geographic) x,y not the pixels of the
285
         * image, a BoundaryBox of the area we will query, the envelope and
286
         * scale of the current view
287
         *
288
         */
289
        ratio = 3;
290
        iViewX = geoViewExtent.getWidth() / status.getWidth();
291
        iViewY = geoViewExtent.getHeight() / status.getHeight();
292
        iServiceX = geoServiceExtent.getWidth() / status.getWidth();
293
        iServiceY = geoServiceExtent.getHeight() / status.getHeight();
294
        xReal = geoViewExtent.getMinX() + (x * iViewX);
295
        yReal = geoViewExtent.getMaxY() - (y * iViewY);
296

    
297
        if (serviceInfo.getScreen_dpi() == -1) {
298
            serviceInfo.setScreen_dpi(96);
299
        }
300

    
301
        // currentScale = serviceInfo.screen_dpi/INCHES*((iX+iY)/2);
302
        currentScale = 1.0 * ((iServiceX + iServiceY) / 2.0);
303

    
304
        /**
305
         * Now we are ready to run over the layers to request the info for every
306
         * one
307
         */
308
        Vector ids = status.getLayerIds();
309
        int n = ids.size();
310
        String fields;
311

    
312
        ServiceInformationLayer sil;
313
        ServiceInformationLayer silTemp;
314

    
315
        /*
316
         * If ServiceInfo is Assumed we don't pass a valid SRS to
317
         * avoid projection problems.
318
         */
319
        if (si.isSrsAssumed()) {
320
            srs = "";
321
        }
322

    
323
        logger.info("Searching candidate layers");
324

    
325
        for (int i = 0; i < n; i++) {
326
            /**
327
             * Before we do any request to the server, we will ensure that the
328
             * layer is viewed in the current envelope and scale
329
             */
330

    
331
            /**
332
             * Retrieve the proper ServiceInformationLayer
333
             */
334
            sil = silTemp = (ServiceInformationLayer) si.getLayers().get(0);
335

    
336
            for (int j = 0; j < si.getLayers().size(); j++) {
337
                silTemp = (ServiceInformationLayer) si.getLayers().get(j);
338

    
339
                if (silTemp.getId().equals(ids.get(i))) {
340
                    sil = silTemp;
341

    
342
                    break;
343
                }
344
            }
345

    
346
            /**
347
             * Querying about the scale
348
             */
349
            boolean inScale = false;
350

    
351
            if (sil.getMinscale() == -1) {
352
                if (sil.getMaxscale() == -1) {
353
                    inScale = true;
354
                } else {
355
                    inScale = (currentScale < sil.getMaxscale());
356
                }
357
            } else {
358
                if (sil.getMaxscale() == -1) {
359
                    inScale = (currentScale > sil.getMinscale());
360
                } else {
361
                    inScale = (currentScale > sil.getMinscale()) &&
362
                        (currentScale < sil.getMaxscale());
363
                }
364
            }
365

    
366
            if (inScale) {
367
                /**
368
                 * Querying about the envelope, we have to ask if geoExtent has
369
                 * the Envelope of the layer inside it.
370
                 */
371
                boolean inEnvelope = false;
372
                BoundaryBox mEnv = sil.getEnvelope();
373

    
374
                Area mVentana = new Area((java.awt.Shape) geoServiceExtent);
375
                Rectangle2D rectCapa = new Rectangle2D.Double(mEnv.getXmin(),
376
                        mEnv.getYmin(), mEnv.getXmax() - mEnv.getXmin(),
377
                        mEnv.getYmax() - mEnv.getYmin());
378

    
379
                inEnvelope = mVentana.intersects(rectCapa);
380

    
381
                /**
382
                 * If two conditions are true, we do the request
383
                 */
384

    
385
                // if (inScale && inEnvelope){
386
                if (inEnvelope) {
387
                    // System.out.println("Procesando la capa "+ sil.name);
388
                    fields = "";
389

    
390
                    /**
391
                     * Get the Info request for a featureclass or raster layer
392
                     */
393
                    double[] coords = { xReal, yReal };
394
                    double[] dists = { ratio * iServiceX, ratio * iServiceY };
395
                    sArcXML = ArcXMLImage.getInfoRequest(sil.getType(),
396
                            idLayers.get(i).toString(), coords, dists, srs,
397
                            si.getSeparators().getDs());
398

    
399
                    if (status.verbose) {
400
                        System.err.println(sArcXML);
401
                    }
402

    
403
                    /**
404
                     * File with a layer info response
405
                     */
406
                    if (sil.getType().equals(ServiceInfoTags.vLAYERTYPE_F)) {
407
                        request = requestF;
408
                    } else {
409
                        request = requestI;
410
                    }
411

    
412
                    logger.info("Requesting layer \"" + sil.getName() +
413
                        "\" information");
414

    
415
                    File response = ArcImsDownloadUtils.doRequestPost(request,
416
                            sArcXML, "getElementInfo.xml");
417

    
418
                    /**
419
                     * Now we can parse the file to get the FIELDS element
420
                     */
421
                    fields = parseFieldsInfoResponse(response);
422

    
423
                    if (!fields.equals("")) {
424
                        // System.out.println("Se han encontrado resultados,
425
                        // procesando atributos");
426
                        sb.append(ArcXML.getLayerHeaderInfoResponse(
427
                                ids.get(i).toString(), status.getServiceInfo()));
428

    
429
                        /**
430
                         * FIELDS element
431
                         */
432
                        sb.append(fields.replaceAll("#", "_"));
433

    
434
                        // sb.append("\t\t"+"<FIELDS #IY_PRE=\"1000\"
435
                        // #SHAPE#=\"[Geometry]\" #ID#=\"11\" />\r\n");
436
                        sb.append(ArcXML.getLayerFooterInfoResponse());
437
                    }
438

    
439
                    // else
440
                    // System.out.println("No se han encontrado entidades");
441
                } // Fin del if de ventana
442
                else {
443
                    logger.info("Layer \"" + sil.getName() +
444
                        "\" is not shown at this envelope");
445
                }
446
            }
447
            // Fin del if de escala
448
            else {
449
                logger.info("Layer \"" + sil.getName() +
450
                    "\" is not shown at this scale");
451
            }
452
        }
453

    
454
        // Fin del for
455
        sb.append("</FeatureInfoResponse>");
456

    
457
        // System.out.println(sb.toString());
458
        return sb.toString();
459
    }
460

    
461
    /**
462
            * Parse the xml data retrieved from the ArcIms, it will parse the ArcIms
463
            * Features
464
            * @see #getElementInfo(ArcImsStatus, int, int, int)
465
            * @param f
466
            *            The XML file to parse to obtain the FIELDS element
467
            * @return XML with FIELDS or BAND tags as a response to a getElementInfo
468
            */
469
    private String parseFieldsInfoResponse(File f) {
470
        BufferedReader fi;
471
        String buf;
472
        StringBuffer fields = new StringBuffer();
473
        String token = null;
474
        int l = 0;
475

    
476
        try {
477
            fi = new BufferedReader(new FileReader(f));
478

    
479
            while ((buf = fi.readLine()) != null) {
480
                // System.out.println(buf);
481
                l++;
482

    
483
                //System.err.println(l);
484
                if ((buf.length() > 2) &&
485
                        (buf.substring(0, 1).compareTo("<") == 0)) {
486
                    token = buf.substring(1); //,l.indexOf(GT));
487

    
488
                    if (token.startsWith("FIELDS")) {
489
                        fields.append(buf + "");
490
                    }
491

    
492
                    if (token.startsWith("BAND ")) {
493
                        fields.append(buf + "");
494
                    }
495
                }
496
            }
497

    
498
            fi.close();
499
            System.out.println("Request parsed. (" + l + " lines)");
500
        } catch (FileNotFoundException e) {
501
            e.printStackTrace();
502
        } catch (IOException ie) {
503
            logger.error("ERROR. (" + l + "lines reeded)");
504
            ie.printStackTrace();
505
        }
506

    
507
        return fields.toString();
508
    }
509

    
510
    /**
511
     * <p>Builds a GetMap request that is sent to the ArcIms
512
     * the response (image) will be redirect to the
513
     * ArcIms client</p>
514
     * @param status An  @see ArcImsStatus object
515
     * @return File The image requested (a map)
516
    * @throws ArcImsException
517
    * @throws ServerErrorException
518
     */
519
    public File getMap(ArcImsStatus status)
520
        throws ArcImsException, ServerErrorException {
521
        File img = null;
522
        String currentImageUrl = "";
523

    
524
        try {
525
            URL url = new URL(buildCapabilitiesRequest(status));
526

    
527
            String request = ArcXMLImage.getMapRequest(status);
528

    
529
            if (status.verbose) {
530
                System.err.println(request);
531
            }
532

    
533
            logger.info("Requesting ArcIMS GetImage XML");
534

    
535
            File response = ArcImsDownloadUtils.doRequestPost(url, request,
536
                    "getImage.xml");
537

    
538
            try {
539
                currentImageUrl = parseGetImageRequest(new FileReader(response));
540

    
541
                //Control if not /output/blahblah has been passed
542
                if (!currentImageUrl.startsWith("http://")) {
543
                    String servlet = status.getServer();
544
                    int ind1 = servlet.indexOf("//");
545
                    int ind = servlet.indexOf("/", ind1 + 2);
546
                    currentImageUrl = servlet.substring(0, ind) +
547
                        currentImageUrl;
548
                }
549
            } catch (FileNotFoundException e) {
550
                logger.error(e.getMessage(), e);
551
                throw new ArcImsException("Fichero remoto no encontrado");
552
            }
553

    
554
            URL virtualURL = ArcImsDownloadUtils.getVirtualUrlFromStatus(status);
555
            logger.info("Downloading ArcIMS image");
556

    
557
            String[] urlSplitted = currentImageUrl.split("\\.");
558
            String extension = urlSplitted[urlSplitted.length - 1];
559
            img = ArcImsDownloadUtils.downloadFile(new URL(currentImageUrl),
560
                    virtualURL, "getImage." + extension);
561

    
562
            // img =com.iver.andami.Utilities.downloadFile(new URL(currentImageUrl),"getImage");
563
            if (img.length() == 0) {
564
                return null;
565
            }
566

    
567
            // response.delete();
568
        } catch (MalformedURLException e) {
569
            logger.error(e.getMessage(), e);
570
            throw new ArcImsException("arcims_server_timeout");
571
        } catch (ConnectException ce) {
572
            logger.error("Timed out error", ce);
573
            throw new ArcImsException("arcims_server_timeout");
574
        } catch (FileNotFoundException fe) {
575
            logger.error("FileNotFound Error", fe);
576
            throw new ArcImsException("arcims_server_error");
577
        } catch (IOException e) {
578
            logger.error("IO Error", e);
579
            throw new ArcImsException("arcims_server_error");
580
        }
581

    
582
        return img;
583
    }
584

    
585
    /**
586
     * Method that parses a GET_IMAGE request, sets the
587
     * url to download the rendered image.
588
     * @param fr
589
    * @return @see  org.gvsig.remoteClient.arcims.ArcImsProtImageHandler#getMap(ArcImsStatus)
590
    * @throws ArcImsException
591
    * @throws ServerErrorException
592
     */
593
    private String parseGetImageRequest(Reader fr)
594
        throws ArcImsException, ServerErrorException {
595
        String imageUrl = "";
596
        int tag;
597
        KXmlParser kxmlParser = new KXmlParser();
598
        String value = null;
599

    
600
        try {
601
            kxmlParser.setInput(fr);
602
            kxmlParser.nextTag();
603

    
604
            if (kxmlParser.getEventType() != KXmlParser.END_DOCUMENT) {
605
                kxmlParser.require(KXmlParser.START_TAG, null,
606
                    ServiceInfoTags.tARCXML);
607
                tag = kxmlParser.nextTag();
608

    
609
                while (tag != KXmlParser.END_DOCUMENT) {
610
                    switch (tag) {
611
                    case KXmlParser.START_TAG:
612

    
613
                        if (kxmlParser.getName().compareTo(GetImageTags.OUTPUT) == 0) {
614
                            value = kxmlParser.getAttributeValue("",
615
                                    GetImageTags.URL);
616

    
617
                            if (value != null) {
618
                                imageUrl = value;
619
                            }
620
                        } else if (kxmlParser.getName()
621
                                                 .compareTo(ServiceInfoTags.tERROR) == 0) {
622
                            throw new ServerErrorException(
623
                                "Error parsing GET_IMAGE:\r\n" +
624
                                kxmlParser.nextText());
625
                        }
626

    
627
                        break;
628

    
629
                    case KXmlParser.END_TAG:
630
                        break;
631

    
632
                    case KXmlParser.TEXT:
633
                        break;
634
                    }
635

    
636
                    tag = kxmlParser.next();
637
                }
638

    
639
                kxmlParser.require(KXmlParser.END_DOCUMENT, null, null);
640
            }
641
        } catch (XmlPullParserException parser_ex) {
642
            logger.error(parser_ex.getMessage(), parser_ex);
643
            throw new ArcImsException("arcims_server_error");
644
        } catch (IOException ioe) {
645
            logger.error(ioe.getMessage(), ioe);
646
            throw new ArcImsException("arcims_server_error");
647
        }
648

    
649
        return imageUrl;
650
    }
651

    
652
    /**
653
     * Simple method to test if an ArcIMS server responses with an image
654
     * of an specified format
655
     * @param status
656
     * @return
657
     * @throws ArcImsException
658
     */
659
    public boolean testFormat(ArcImsStatus status, String format)
660
        throws ArcImsException {
661
        boolean resp = true;
662
        URL url;
663

    
664
        try {
665
            ServiceInformation si = status.getServiceInfo();
666
            url = new URL(this.buildCapabilitiesRequest(status));
667

    
668
            /**
669
             * Build the custom request for this extent
670
             */
671
            String request = ArcXMLImage.getCustomExtentRequest("", // ServiceInfo
672
                                                                    // SRS
673
                    null, // envelope
674
                    "", // SRS of the view
675
                    si.getSeparators().getDs(), // Decimal separator
676
                    null, // Image size
677
                    format, si.getLayer(0).getId() // A valid Layer Id
678
                );
679

    
680
            if (status.verbose) {
681
                System.err.println(request);
682
            }
683

    
684
            logger.info("Querying for a specific format");
685

    
686
            //                        BufferedReader lector = ArcImsDownloadUtils.getRemoteReader(url,request);
687
            File f = ArcImsDownloadUtils.doRequestPost(url, request,
688
                    "testFormat.xml");
689
            BufferedReader lector = new BufferedReader(new FileReader(f));
690

    
691
            /**
692
             * Loop over the reader until it ends or an ERROR is found
693
             */
694
            String lin = lector.readLine();
695

    
696
            //The regular expression to match
697
            String regex = ".*<" + ServiceInfoTags.tERROR + ".*</" +
698
                ServiceInfoTags.tERROR + ">.*";
699

    
700
            do {
701
                if (lin.matches(regex)) {
702
                    return false;
703
                }
704

    
705
                lin = lector.readLine();
706
            } while (lin != null);
707
        } catch (MalformedURLException e) {
708
            logger.error(e.getMessage(), e);
709
            throw new ArcImsException("arcims_server_eror");
710
        } catch (IOException e) {
711
            logger.error(e.getMessage(), e);
712
            throw new ArcImsException("arcims_server_eror");
713
        }
714

    
715
        return resp;
716
    }
717
}