This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

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

(-)a/j2ee.weblogic9/nbproject/project.xml (-1 / +1 lines)
Lines 140-146 Link Here
140
                    <compile-dependency/>
140
                    <compile-dependency/>
141
                    <run-dependency>
141
                    <run-dependency>
142
                        <release-version>4</release-version>
142
                        <release-version>4</release-version>
143
                        <specification-version>1.72</specification-version>
143
                        <specification-version>1.75</specification-version>
144
                    </run-dependency>
144
                    </run-dependency>
145
                </dependency>
145
                </dependency>
146
                <dependency>
146
                <dependency>
(-)a/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/config/WarDeploymentConfiguration.java (+1 lines)
Lines 296-301 Link Here
296
        webLogicWebApp.setContextRoot(new String [] {""}); // NOI18N
296
        webLogicWebApp.setContextRoot(new String [] {""}); // NOI18N
297
        JspDescriptorType jspDescriptor = new JspDescriptorType();
297
        JspDescriptorType jspDescriptor = new JspDescriptorType();
298
        jspDescriptor.setKeepgenerated(true);
298
        jspDescriptor.setKeepgenerated(true);
299
        jspDescriptor.setDebug(true);
299
        webLogicWebApp.setJspDescriptor(new JspDescriptorType[] {jspDescriptor});
300
        webLogicWebApp.setJspDescriptor(new JspDescriptorType[] {jspDescriptor});
300
        return webLogicWebApp;
301
        return webLogicWebApp;
301
    }
302
    }
(-)a/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/optional/WLFindJSPServlet.java (-4 / +28 lines)
Lines 48-54 Link Here
48
import java.util.logging.Logger;
48
import java.util.logging.Logger;
49
import javax.management.MBeanServerConnection;
49
import javax.management.MBeanServerConnection;
50
import javax.management.ObjectName;
50
import javax.management.ObjectName;
51
import org.netbeans.modules.j2ee.deployment.plugins.spi.FindJSPServlet;
51
import org.netbeans.modules.j2ee.deployment.plugins.spi.FindJSPServlet2;
52
import org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport;
52
import org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport;
53
import org.netbeans.modules.j2ee.weblogic9.WLPluginProperties;
53
import org.netbeans.modules.j2ee.weblogic9.WLPluginProperties;
54
import org.netbeans.modules.j2ee.weblogic9.deploy.WLDeploymentManager;
54
import org.netbeans.modules.j2ee.weblogic9.deploy.WLDeploymentManager;
Lines 58-64 Link Here
58
 * @author Petr Hejl
58
 * @author Petr Hejl
59
 */
59
 */
60
// FIXME user can configure the directory for JSP servlets
60
// FIXME user can configure the directory for JSP servlets
61
public class WLFindJSPServlet implements FindJSPServlet {
61
public class WLFindJSPServlet implements FindJSPServlet2 {
62
62
63
    private static final Logger LOGGER = Logger.getLogger(WLFindJSPServlet.class.getName());
63
    private static final Logger LOGGER = Logger.getLogger(WLFindJSPServlet.class.getName());
64
64
Lines 70-75 Link Here
70
70
71
    @Override
71
    @Override
72
    public File getServletTempDirectory(String moduleContextPath) {
72
    public File getServletTempDirectory(String moduleContextPath) {
73
        // XXX should it be always existing directory ?
73
        ApplicationDescriptor desc = getApplicationDescriptor(moduleContextPath);
74
        ApplicationDescriptor desc = getApplicationDescriptor(moduleContextPath);
74
        if (desc == null) {
75
        if (desc == null) {
75
            return null;
76
            return null;
Lines 87-93 Link Here
87
                    // FIXME multiple subdirs - what does that mean
88
                    // FIXME multiple subdirs - what does that mean
88
                    File servletDir = new File(subdir, "jsp_servlet"); // NOI18N
89
                    File servletDir = new File(subdir, "jsp_servlet"); // NOI18N
89
                    if (servletDir.exists() && servletDir.isDirectory()) {
90
                    if (servletDir.exists() && servletDir.isDirectory()) {
90
                        return servletDir;
91
                        // FIXME make simpler
92
                        return servletDir.getParentFile();
91
                    }
93
                    }
92
                }
94
                }
93
            }
95
            }
Lines 104-110 Link Here
104
        String[] parts = fixedJspResourcePath.split("/"); // NOI18N
106
        String[] parts = fixedJspResourcePath.split("/"); // NOI18N
105
        String jspFile = parts[parts.length - 1];
107
        String jspFile = parts[parts.length - 1];
106
108
107
        StringBuilder result = new StringBuilder();
109
        StringBuilder result = new StringBuilder("jsp_servlet/"); // NOI18N
108
        for (int i = 0; i < (parts.length - 1); i++) {
110
        for (int i = 0; i < (parts.length - 1); i++) {
109
            result.append("_").append(parts[i]).append("/"); // NOI18N
111
            result.append("_").append(parts[i]).append("/"); // NOI18N
110
        }
112
        }
Lines 120-125 Link Here
120
    }
122
    }
