I'm curious as to how the IntelliJ debugger uses the domain.xml of my glassfish server and reports a webpage when requested.
Specifically, I have an IntelliJ project called blobGame that uses a Glassfish server that opens a webpage called blobGame when the artifacts .war and .ear are deployed.
Firstly, how are these artifacts deployed? When I deploy them, I MUST have the URL of the localhost be http://localhost:60836/blobGame_war_exploded, and localhost:60836/blobGame DOES NOT WORK, even if I change it in the debug configuration - here is my debugger info
Why is this? Why does the url have to be /blobGame_war_exploded? It cannot even be /blobGame_ear_exploded, as I see that also in the domain.xml.
Here is the snippet of domain.xml for my domain called "domain2":
<applications>
<application object-type="user" name="blobGame_ear_exploded" directory-deployed="true" location="file:/C:/Users/Kevin/EECS/blobGame/out/artifacts/blobGame_ear_exploded/">
<property name="archiveType" value="ear"></property>
<property name="isComposite" value="true"></property>
<property name="appLocation" value="file:/C:/Users/Kevin/EECS/blobGame/out/artifacts/blobGame_ear_exploded/"></property>
<property name="org.glassfish.ejb.container.application_unique_id" value="98074431158681600"></property>
<property name="defaultAppName" value="blobGame_ear_exploded"></property>
<module name="web.war">
<engine sniffer="ejb"></engine>
<engine sniffer="security"></engine>
<engine sniffer="weld"></engine>
<engine sniffer="web"></engine>
</module>
<engine sniffer="ear"></engine>
</application>
<application context-root="/blobGame_war_exploded" object-type="user" name="blobGame_war_exploded" directory-deployed="true" location="file:/C:/Users/Kevin/EECS/blobGame/out/artifacts/blobGame_war_exploded/">
<property name="archiveType" value="war"></property>
<property name="appLocation" value="file:/C:/Users/Kevin/EECS/blobGame/out/artifacts/blobGame_war_exploded/"></property>
<property name="org.glassfish.ejb.container.application_unique_id" value="98074431158812672"></property>
<property name="defaultAppName" value="blobGame_war_exploded"></property>
<module name="blobGame_war_exploded">
<engine sniffer="ejb"></engine>
<engine sniffer="security"></engine>
<engine sniffer="weld"></engine>
<engine sniffer="web"></engine>
</module>
</application>
</applications>
SECOND of all, why does the deployment still use previous artifacts (as I assume they are) when I redeploy or restart the server?
Specifically, when I press restart, I get the exact same HTML and javascript files I was left with before, and even if I edited the html or JS files during the time before my second debug.
(I add alert("test") in the new debug, but it does not show up in the new debug. When I access the index.html page independently the alert does show up).
Here is the index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>keyBoardDemo</title>
</head>
<body>
<canvas id="canvas" width="800" height="600" style="border:1px solid #000000;"></canvas>
<p id="main"></p>
<script type="text/javascript" src=resources.js></script>
<script type="text/javascript" src=canvas.js></script>
<script type="text/javascript" src=keyboard.js></script>
<script type="text/javascript" src=packethandler.js></script>
<script type="text/javascript" src=player.js></script>
<script type="text/javascript" src=websocket.js></script>
</body>
</html>
and here is the canvas.js that it calls:
alert("test 123"); //this is not called on the second redeployment!
var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
Firstly, how are these artifacts deployed? When I deploy them, I MUST have the URL ...
By default, IDEA computes context root from the artifact name, by replacing unsupported characters with underscores. Thus, the 'blobGame:war exploded' artifact, by default gets 'blobGame_war_exploded' context root.
To change the context root for the artifact, you may want to open the 'Deployment' tab of the run configuration, check 'Use custom context root' and enter the desired value into the field
'Open browser' field on the 'Server' tab does not affect the server settings, it just allows you to open whatever URL you like after the server start. The field value defaults to the URL computed from the first artifact, but once user have changed it IDEA assumes that user knows better.
Specifically, when I press restart, I get the exact same HTML and javascript files I was left with before, ...
The expected sequence is as follows:
make a change to a resource
update the application on the server with the mentioned 'Update <> application' action: 'Update resource' choice should be enough for an exploded application, redeploy/restart may be needed for archive artifact
reload (refresh) the page, that uses the resource in browser
I suspect you're missing the last (3) step. Please note, step (2) only updates the resource on the server, and to see a change in browser (on client) you should reload the corresponding resources from server by refreshing the page manually.
Hope that helps,
I am going to redirect your second post to this answer
Related
I'm developing a Firefox add-on. When I run it, I open up the browser console and it says, AMO_Uedit_Beta_Firefox is not defined :browser.xul.
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://Uedit/skin/skin.css" type="text/css"?>
<!DOCTYPE Uedit SYSTEM "chrome://Uedit/locale/translations.dtd">
<overlay id="Uedit-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="Uedit.js" />
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="Uedit" class="toolbarbutton-1" label="Edit HTML" tooltiptext="Edit HTML" oncommand="AMO_Uedit_Beta_Firefox.Uedit()" />
</toolbarpalette>
</overlay>
The toolbar button that calls a function which is part of an object (AMO_Uedit_Beta_Firefox).
I double-checked the names and they both match. Is it because the script doesn't load properly? I'm sure it's not that variable names can't start with capital letters.
var AMO_Uedit_Beta_Firefox={ // This is for "wrapping the loose variables."
Both the file's references are the exact same. Could it be because the script didn't load at all?
<toolbarbutton id="Uedit" class="toolbarbutton-1" label="Edit HTML" tooltiptext="Edit HTML" oncommand="AMO_Uedit_Beta_Firefox.Uedit()" />
I tried changing the relative URL (<script src="Uedit.js" />) to an absolute URL (<script src="chrome://Uedit/Uedit.js" />) in the browser.xul, but now it just returns a blank error message.
Weird blank error message.
These errors cause the rest of the add-on to not work at all, so I can't continue developing it until this is fixed. What're some possible solutions?
EDIT:
I figured out a solution. I have to put a line of JavaScript before the first statement.
var AMO_Uedit_Beta_Firefox = { // Will not work!
...
If I put a console.log in the front, for example.
console.log("");
var AMO_Uedit_Beta_Firefox = { // This will work!
...
The only question is, why does this work?
It looks like the path to the Uedit.js file is wrong. You should use an absolute path in your xul overlay.
As erikvold has said, the link to your Uedit.js script is wrong. This is the minimum that is wrong and is the thing that is complained about in the console: browser.xul:5 is line 5 in browser.xul, which is:
<script src="Uedit.js" />
You state that you have tried:
<script src="chrome://Uedit/Uedit.js" />
That will not work. At a minimum, it should be something like:
<script src="chrome://Uedit/content/Uedit.js" type="application/x-javascript" />
Note the content/ after //Uedit/. However, that being correct assumes you have set up your chrome.manifest with an appropriate content line in addition to the other ones implied by your code (skin and locale). It also assumes that Uedit.js is in that directory. Assuming that the directory structure of your add-on is normal, the content line in your chrome.manifest file would look something like:
content Uedit chrome/content/
As to it actually working, there is no way for us to know if it will work as you have not included the source code that defines all of AMO_Uedit_Beta_Firefox and specifically not AMO_Uedit_Beta_Firefox.Uedit(). For instance, in addition to the above problem, there could easily be a syntax error that prevents the script from loading. Such a syntax error would cause the console to report that AMO_Uedit_Beta_Firefox was undefined when you attempt to execute AMO_Uedit_Beta_Firefox.Uedit() as the code for the toolbarbutton's oncommand.
You can easily test to see if your Uedit.js script is loading by having something print in the console when the script loads (i.e. outside the definition of AMO_Uedit_Beta_Firefox).
I figured out a solution. I have to put a line of JavaScript before the first statement.
var AMO_Uedit_Beta_Firefox = { // Will not work!
...
If I put a console.log in the front, for example.
console.log("foo bar");
var AMO_Uedit_Beta_Firefox = { // This will work!
...
I solved the problem myself, although the solution is strange.
I have started a new project - javascript - windows universal app and without changing anything or adding any code I try to build it and run it but it wont with the following error:
Error : DEP0700 : Registration of the app failed. error 0x80080204: App manifest validation error: The document root element m:Package must be defined in the http://schemas.microsoft.com/appx/2010/manifest namespace. (0x80080204) App7
A similar issue was reported here and I tried renewing the license with project -> store -> aquire developer license to no avail. It seems to be that the actual problem has to be the document root element part which I'm not really familiar with as I haven't worked with Visual Studio before I tried to add xmlns:m="http://schemas.microsoft.com/appx/2010/manifest" to my package appxmanifest but that doesn't seem to have helped.
Heres the whole manifest:
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:m="http://schemas.microsoft.com/appx/2010/manifest"
IgnorableNamespaces="uap mp m">
<Identity
Name="155dc546-80c7-4275-b2a6-a2aa8ddec5f7"
Version="1.0.0.0"
Publisher="CN=FroboZ" />
<mp:PhoneIdentity PhoneProductId="155dc546-80c7-4275-b2a6-a2aa8ddec5f7" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>App7</DisplayName>
<PublisherDisplayName>FroboZ</PublisherDisplayName>
<Logo>images\storelogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10069.0" MaxVersionTested="10.0.10069.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application
Id="App"
StartPage="default.html">
<uap:VisualElements
DisplayName="App7"
Description="App7"
BackgroundColor="#464646"
Square150x150Logo="images\Logo.png"
Square44x44Logo="images\SmallLogo.png">
<uap:SplashScreen Image="images\splashscreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>
Thank you for taking your time to read my question and even more so if you can help me with this problem!
Developer mode wasn't turned on in windows 10. I'm not sure what difference this makes but after turning this on I was able to build the project.
I'm trying to use pyjamas (http://pyjs.org/). My input file, named hi.py, looks like this:
from pyjamas import Window
from pyjamas.ui import RootPanel, Button
from pyjamas.ui import HTML
def greet(sender):
Window.alert("Hello!")
b = Button("Click me", greet)
RootPanel().add(b)
I run the following command:
python ~/pyjs-pyjs-07f54ad/bin/pyjsbuild hi.py
Building : hi
PYJSPATH : [
/Users/michaelnatkin/HelloPyjs
/Users/michaelnatkin/pyjs-pyjs-07f54ad/library
/Users/michaelnatkin/pyjs-pyjs-07f54ad/addons
]
Built to : /Users/michaelnatkin/HelloPyjs/output
Which appears to run without errors, and here is my resulting directory:
Michael-Natkins-MacBook-Pro-2:HelloPyjs michaelnatkin$ ls .
hi.js hi.py output
Michael-Natkins-MacBook-Pro-2:HelloPyjs michaelnatkin$ ls output
__init__.py gchart.gif hi.safari.cache.html
_pyjs.js hi.html history.html
bootstrap.js hi.ie6.cache.html tree_closed.gif
bootstrap_progress.js hi.mozilla.cache.html tree_open.gif
disclosurePanelClosed.png hi.nocache.html tree_white.gif
disclosurePanelClosed_rtl.png hi.oldmoz.cache.html
disclosurePanelOpen.png hi.opera.cache.html
I then direct my browser to one of the html files: file:///Users/michaelnatkin/HelloPyjs/output/hi.html
and I get... a blank page. The only error in my js console is:
Uncaught SecurityError: Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.
which I guess isn't too surprising since the html file says:
<html>
<!-- auto-generated html - You should consider editing and adapting this
to suit your requirements. No doctype used here to force quirks mode; see
wiki for details: http://pyjs.org/wiki/csshellandhowtodealwithit/
-->
<head>
<title>hi (Pyjamas Auto-Generated HTML file)</title>
<meta name="pygwt:module" content="hi">
</head>
<body style="background-color:white">
<script type="text/javascript" src="bootstrap.js"></script>
<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
<script type="text/javascript" src="bootstrap.js"></script>
<iframe id="__pygwt_historyFrame" style="display:none;"></iframe>
</body>
</html>
So.. I'm completely stuck. Can someone tell me how to get this bad boy to produce output? I've got a much more complicated app I want to create, but if I can't say "Hello" it isn't going to go well. Thank you!
Have you tried it in Firefox too? While nothing is displayed with Chrome, with Firefox I get an error message which comes from the way you import RootPanel and Button. You should replace your single line by:
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.Button import Button
After that your button greets me properly.
And regarding the Chrome issue, either launch it with --allow-file-access-from-files or run a local web server to display your page. More details there: https://github.com/pyjs/pyjs/wiki/googlechromeproblems
A content rendered from h:outText with escape="false" is not bound to the css or javascript applicable for that page. Actually I am trying to use syntax highlighters to highlight my syntax within a post. The post is stpored in database and displaying it in a JSF page with h:outputText tag by setting escape attribute as false. It renders the page as expected with all html tags being processed but css or javascript applicable to the code blocks within that post is not applied. Below is my jsf page which retrieves html from database and shows it through h:outputText tag. The retrieved content has syntax it needs to be highlighted.
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/templates/ui.xhtml">
<ui:define name="head">
<title>tekBytes-#{tutorialController.tut.title}</title>
<h:outputScript library="primefaces" name="jquery/jquery.js" />
<link href="/rainbow/themes/pastie.css" rel="stylesheet" type="text/css" />
<script src="/rainbow/rainbow.min.js"></script>
<script src="/rainbow/language/generic.js"></script>
<script src="/rainbow/language/java.js"></script>
<script src="/rainbow/language/css.js"></script>
<script type = "text/javascript">
/*
* do some jQuery magic on load
*/
$(document).ready(function() {
function showHiddenParagraphs() {
$("pre.hidden").fadeIn(500);
}
setTimeout(showHiddenParagraphs, 1000);
});
</script>
</ui:define>
<ui:define name="content">
<div style="margin:20px">
<h1>#{tutorialController.tut.title}</h1>
<br/>
<h:outputText value="#{tutorialController.tut.contentStr}" escape="false"/>
</div>
</ui:define>
</ui:composition>
In JSF 2.0, all your web resources files like css, images or
JavaScript, should put in “resources” folder, under the root of your
web application (same folder level with “WEB-INF“).
Put your js / css in resources/js and resources/css folder and access them with <h:outputStylesheet and <h:outputScript
Like this
<h:outputScript name="js/rainbow.min.js" />
and
<h:outputStylesheet name="css/language/css.js" />
and so on...
Also read this : Resources (Library) In JSF 2.0
Potential problem could be in number of places here , verify the following in order.
1) Check your CSS files are getting loaded by the browser
by monitoring the request in developer tools on Firefox or chrome.
https://developers.google.com/chrome-developer-tools/docs/overview?hl=fr
2) check the source of your html to see if that looks
fine and tags are not encoded etc.
3) verify your CSS to see it works and it doesn't have missing semicolon,
brackets,quotes etc by adding it to a test html page on your machine.
I got it resolved. The actual issue was that the html stored in database was generated through the p:editor which has put so many div tags around every line, so when it is rendered through h:outputText tag the css or javascript is not able to parse the code blocks that are applicable for syntax highlighting because of surrounded divs and other tags. So I have removed all of these unnecessary tags before storing it in the database. Thanks, everyone for the replies.
I've created a Firefox extension but I can't use it (nothing happens).
Does someone know why ?
The module hierarchy
my_firefox_extension
chrome.manifest
install.rdf
chrome/
content/
locale.html
overlay.js
sample.xul
The code
chrome.manifest
content firefox_extension chrome/content/
overlay chrome://browser/content/browser.xul chrome://firefox_extension/content/sample.xul
install.rdf
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>displaypages#bruno.com</em:id>
<em:name>Display the page locale</em:name>
<em:description>Welcome to this extension that displays the page locale when a user opens a new tab or windows</em:description>
<em:version>0.1</em:version>
<em:creator>Bruno Da Silva</em:creator>
<em:homepageURL>https://www.example.com</em:homepageURL>
<em:type>2</em:type>
<!-- Mozilla Firefox -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>4.0.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
sample.xul
<?xml version="1.0"?>
<overlay id="firefox_extension-browser-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://firefox_extension/content/overlay.js"/>
</overlay>
overlay.js
function Read(file)
{
var ioService=Components.classes["#mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var scriptableStream=Components
.classes["#mozilla.org/scriptableinputstream;1"]
.getService(Components.interfaces.nsIScriptableInputStream);
var channel=ioService.newChannel(file,null,null);
var input=channel.open();
scriptableStream.init(input);
var str=scriptableStream.read(input.available());
scriptableStream.close();
input.close();
return str;
}
gBrowser.addEventListener("DOMContentLoaded", function(e) {
var documentElement = e.originalTarget.defaultView.document;
var div = documentElement.createElement("div");
div.innerHTML = Read("chrome://firefox_extension/content/locale.html");
documentElement.body.appendChild(div);
});
locale.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Page displayed when a user opens a new tab or window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<p>Some text<p>
</body>
</html>
You missed one parameter which is probably causing the errors:
gBrowser.addEventListener("DOMContentLoaded", function(e) {
var documentElement = e.originalTarget.defaultView.document;
var div = documentElement.createElement("div");
div.innerHTML = Read("chrome://firefox_extension/content/locale.html");
documentElement.body.appendChild(div);
},
false // missing parameter on addEventListener
// add this and it might work
);
(Just guessing, no testing involved)
NS_ERROR_FILE_TARGET_DOES_NOT_EXIST might be caused by incorrect script file reference in sample.xul
<script type="application/x-javascript" src="chrome//firefox_extension/content/overlay.js"/>
src attribute is missing a colon after "chrome". It should be
src="chrome://firefox_extension/content/overlay.js"
The files in firefox could be corrected .
Try the following
Exit Firefox completely, then open your Firefox profile folder and delete or rename these files:
extensions.ini
extensions.cache
extensions.rdf
Starting in Firefox 4, also delete or rename:
extensions.sqlite
extensions.sqlite-journal (if found)
Note: Although the above files can be deleted, renaming them (e.g., "extensionsOLD.ini", "extensionsOLD.cache", etc.) is generally considered a safer option. This achieves the same result, but allows the user to retrieve any possibly required information from them later on.
Then try to restart the browser and install them
Else there is another method which may work (but dont know why/how they work)
Enable third party cookies - go to Tools -> Options -> Privacy and check the Accept third-party cookies box.
Does you extension work when using it in a live development environment, as opposed to having issues with the xpi installer?
With Firefox closed, create a
“pointer” file with the same name as
your extension’s Description:ID (as
found in your install.rdf) in profile
folder/extensions/ and edit it so that
it contains the path to your
extension’s folder (the root
containing containing install.rdf and
chrome.manifest files).
E.g. helloworld’s ID is
helloworld#mozilla.doslash.org and we
would like to register it in
X:\Dev\helloworld\ (i.e. there is
X:\Dev\helloworld\install.rdf file
etc.). Just put a single line into the
file at this path: profile
folder/extensions/helloworld#mozilla.doslash.org
X:\Dev\helloworld\ - note trailing
slash and no CR; this must be a SINGLE LINE
(Re)Start Firefox, and check that your
extension is installed.
This will help you make sure that the extension works, before you start tackling installation issues.