~ubuntu-branches/ubuntu/oneiric/tomcat7/oneiric-security

« back to all changes in this revision

Viewing changes to java/org/apache/jasper/JspCompilationContext.java

  • Committer: Bazaar Package Importer
  • Author(s): tony mancill, Miguel Landaeta, tony mancill
  • Date: 2011-06-23 20:26:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110623202629-w1v0jejj19swux10
Tags: 7.0.16-1
[ Miguel Landaeta ]
* New upstream release.
* Add missing deps and symlinks for commons-pool ands commons-dbcp jars.

[ tony mancill ]
* Add logrotate file for catalina.out.
* Add build-arch target to debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import java.io.File;
21
21
import java.io.FileNotFoundException;
 
22
import java.io.IOException;
 
23
import java.net.JarURLConnection;
22
24
import java.net.MalformedURLException;
23
25
import java.net.URL;
24
26
import java.net.URLClassLoader;
 
27
import java.net.URLConnection;
25
28
import java.util.HashMap;
26
29
import java.util.Map;
27
30
import java.util.Set;
60
63
    private final Log log = LogFactory.getLog(JspCompilationContext.class); // must not be static
61
64
 
62
65
    protected Map<String, JarResource> tagFileJarUrls;
63
 
    protected boolean isPackagedTagFile;
64
66
 
65
67
    protected String className;
66
68
    protected String jspUri;
67
 
    protected boolean isErrPage;
68
69
    protected String basePackageName;
69
70
    protected String derivedPackageName;
70
71
    protected String servletJavaFileName;
71
72
    protected String javaPath;
72
73
    protected String classFileName;
73
 
    protected String contentType;
74
74
    protected ServletWriter writer;
75
75
    protected Options options;
76
76
    protected JspServletWrapper jsw;
97
97
 
98
98
    // jspURI _must_ be relative to the context
99
99
    public JspCompilationContext(String jspUri,
100
 
                                 boolean isErrPage,
101
100
                                 Options options,
102
101
                                 ServletContext context,
103
102
                                 JspServletWrapper jsw,
104
103
                                 JspRuntimeContext rctxt) {
105
104
 
106
105
        this.jspUri = canonicalURI(jspUri);
107
 
        this.isErrPage = isErrPage;
108
106
        this.options = options;
109
107
        this.jsw = jsw;
110
108
        this.context = context;
134
132
                                 JspServletWrapper jsw,
135
133
                                 JspRuntimeContext rctxt,
136
134
                                 JarResource tagJarResource) {
137
 
        this(tagfile, false, options, context, jsw, rctxt);
 
135
        this(tagfile, options, context, jsw, rctxt);
138
136
        this.isTagFile = true;
139
137
        this.tagInfo = tagInfo;
140
138
        this.tagJarResource = tagJarResource;
141
 
        if (tagJarResource != null) {
142
 
            isPackagedTagFile = true;
143
 
        }
144
139
    }
145
140
 
146
141
    /* ==================== Methods to override ==================== */
390
385
        return jspUri;
391
386
    }
392
387
 
393
 
    /**
394
 
     * Are we processing something that has been declared as an
395
 
     * errorpage? 
396
 
     */
397
 
    public boolean isErrorPage() {
398
 
        return isErrPage;
399
 
    }
400
 
 
401
 
    public void setErrorPage(boolean isErrPage) {
402
 
        this.isErrPage = isErrPage;
 
388
    public long getJspLastModified() {
 
389
        long result = -1;
 
390
        URLConnection uc = null;
 
391
        try {
 
392
            URL jspUrl = getResource(getJspFile());
 
393
            if (jspUrl == null) {
 
394
                incrementRemoved();
 
395
                return result;
 
396
            }
 
397
            uc = jspUrl.openConnection();
 
398
            if (uc instanceof JarURLConnection) {
 
399
                result = ((JarURLConnection) uc).getJarEntry().getTime();
 
400
            } else {
 
401
                result = uc.getLastModified();
 
402
            }
 
403
        } catch (IOException e) {
 
404
            if (log.isDebugEnabled()) {
 
405
                log.debug(Localizer.getMessage(
 
406
                        "jsp.error.lastModified", getJspFile()), e);
 
407
            }
 
408
            result = -1;
 
409
        } finally {
 
410
            if (uc != null) {
 
411
                try {
 
412
                    uc.getInputStream().close();
 
413
                } catch (IOException e) {
 
414
                    if (log.isDebugEnabled()) {
 
415
                        log.debug(Localizer.getMessage(
 
416
                                "jsp.error.lastModified", getJspFile()), e);
 
417
                    }
 
418
                    result = -1;
 
419
                }
 
420
            }
 
421
        }
 
422
        return result;
403
423
    }
404
424
 
405
425
    public boolean isTagFile() {
519
539
    }
520
540
 
521
541
    /**
522
 
     * Get the content type of this JSP.
523
 
     *
524
 
     * Content type includes content type and encoding.
525
 
     */
526
 
    public String getContentType() {
527
 
        return contentType;
528
 
    }
529
 
 
530
 
    public void setContentType(String contentType) {
531
 
        this.contentType = contentType;
532
 
    }
533
 
 
534
 
    /**
535
542
     * Where is the servlet being generated?
536
543
     */
537
544
    public ServletWriter getWriter() {