121
123
122
    @Override
124
    @Override
125
    public String getServletBasePackageName(String moduleContextPath) {
126
        return "jsp_servlet"; // NOI18N
127
    }
128
129
    @Override
130
    public String getServletSourcePath(String moduleContextPath, String jspRelativePath) {
131
        StringBuilder builder = new StringBuilder("jsp_servlet/"); // NOI18N
132
        String parts[] = jspRelativePath.split("/"); // NOI18N
133
        for (int i = 0; i < parts.length; i++) {
134
            String part = parts[i];
135
            if (part.length() > 0 && i < (parts.length - 1)) {
136
                builder.append("_"); // NOI18N
137
            }
138
            builder.append(part);
139
            if (i < (parts.length - 1)) {
140
                builder.append("/"); // NOI18N
141
            }
142
        }
143
        return builder.toString();
144
    } 
145
146
    @Override
123
    public String getServletEncoding(String moduleContextPath, String jspResourcePath) {
147
    public String getServletEncoding(String moduleContextPath, String jspResourcePath) {
124
        return "UTF8"; // NOI18N
148
        return "UTF8"; // NOI18N
125
    }
149
    }
(-)a/j2eeserver/nbproject/project.properties (-1 / +1 lines)
Lines 42-48 Link Here
42
42
43
is.autoload=true
43
is.autoload=true
44
javac.source=1.6
44
javac.source=1.6
45
spec.version.base=1.74.0
45
spec.version.base=1.75.0
46
46
47
javadoc.arch=${basedir}/arch.xml
47
javadoc.arch=${basedir}/arch.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
(-)a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/JSPServletFinder.java (+28 lines)
Lines 46-51 Link Here
46
46
47
import java.beans.PropertyChangeListener;
47
import java.beans.PropertyChangeListener;
48
import java.io.File;
48
import java.io.File;
49
import org.netbeans.api.annotations.common.CheckForNull;
49
import org.netbeans.api.project.FileOwnerQuery;
50
import org.netbeans.api.project.FileOwnerQuery;
50
import org.netbeans.api.project.Project;
51
import org.netbeans.api.project.Project;
51
import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
52
import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
Lines 54-59 Link Here
54
import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry;
55
import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry;
55
import org.netbeans.modules.j2ee.deployment.impl.ServerString;
56
import org.netbeans.modules.j2ee.deployment.impl.ServerString;
56
import org.netbeans.modules.j2ee.deployment.plugins.spi.FindJSPServlet;
57
import org.netbeans.modules.j2ee.deployment.plugins.spi.FindJSPServlet;
58
import org.netbeans.modules.j2ee.deployment.plugins.spi.FindJSPServlet2;
57
import org.netbeans.modules.j2ee.deployment.plugins.spi.OldJSPDebug;
59
import org.netbeans.modules.j2ee.deployment.plugins.spi.OldJSPDebug;
58
import org.openide.filesystems.FileObject;
60
import org.openide.filesystems.FileObject;
59
61
Lines 172-177 Link Here
172
        return find.getServletEncoding(webURL, jspResourcePath);
174
        return find.getServletEncoding(webURL, jspResourcePath);
173
    }
175
    }
174
 
176
 
177
    @CheckForNull
178
    public String getServletBasePackageName() {
179
        FindJSPServlet find = getServletFinder();
180
        if (!(find instanceof FindJSPServlet2)) {
181
            return null;
182
        }
183
        String webURL = getWebURL();
184
        if (webURL == null) {
185
            return null;     
186
        }
187
        return ((FindJSPServlet2) find).getServletBasePackageName(webURL);
188
    }
189
    
190
    @CheckForNull
191
    public String getServletSourcePath(String jspRelativePath) {
192
        FindJSPServlet find = getServletFinder();
193
        if (!(find instanceof FindJSPServlet2)) {
194
            return null;
195
        }
196
        String webURL = getWebURL();
197
        if (webURL == null) {
198
            return null;     
199
        }
200
        return ((FindJSPServlet2) find).getServletSourcePath(webURL, jspRelativePath);
201
    }    
