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.

Bug 216797 - RESTful JavaScript Client wizard - wrong location of local libraries
Summary: RESTful JavaScript Client wizard - wrong location of local libraries
Status: VERIFIED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: Web Services Client (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords:
: 217662 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-08-13 12:52 UTC by Jiri Skrivanek
Modified: 2012-09-10 13:23 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2012-08-13 12:52:48 UTC
Site root folder is not taken into account when creating local libraries. It is hard coded to js/libs. Additionally html file target folder should be Site root by default. To reproduce:

- Create Web Project with GF as a target server.
- Use RESTful from Web Service from Database.
- Select f.e. MANUFACTURER table in the wizard.
- finish the wizard
- open new project wizard
- select "HTML/JavaScript|HTML Application"
- finish the wizard with defaults
- right-click Site Root node and choose "New|RESTful JavaScript Client"
- click Browse to select "REST Project Resource"
- choose previously created web service
- check "Add Backbone.js to project sources"
- click Next
- type "public_html" as target folder - here should be also Browse button to be able to select target folder and Site root should be default value
- click Finish
- JavaScript libraries are created in project/js/libs and they are not shown in projects view
- references in html file are broken:

        <script src='null'></script>
        <script src='null'></script>
        <script src='null'></script>
        <script src='RestClient.js'></script>

Product Version: NetBeans IDE Dev (Build EaselCSS-482-on-20120813)
Java: 1.7.0_06; Java HotSpot(TM) 64-Bit Server VM 23.2-b09
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
Comment 1 Petr Jiricka 2012-08-31 08:54:31 UTC
*** Bug 217662 has been marked as a duplicate of this bug. ***
Comment 2 Petr Jiricka 2012-09-05 20:42:39 UTC
Related bug 216789 is now fixed - Denis, could you please look at this now? This will be needed in the demo that John will be showing tomorrow evening, so this is quite high priority. Thanks.
Comment 3 Denis Anisimov 2012-09-06 08:38:42 UTC
Partial fix :
web-main6f5b5671afd8

prevents to produce null values.
Comment 4 Denis Anisimov 2012-09-06 11:33:39 UTC
Correction:
web-main#52db3847a6c5
Comment 5 Denis Anisimov 2012-09-06 15:13:37 UTC
There is a related issue #217958 because libraries generation are implemented 
in the same way as for project wizard.
Comment 6 Denis Anisimov 2012-09-06 16:01:46 UTC
web-main#0d0c34e461c7
Fix for issue #216789 cannot be applied to this issue. The fix has to be improved.
Comment 7 David Konecny 2012-09-07 01:33:06 UTC
Denis,

this change:

---
3.7 -    public static final String LIBS = "js/libs";       // NOI18N
3.8 +    public static final String LIBS = "public_html/js/libs";       // NOI18N
---

is not correct. The path should stay "js/libs" as the path is relative to project's site root. To get Site Root you need to do:

ProjectUtils.getSources(project).getSourceGroups(WebClientProjectConstants.SOURCES_TYPE_HTML5);

(I just added the API: f7072a63ba00)(and btw. note also: 965c207929de, a16eb17ff8fb)

That will give you root folder for sources.

As for "js/libs" - at the moment this is just hardcoded location. Tomas, what do you think? Should we store it in some project property if user changes it.
Comment 8 Quality Engineering 2012-09-07 02:10:55 UTC
Integrated into 'main-golden', will be available in build *201209070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6f5b5671afd8
User: Denis Anisimov <ads@netbeans.org>
Log: Basic correction for BZ#216797.
Comment 9 Tomas Mysik 2012-09-07 04:04:47 UTC
(In reply to comment #7)
> As for "js/libs" - at the moment this is just hardcoded location. Tomas, what
> do you think? Should we store it in some project property if user changes it.

From what I know (new project wizard, project properties), I would not store it. The only reason to store the value now could be to remember the last location user used.

For JavaScript Files (in Project Properties), all the JS files in the project are found and listed; if one want to add a new JS library, (s)he can specify the path in the same dialog - that is IMHO OK (user can later move his/her JS libraries directly in the Projects view - how can we notice that?)
Comment 10 Denis Anisimov 2012-09-07 07:02:50 UTC
(In reply to comment #7)
> Denis,
> 
> this change:
> 
> ---
> 3.7 -    public static final String LIBS = "js/libs";       // NOI18N
> 3.8 +    public static final String LIBS = "public_html/js/libs";       //
> NOI18N
> ---
> 
> is not correct. The path should stay "js/libs" as the path is relative to
> project's site root. To get Site Root you need to do:
> 
> 
I absolutely agree with you.
But I didn't know how to get libraries path via API. 
I will correct the code.
Thanks you.
Comment 11 Denis Anisimov 2012-09-07 07:18:44 UTC
web-main#0eb9f50c0fa4
Comment 12 Quality Engineering 2012-09-08 02:06:20 UTC
Integrated into 'main-golden', will be available in build *201209080001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/0eb9f50c0fa4
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#216797 - RESTful JavaScript Client wizard - wrong location of local libraries