View | Details | Raw Unified | Return to bug 32272
Collapse All | Expand All

(-)ImageTag.java.ori (-5 / +25 lines)
Lines 63-69 Link Here
63
    private static final String CONTEXT_TEMPDIR = "javax.servlet.context.tempdir";
63
    private static final String CONTEXT_TEMPDIR = "javax.servlet.context.tempdir";
64
64
65
    public static final String IMAGE_SERVLET_MAPPING = "ImageServletMapping";
65
    public static final String IMAGE_SERVLET_MAPPING = "ImageServletMapping";
66
66
    
67
    private static final String SESSION_ATTR_IMAGE_NAME = "org.apache.taglibs.image.ImageName";
68
    
67
    protected String src;
69
    protected String src;
68
70
69
    protected String attributes;
71
    protected String attributes;
Lines 101-114 Link Here
101
    protected boolean usingContextTempDir;
103
    protected boolean usingContextTempDir;
102
104
103
    protected String servletMapping;
105
    protected String servletMapping;
104
    
106
105
    protected String servletMappingContextParameter = IMAGE_SERVLET_MAPPING;
107
    protected String servletMappingContextParameter = IMAGE_SERVLET_MAPPING;
106
108
109
    protected boolean usingImageNameInSession;
110
107
    public int doStartTag() throws JspException {
111
    public int doStartTag() throws JspException {
108
        initialize();
112
        initialize();
109
        doChecks();
113
        doChecks();
110
114
111
        try {
115
        try {
116
        		if(usingImageNameInSession) {
117
        			pageContext.getSession().setAttribute(SESSION_ATTR_IMAGE_NAME, name);
118
        		}
119
112
            getLocalImageFile();
120
            getLocalImageFile();
113
            createImaging();
121
            createImaging();
114
            fetchImage();
122
            fetchImage();
Lines 291-303 Link Here
291
        } else {
299
        } else {
292
            attributes = ""; //a work around for the following conditions.
300
            attributes = ""; //a work around for the following conditions.
293
        }
301
        }
302
294
        //checking if the user has already specified the attributes.
303
        //checking if the user has already specified the attributes.
295
        String al = attributes.toLowerCase();
304
        String al = attributes.toLowerCase();
296
        if (al.indexOf(" src") == -1) {
305
        if (al.indexOf(" src") == -1) {
297
            if (usingContextTempDir) {
306
            if (usingContextTempDir) {
298
                html.append(" src=" + '"' + hreq.getContextPath()
307
                if(usingImageNameInSession) {
299
                        + getServletUrlString() + "?image=" + img.getName()
308
	                html.append(" src=" + '"' + hreq.getContextPath()
300
                        + '"');
309
	                        + getServletUrlString() + "?useSession=true" + '"');
310
                } else {
311
	                html.append(" src=" + '"' + hreq.getContextPath() 
312
	                				+ getServletUrlString() + "?image=" + img.getName() + '"');
313
                }
301
            } else {
314
            } else {
302
                html.append(" src=" + '"' + hreq.getContextPath() + '/' + dir
315
                html.append(" src=" + '"' + hreq.getContextPath() + '/' + dir
303
                        + '/' + img.getName() + '"');
316
                        + '/' + img.getName() + '"');
Lines 444-449 Link Here
444
457
445
    public void setQuality(float quality) {
458
    public void setQuality(float quality) {
446
        this.quality = quality;
459
        this.quality = quality;
460
    }
461
462
    public void setUsingImageNameInSession(boolean b) {
463
    		this.usingImageNameInSession = b;
464
    }
447
465
466
    public boolean isUsingImageNameInSession() {
467
    		return this.usingImageNameInSession;
448
    }
468
    }
449
}
469
}

Return to bug 32272