202
    
175
    public OldJSPDebug.JspSourceMapper getSourceMapper(String jspResourcePath) {
203
    public OldJSPDebug.JspSourceMapper getSourceMapper(String jspResourcePath) {
176
        // PENDING
204
        // PENDING
177
        return null;
205
        return null;
(-)128b8fb9d391 (+76 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.j2ee.deployment.plugins.spi;
44
45
/**
46
 * Extends the functionality of {@link FindJSPServlet} by defining
47
 * the package name of the compiled JSPs and the prefix of source
48
 * path. In order to use it return implementation of this class from
49
 * {@link OptionalDeploymentManagerFactory#getFindJSPServlet(javax.enterprise.deploy.spi.DeploymentManager)}.
50
 *
51
 * @author Petr Hejl
52
 * @since 1.75
53
 */
54
public interface FindJSPServlet2 extends FindJSPServlet {
55
56
    /**
57
     * Returns the package name of compiled JSPs.
58
     * 
59
     * @param moduleContextPath the context path
60
     * @return package name of compiled JSPs
61
     */
62
    String getServletBasePackageName(String moduleContextPath);
63
    
64
    /**
65
     * Returns the relative source of the JSP reported in class file. For
66
     * example the JSP in web root is "index.jsp", but the server compile it as
67
     * coming from "jsp_servlet/index.jsp". This method should return
68
     * "jsp_servlet/index.jsp".
69
     * 
70
     * @param moduleContextPath the context path
71
     * @param jspRelativePath the relative path of the JSP
72
     * @return prefix of the source path reported in class file
73
     */
74
    String getServletSourcePath(String moduleContextPath, String jspRelativePath);
75
    
76
}
(-)a/web.debug/nbproject/project.xml (+1 lines)
Lines 77-82 Link Here
77
                    <compile-dependency/>
77
                    <compile-dependency/>
78
                    <run-dependency>
78
                    <run-dependency>
79
                        <release-version>4</release-version>
79
                        <release-version>4</release-version>
80
                        <specification-version>1.75</specification-version>
80
                    </run-dependency>
81
                    </run-dependency>
81
                </dependency>
82
                </dependency>
82
                <dependency>
83
                <dependency>
(-)a/web.debug/src/org/netbeans/modules/web/debug/EngineContextProviderImpl.java (-2 / +31 lines)
Lines 49-57 Link Here
49
import java.net.MalformedURLException;
49
import java.net.MalformedURLException;
50
import java.util.Arrays;
50
import java.util.Arrays;
51
import java.util.HashSet;
51
import java.util.HashSet;
52
import java.util.Iterator;
53
import java.util.List;
52
import java.util.Set;
54
import java.util.Set;
53
import java.util.logging.Level;
55
import java.util.logging.Level;
54
import java.util.logging.Logger;
56
import java.util.logging.Logger;
57
import org.netbeans.api.debugger.DebuggerManager;
55
import org.netbeans.spi.debugger.jpda.SourcePathProvider;
58
import org.netbeans.spi.debugger.jpda.SourcePathProvider;
56
59
57
60
Lines 70-76 Link Here
70
        new String[] {
73
        new String[] {
71
            "org", // NOI18N
74
            "org", // NOI18N
72
            "org/apache", // NOI18N
75
            "org/apache", // NOI18N
73
            "org/apache/jsp" // NOI18N
76
            "org/apache/jsp", // NOI18N
77
            "jsp_servlet"
74
        }
78
        }
75
    ));
79
    ));
76
80
Lines 92-98 Link Here
92
        if ((relativePath == null) || (relativePath.endsWith(".java"))) {
96
        if ((relativePath == null) || (relativePath.endsWith(".java"))) {
93
           return null; 
97
           return null; 
94
        }
98
        }
95
        if (virtualFolders.contains (relativePath) || relativePath.startsWith("org/apache/jsp")) { // NOI18N
99
        if (virtualFolders.contains (relativePath)
100
                || relativePath.startsWith("org/apache/jsp")) { // NOI18N
96
            if (verbose) System.out.println ("ECPI(JSP):  fo virtual folder");
101
            if (verbose) System.out.println ("ECPI(JSP):  fo virtual folder");
97
102
98
            String userDir = System.getProperty("netbeans.user"); // NOI18N
103
            String userDir = System.getProperty("netbeans.user"); // NOI18N
Lines 125-133 Link Here
125
            LOGGER.log(Level.INFO, "Both netbeans.user and java.io.tmpdir properties are missing, returning null");
130
            LOGGER.log(Level.INFO, "Both netbeans.user and java.io.tmpdir properties are missing, returning null");
126
            return null;
131
            return null;
127
        }
132
        }
