Re: CompressedResourceReference: can't get resource-url of static html in package

2007-09-09 Thread Eelco Hillenius
 YOU GUESS WHAT?!!
 I JUST RENAMED THE FILE TO dialogTable.htm AND NOW IT IS WORKING!!
 it is the fact of not being able to serve html-files!
 is there a way to change this behaviour or is it an absolute necessary
 security feature?

Yes, this *was* a security feature.The feature can be configured using
IResourceSettings#setPackageResourceGuard. Older versions of Wicket
blocked .html by default, but later we decided that was too much. Now
it only blocks .properties, .class and .java by default. So, like Kent
said, upgrade to a newer Wicket version and your problem is gone. Or
set a custom guard.

Btw, you can learn a lot from following the trace. Part of the error trace:

wicket.markup.html.PackageResource$PackageResourceBlockedException: package
resource wicket/extensions/markup/html/form/wysiwyg/res/dialogTable.html may
not be accessed
   at wicket.markup.html.PackageResource.init(PackageResource.java:489)
   at
wicket.markup.html.CompressedPackageResource.init(CompressedPackageResource.java:51)
...

if you look in the source of PackageResource, around line 489, you can see:

IPackageResourceGuard guard = 
Application.get().getResourceSettings()
.getPackageResourceGuard();
if (!guard.accept(scope, path))
{
throw new PackageResourceBlockedException(package 
resource  +
absolutePath +
 may not be accessed);
}


Don't be afraid of the code, it might save you time and annoyances :-)

If you are using Maven + Eclipse, you can put this in the build
section of your pom:

plugins
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-eclipse-plugin/artifactId
configuration
downloadSourcestrue/downloadSources
/configuration
/plugin

so that mvn eclipse:eclipse will try to download any source jars
(Wicket is typically distributed with them) and make them available to
your projects. Maven plugins for other IDEs might have similar
facilities.

Regards,

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



CompressedResourceReference: can't get resource-url of static html in package

2007-09-07 Thread pixotec

I think this will be an easy problem for you all...

I want to create a new component for wicket-extensions: it is a already
working wysiwyg-textarea.
I packaged it like this:

wicket.extensions.markup.html.form.wysiwyg
- WysiwygTextarea.java
- WysiwygTextarea.html
wicket.extensions.markup.html.form.wysiwyg.res
- btnBold_off.gif
- ...
- btnUnorderedList_off.gif
- dialogTable.html
- wysiwygTextarea.js

I made ResourceReferences for all GIFs and added them as Image to the
component's panel.
I added the wysiwygTextarea.js as CompressedResourceReference with
HeaderContributor.forJavaScript.
They all work fine.

the same I wanted to do with dialogTable.html (a static html page containing
no wicket stuff) like this:

- I need the url to this page in WysiwygTextarea.html as javascript variable
'dialogTableUrl' (defined in head):
function openTableDialog() {
var dialog = window.open(dialogTableUrl, Tabelle,
status=no,modal=yes,width=350,height=150);
  }

so I tried
private static final CompressedResourceReference DIALOG_TABLE_HTML = new
CompressedResourceReference(
WysiwygTextarea.class, res/dialogTable.html);

and in onAttach() method (beside other things needed to be here):
StringBuffer js = new StringBuffer();
js.append(JavascriptUtils.SCRIPT_OPEN_TAG);
CharSequence charSequence =
RequestCycle.get().urlFor(DIALOG_TABLE_HTML);
js.append(var dialogTableUrl=' + charSequence.toString() + ';);
js.append(JavascriptUtils.SCRIPT_CLOSE_TAG);
add(new StringHeaderContributor(js.toString()));

but I get:
07.09.2007 21:48:26 wicket.RequestCycle step
SCHWERWIEGEND: package resource
wicket/extensions/markup/html/form/wysiwyg/res/dialogTable.html may not be
accessed
wicket.markup.html.PackageResource$PackageResourceBlockedException: package
resource wicket/extensions/markup/html/form/wysiwyg/res/dialogTable.html may
not be accessed
at wicket.markup.html.PackageResource.init(PackageResource.java:489)
at
wicket.markup.html.CompressedPackageResource.init(CompressedPackageResource.java:51)
at
wicket.markup.html.CompressedPackageResource.get(CompressedPackageResource.java:83)
at
wicket.markup.html.resources.CompressedResourceReference.newResource(CompressedResourceReference.java:49)
at wicket.ResourceReference.bind(ResourceReference.java:149)
at
wicket.ResourceReference.getSharedResourceKey(ResourceReference.java:231)
at wicket.RequestCycle.urlFor(RequestCycle.java:746)
at wicket.RequestCycle.urlFor(RequestCycle.java:730)
at
wicket.extensions.markup.html.form.wysiwyg.WysiwygTextarea.onAttach(WysiwygTextarea.java:104)

How to output the Url to the packaged html page in WysiwygTextarea.html
without bothering (adding code to) the application using the new wysiwyg
component?
-- 
View this message in context: 
http://www.nabble.com/CompressedResourceReference%3A-can%27t-get-resource-url-of-static-html-in-package-tf4403564.html#a12562566
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]