Search code examples
netbeansnetbeans-platformnetbeans-plugins

NetBeans showing "301 Moved Permanently" for AngularJS doc


NetBeans version 7.4

Showing "301 Moved Permanently", while I'm using AngularJS doc.

cause: as it it using

PARTIAL_DOC_URL_BASE=http://code.angularjs.org/1.0.7/docs/partials/api/ng.directive

and

DOC_URL_BASE=http://docs.angularjs.org/api/ng.directive: 

but the protocol has been changed from http to https. So it is showing this type of error.

Is there any fix/patch/hack available, which I can apply to my current NetBeans IDE to solve this issue?


Solution

  • Reffered to this Bug: http://hg.netbeans.org/web-main/rev/ffaeea96715a

    Just re-created the org-netbeans-modules-html-angular.jar


    NetBeans is using URLConnection and Reader class to get the doc from web. It first looks into the cache directory if it is available or fetches from web and writes the content to the Cache('ajs-doc' directory for Angular js).[for online doc]


    Steps:

    • Extracted the org-netbeans-modules-html-angular.jar using WinRar/7zip.

    • Decompiled the Directive.class using JD-GUI decompiler.(you can get the source from https://netbeans.org/community/sources/)

      [stored the Directive.java in Directive.class directory of the extracted files]

    • Changed old http link to https and doc version in Directive.java.

      [package org.netbeans.modules.html.angular.model;]

    • Compiled the Directive.java using org-netbeans-modules-html-editor-lib.jar and org-netbeans-api-annotations-common.jar


     javac -classpath [PATH to dir]\org-netbeans-modules-html-angular;org-netbeans-modules-html-editor-lib.jar;org-netbeans-api-annotations-common.jar [PATH to dir]\org-netbeans-modules-html-angular\org\netbeans\modules\html\angular\model\Directive.java
    
    • Created the jar file from the extracted classes[Directive.class is already replaced]

    jar -cvfm org-netbeans-modules-html-angular.jar * MANIFEST.MF
    

    [ Tested in Windows 7, NetBeans 7.4, JDK 7 ]

    [NetBeans: Help->About: to view Cache and User directory path]

    -> Closed the IDE

    -> Replaced the "org-netbeans-modules-html-angular.jar" file with the generated one in the netbeans modules directory.

      "C:\Program Files\NetBeans 7.4\ide\modules" and 
      "C:\Users\<Username>\AppData\Roaming\NetBeans\7.4\modules" 
    

    -> Removed the "ajs-doc" directory from the NetBeans Cache. [NetBeans is storing the temp doc files here]

     "C:\Users\<Username>\AppData\Local\NetBeans\Cache\7.4"
    

    -> Now started the IDE and typed "ng-app" in a div/body. used control+space to call the API-Doc window.

    Now its working. I can get the doc without any 301 error.