133
        // XXX terrible hack - in addition WL specific code
134
        if (relativePath.startsWith("jsp_servlet")) { // NOI18N
135
            SourcePathProvider provider = getDefaultContext();
136
            if (provider != null) {
137
                String path = relativePath.substring(11);
138
                path = path.replaceAll("/_", "/"); // NOI8N
139
                if (path.startsWith("/")) {
140
                    path = path.substring(1);
141
                }
142
                return provider.getURL(path, global);
143
            }
144
        }
128
        return null;
145
        return null;
129
    }
146
    }
130
147
148
    private static SourcePathProvider getDefaultContext() {
149
        List providers = DebuggerManager.getDebuggerManager().
150
                lookup("netbeans-JPDASession", SourcePathProvider.class);
151
        for (Iterator it = providers.iterator(); it.hasNext(); ) {
152
            Object provider = it.next();
153
            // Hack - find our provider:
154
            if (provider.getClass().getName().equals("org.netbeans.modules.debugger.jpda.projects.SourcePathProviderImpl")) {
155
                return (SourcePathProvider) provider;
156
            }
157
        }
158
        return null;
159
    }    
131
    
160
    
132
    /**
161
    /**
133
     * Returns relative path for given url.
162
     * Returns relative path for given url.
(-)a/web.debug/src/org/netbeans/modules/web/debug/actions/JspToggleBreakpointActionProvider.java (-4 / +2 lines)
Lines 103-114 Link Here
103
        }
103
        }
104
104
105
        //#issue 65969 fix:
105
        //#issue 65969 fix:
106
        //we allow bp setting only if the file is JSP or TAG file and target server of it's module is NOT WebLogic 9;
106
        //we allow bp setting only if the file is JSP or TAG file
107
        //TODO it should be solved by adding new API into j2eeserver which should announce whether the target server
107
        //TODO it should be solved by adding new API into j2eeserver which should announce whether the target server
108
        //supports JSP debugging or not
108
        //supports JSP debugging or not
109
        String serverID = Utils.getTargetServerID(fo);
109
        setEnabled(ActionsManager.ACTION_TOGGLE_BREAKPOINT, owner != null && webRoot != null && isJsp);
110
111
        setEnabled(ActionsManager.ACTION_TOGGLE_BREAKPOINT, owner != null && webRoot != null && isJsp && !"WebLogic9".equals(serverID)); //NOI18N
112
        if ( debugger != null && 
110
        if ( debugger != null && 
113
             debugger.getState () == debugger.STATE_DISCONNECTED
111
             debugger.getState () == debugger.STATE_DISCONNECTED
114
        ) 
112
        ) 
(-)a/web.debug/src/org/netbeans/modules/web/debug/util/JspNameUtil.java (-5 / +11 lines)
Lines 45-50 Link Here
45
package org.netbeans.modules.web.debug.util;
45
package org.netbeans.modules.web.debug.util;
46
46
47
import java.util.Vector;
47
import java.util.Vector;
48
import org.netbeans.modules.j2ee.deployment.devmodules.api.JSPServletFinder;
48
49
49
/** Various utilities copied over from org.apache.jasper.JspUtil.
50
/** Various utilities copied over from org.apache.jasper.JspUtil.
50
 */
51
 */
Lines 177-193 Link Here
177
        return false;
178
        return false;
178
    }
179
    }
179
180
180
    public static String getServletResourcePath(String moduleContextPath, String jspResourcePath) {
181
    public static String getServletResourcePath(JSPServletFinder finder, String moduleContextPath, String jspResourcePath) {
181
        return getServletPackageName(jspResourcePath).replace('.', '/') + '/' +
182
        return getServletPackageName(finder, jspResourcePath).replace('.', '/') + '/' +
182
            getServletClassName(jspResourcePath) + ".java";
183
            getServletClassName(jspResourcePath) + ".java";
183
    }
184
    }
184
185
185
    private static String getServletPackageName(String jspUri) {
186
    private static String getServletPackageName(JSPServletFinder finder, String jspUri) {
186
        String dPackageName = getDerivedPackageName(jspUri);
187
        String dPackageName = getDerivedPackageName(jspUri);
188
        String basePackage = finder.getServletBasePackageName();
189
        if (basePackage == null) {
190
            basePackage = JSP_PACKAGE_NAME;
191
        }
187
        if (dPackageName.length() == 0) {
192
        if (dPackageName.length() == 0) {
188
            return JSP_PACKAGE_NAME;
193
            return basePackage;
189
        }
194
        }
190
        return JSP_PACKAGE_NAME + '.' + getDerivedPackageName(jspUri);
195
        
196
        return basePackage + '.' + getDerivedPackageName(jspUri);
191
    }
197
    }
192
    
198
    
193
    private static String getDerivedPackageName(String jspUri) {
199
    private static String getDerivedPackageName(String jspUri) {
(-)a/web.debug/src/org/netbeans/modules/web/debug/util/Utils.java (-7 / +23 lines)
Lines 137-144 Link Here
137
        return (url == null) ? null : url.toString();
137
        return (url == null) ? null : url.toString();
138
    }
138
    }
139
    
139
    
140
    public static String getJspPath(String url) {
140
    public static String getJspPath(String url) {       
141
       
142
        FileObject fo = getFileObjectFromUrl(url);
141
        FileObject fo = getFileObjectFromUrl(url);
143
        String jspRelativePath = url;
142
        String jspRelativePath = url;
144
        if (fo != null) {
143
        if (fo != null) {
Lines 146-154 Link Here
146
            if (wm != null)
145
            if (wm != null)
147
                jspRelativePath = FileUtil.getRelativePath(wm.getDocumentBase(), fo);
146
                jspRelativePath = FileUtil.getRelativePath(wm.getDocumentBase(), fo);
148
        }
147
        }
148
        JSPServletFinder finder = JSPServletFinder.findJSPServletFinder (fo);
149
        String translated = finder.getServletSourcePath(jspRelativePath);
150
        if (translated != null) {
151
            return translated;
152
        }
149
        
153
        
150
        return jspRelativePath;
154
        return jspRelativePath;
151
152
    }
155
    }
153
    
156
    
154
    public static String getServletClass(String url) {
157
    public static String getServletClass(String url) {
Lines 177-183 Link Here
177
180
178
        String servletPath = finder.getServletResourcePath(jspRelativePath);      
181
        String servletPath = finder.getServletResourcePath(jspRelativePath);      
179
        if (servletPath == null) // we don't have class name, so assume we are debugging tomcat or appsrv
182
        if (servletPath == null) // we don't have class name, so assume we are debugging tomcat or appsrv
180
                servletPath = JspNameUtil.getServletResourcePath(contextPath, jspRelativePath);
183
                servletPath = JspNameUtil.getServletResourcePath(finder, contextPath, jspRelativePath);
181
        if (servletPath != null) {
184
        if (servletPath != null) {
182
            servletPath = servletPath.substring(0, servletPath.length()-5); // length of ".java"
185
            servletPath = servletPath.substring(0, servletPath.length()-5); // length of ".java"
183
            servletPath = servletPath.replace('/', '.'); //NOI18N
186
            servletPath = servletPath.replace('/', '.'); //NOI18N
Lines 187-198 Link Here
187
    }
190
    }
188
191
189
    public static String getClassFilter(String url) {
192
    public static String getClassFilter(String url) {
193
        FileObject fo = getFileObjectFromUrl(url);
194
        if (fo == null) {
195
            return null;
196
        }
197
        JSPServletFinder finder = JSPServletFinder.findJSPServletFinder (fo);
198
        
190
        String filter = getServletClass(url);
199
        String filter = getServletClass(url);
191
        if (filter != null) {
200
        if (filter != null) {
192
            // get package only
201
            // get package only
193
            filter = filter.substring(0, filter.lastIndexOf('.')) + ".*"; //NOI18N
202
            int lastDot = filter.lastIndexOf('.');
194
            if (filter.startsWith("org.apache.jsp")) 
203
            if (lastDot > 0) {
195
                filter = "org.apache.jsp.*";
204
                filter = filter.substring(0, lastDot) + ".*"; //NOI18N
205
                String basePackageName = finder.getServletBasePackageName();
206
                if (basePackageName == null) {
207
                    basePackageName = "org.apache.jsp"; // NOI18N
208
                }
209
                if (filter.startsWith(basePackageName)) 
210
                    filter = basePackageName + ".*"; // NOI18N
211
            }
196
        }
212
        }
197
        return filter;
213
        return filter;
198
    }
214
    }

Return to bug 65969