Re: Single page wicket app

2012-05-18 Thread armhold
Ajax calls do save the page state. I think the real issue for you is
that if users have the page open but idle for a long time (longer than
session expiration... 30 mins?) the Ajax links won't work for them
when they decide to start using the page again.

You could perhaps use a AjaxSelfUpdatingTimerBehavior to keep the
session open, if you can afford to have a session running for every
user with an open tab.

> Since the users will stay on a single page for a long time, and
> never go to a different page, do I need to be concerned with wicket
> not saving/serializing the page state?


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Single-page-wicket-app-tp4634756p4644559.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: a model for passing data between pages

2012-04-10 Thread armhold
Hi Dan,

Thanks, I didn't know about MetaDataKey- that cleans it up nicely:

public class SessionModel implements IModel
{
protected MetaDataKey key;

public SessionModel(MetaDataKey key)
{
this.key = key;
}

public SessionModel(MetaDataKey key, T object)
{
this.key = key;
setObject(object);
}

public T getObject()
{
return Session.get().getMetaData(key);
}

public void setObject(T object)
{
Session.get().setMetaData(key, object);
}

public void detach()
{
// no-op
}

}

And then in MyDTO:

public static final MetaDataKey KEY = new MetaDataKey() { };



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-model-for-passing-data-between-pages-tp4542878p4545388.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: a model for passing data between pages

2012-04-09 Thread armhold
Hi duesenklipper. 

> I'd rather use a custom Session subclass with typesafe getters and
> setters:

> class MySession extends WebSession {
>   private MyDTO dtoForFlow;
>   public MyDTO getDtoForFlow() {
> return dtoForFlow;
>   }

Typesafety via custom sessions is nice, but I think that would require
custom model classes for each kind of DTO in order to reach into the
session, like:

public class MyDTOModel implements IModel
{
public MyDTO getObject()
{
return ((MySession) Session.get()).getDtoForFlow();
}

public void setObject(MyDTO object)
{
((MySession) Session.get()).setDtoForFlow(object);
}

// ...
}

vs: 

SessionModel model = new SessionModel(MyDTO.KEY, new MyDTO());

Not typesafe, as you pointed out, but fairly concise.

> Alternatively you might want to look at the wicket-seam integration
> and use Seam conversations.

Actually we started out using Wicket-CDI + Seam, expressly because of
the conversation support, but ran into issues making it work on
WebSphere... a topic for another day. :-)

Thanks for your help.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-model-for-passing-data-between-pages-tp4542878p4544145.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



a model for passing data between pages

2012-04-09 Thread armhold
I have a use case where several pages of a flow need to edit a
DTO. Changes to the DTO (which may be an existing JPA Entity, or a
not-yet-persisted one) are saved at the end of the flow (assuming the
user clicks "save").

The user is allowed to navigate back-and-forth among the pages, so the
obvious trick of passing the modified DTO to the next page via its
constructor won't work- the back button will lead to a page with a
potentially stale DTO.

I'm thinking of storing the DTO in the user's session as a detached
entity, and using a model like the following on the various pages:

public class SessionModel implements IModel
{
protected String key;

public SessionModel(String key)
{
this.key = key;
}

public SessionModel(String key, T object)
{
this.key = key;
setObject(object);
}

public T getObject()
{
return (T) Session.get().getAttribute(key);
}

public void setObject(T object)
{
Session.get().setAttribute(key, object);
}

public void detach()
{
// no-op
}
}

Does this seem like a reasonable approach? Is there an existing model
that I've overlooked that does this already? Is there a better way to
accomplish the multi-page flow without stuffing objects into the
session?

Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-model-for-passing-data-between-pages-tp4542878p4542878.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: reloading of HTML and classes

2012-04-07 Thread armhold
I don't use ReloadingWicketFilter, but have pretty good luck reloading
changed HTML and classes by simply running in debug mode in my
IDE. With -Dwicket.configuration=development and running under the
debugger, I can redeploy changes with "reload changed classes"
(command+F9 in Intellij on OSX; I assume there's something similar for
Eclipse.)

It doesn't work if you've changed something deep in the app's startup
(like say WicketApplication), but covers about 90% of my needs.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/reloading-of-HTML-and-classes-tp4537542p4539448.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: When I am open title page of my application, the next error occurs...

2012-03-30 Thread armhold
Your IDE probably auto-imported it instead of java.lang.Object. Your IDE most
likely has a feature whereby you can add org.omg.CORBA to the list of "don't
ever auto-import this package".

> Last cause: $Proxy155 cannot be cast to org.omg.CORBA.Object

PS: I will forever read this package as "oh my god CORBA!" now. :-)


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/When-I-am-open-title-page-of-my-application-the-next-error-occurs-tp4514882p4518943.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: What real life scenario calls for page ID?

2012-03-27 Thread armhold
Martin wrote:

> HomePageMapper is explicitly registered in SystemMapper (the default
> compound root mapper).  The resource mapper example in
> wicket-examples also mounts custom home mapper.

Thanks Martin. I managed to get something working based on
this. Here's a gist, in case anyone else is trying to get their home
page mounted without the version query param:
https://gist.github.com/2220564

Mount it in WicketApplication like: 

getRootRequestMapperAsCompound().add(new NoVersionHomePageMapper());

To be honest I'm not sure what it means to return a compatibilityScore
> 0, which indicates "I can handle this request better than the
HomePageMapper", but to then go and return null from mapRequest(). But
that's what I had to do to get it to work. Cargo-cult programming for sure.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/I-don-t-want-url-page-count-parameter-localhost-8080-context-0-tp4481510p4510319.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: What real life scenario calls for page ID?

2012-03-26 Thread armhold
I'm really grateful for this conversation, as I've been wondering the
same question for a while now.

Martin writes:

> So far I didn't hear a good explanation why the page id causes you
> troubles. Most of you are saying "it is ugly". 

Well it is kind of ugly. It is far less ugly than the 1.4-style
"?wicket:interface=:1" URLs though. And after reading your and
Igor's explanation, I understand better now why it's done this way, so
thank you for that.

As for why it causes troubles: I've done a handful of wicket projects
for different clients in the past year, and I get asked about this by
the project owners *every* *single* *time*. 

For projects where users log in, create accounts, etc, the
stakeholders are generally willing to accept the URL param (though
they grumble a little bit).

But for projects where a significant portion of the app's
functionality is exposed to "drive by" users, stakeholders won't
typically compromise on the URL structure. Some of their concerns come
down to simple aesthetics. But a common objection is "it's hurting our
SEO". The stated SEO concerns are that:

A. page request results in a 302
B. search engines don't like to index urls with query params (probably
apocryphal, or at least no longer true)
C. page analytics- you now need to normalize URLs against the "?N"
param

Some (perhaps all?) of the SEO issues might be addressable by link
rel="canonical"; I haven't tested it yet against 1.5.

> Case 3 is what the bots and not logged in users should see. Bots
> don't use sessions so don't let them go in the stateful area of your
> app.

If I understand correctly, this means no Ajax components at all on
"not logged in" pages. For a lot of sites that just plain won't
work. Please correct me if I have misunderstood something.

I have a 1.4 project whose migration to 1.5 has been on hold for a
while, in part due to the URL changes we'll have to make. I'm weighing
the benefits of this NoVersionMount that was proposed to see what
potential side effects it might have. So far it looks like it will
cause loss of Ajax state if the user reloads the page or hits the back
button, but no different from what currently happens in 1.4. I think
that's probably a reasonable tradeoff for some apps, as long as you're
aware of it. One issue (raised elsewhere on this list recently) is how
to use NoVersionMount with the home page, since it's not explicitly
mounted in WicketApplication.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/I-don-t-want-url-page-count-parameter-localhost-8080-context-0-tp4481510p4506482.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: inferring locale from URL in 1.5

2012-03-26 Thread armhold
Hmm, I was actually planning to use that code (LazyHttpsConfig)
myself. Looked like a nice way to avoid hard-coding port numbers for
dev vs prod use.  Maybe not now. :-)


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inferring-locale-from-URL-in-1-5-tp4497412p4505931.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: inferring locale from URL in 1.5

2012-03-26 Thread armhold
Try clicking the "source code" links from wicket-library.com. Always times
out for me. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inferring-locale-from-URL-in-1-5-tp4497412p4505742.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: inferring locale from URL in 1.5

2012-03-25 Thread armhold
Martin,

The wicket-examples site rarely works for me (server under-resourced?) but I
found the code in the examples section of the Wicket source from git. 

LocaleFirstMapper was a huge help; I'm fairly sure I wouldn't have gotten it
working without that reference, so thank you very much.  Here's what I came
up with:

https://gist.github.com/2198074

I suspect that stripping the locale from the hostname (vs path segment) is
not needed, since you were probably doing that in your example so that the
locale doesn't show up as a parameter to the page. I'm still experimenting
with it.

Thanks again for your help.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inferring-locale-from-URL-in-1-5-tp4497412p4503485.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



inferring locale from URL in 1.5

2012-03-22 Thread armhold
What's the cleanest way to set a user's locale based on the domainname of the
URL of the request in 1.5?  

https://cwiki.apache.org/WICKET/wicket-and-localized-urls.html This guide 
relies on overriding newRequestCycleProcessor(). Would a proper 1.5 analog
be to add a custom AbstractRequestCycleListener like this?

RequestCycleListenerCollection listeners = new
RequestCycleListenerCollection();
application.getRequestCycleListeners().add(listeners);
listeners.add(new AbstractRequestCycleListener() {
public void onBeginRequest(RequestCycle cycle) {
   Session.get().setLocale(...);
}

   });

BTW, I've been asked to use the domainname for the locale (vs the
context/servlet path), so my URLs will look like: fr.example.com/somepage.  

I'm planning to use (HttpServletRequest)
getContainerRequest()).getServerName()) for this, unless there is something
nicer.

Thank you.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inferring-locale-from-URL-in-1-5-tp4497412p4497412.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: form params appear in URL if submitted after session timeout

2012-03-12 Thread armhold
Well at least I suffered (too) for it. :-) Sorry for the regression, and
thanks for fixing it. I'm fine reading post params manually, if that's the
prescribed way to do it.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/form-params-appear-in-URL-if-submitted-after-session-timeout-tp4463992p4465935.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: form params appear in URL if submitted after session timeout

2012-03-11 Thread armhold
Just built 1.5.5 from source, and the problem is fixed there.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/form-params-appear-in-URL-if-submitted-after-session-timeout-tp4463992p4464052.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



form params appear in URL if submitted after session timeout

2012-03-11 Thread armhold
I notice that if you submit a form after the session has timed out, Wicket
(1.5.4) seems to add the submitted params to the URL of the redirect,
resulting in something like:

   http://localhost:8080/?0&username=username&form1_hf_0&password=SECRET

Is this a bug? If not, is there any workaround for this behavior? I also
tried StatelessForm without luck.

PS: this is easy to reproduce by tweaking web.xml with:


1



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/form-params-appear-in-URL-if-submitted-after-session-timeout-tp4463992p4463992.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: seo - canonical link element

2012-03-08 Thread armhold
Yes, I worked on an app with a search engine component, so it's common for
users to come to the "same" page via slightly different urls.



Label canonical = new Label("canonical", "");
canonical.add(new AttributeModifier("href",
Model.of(getCanonicalUrl(;
canonical.setVisible(! isCanonicalUrl());

Your page can implement isCanonicalUrl() to check page params, etc.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/seo-canonical-link-element-tp4449729p4456354.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wrapping onclick in AjaxLink with 1.5.4

2012-02-29 Thread armhold
Well that was simple, thank you.  I'm pedantic enough to have added @Override
to the getAjaxCallDecorator(), but I missed decorateScript() in my initial
attempt.

The method is being called now, and I have updated the Wiki. 

However the second example listed on the Wiki (AttributeAppender) also does
not work.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wrapping-onclick-in-AjaxLink-with-1-5-4-tp4430306p4431489.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wrapping onclick in AjaxLink with 1.5.4

2012-02-29 Thread armhold
Hi Martin,

I'm following the example 
https://cwiki.apache.org/WICKET/calling-javascript-function-on-wicket-components-onclick.html
shown here . My code is literally that, added to the prototypical Wicket
Quickstart HomePage.java:

public class HomePage extends WebPage {
private static final long serialVersionUID = 1L;

public HomePage(final PageParameters parameters) {
add(new Label("version",
getApplication().getFrameworkSettings().getVersion()));

AjaxLink ajaxLink = new AjaxLink("ajaxLink") {

@Override
public void onClick(AjaxRequestTarget target)
{
System.out.println("onClick fired");
}

protected IAjaxCallDecorator getAjaxCallDecorator() {
return new AjaxCallDecorator() {
public CharSequence decorateScript(CharSequence script)
{
return "alert('This is my javascript call'); " +
script;
}
};
}
};

add(ajaxLink);
}
}

If I inspect the generated HTML, it looks like this:

# This is an ajax link. 

Thanks for your time.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wrapping-onclick-in-AjaxLink-with-1-5-4-tp4430306p4431400.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



wrapping onclick in AjaxLink with 1.5.4

2012-02-28 Thread armhold
Hi,

I need to run some Javascript on the client when the user clicks an
AjaxLink. I'm following 
https://cwiki.apache.org/WICKET/calling-javascript-function-on-wicket-components-onclick.html
these instructions , but my onclick() javascript always gets overwritten by
the AjaxLink's behavior.

I tried overriding getAjaxCallDecorator() as well as adding an
AttributeAppender, and neither seem to work. Nor does adding the appender in
onInitialize(), as 
http://apache-wicket.1842946.n4.nabble.com/AttributeModifier-and-AjaxLink-in-1-5-td3830027.html
this thread  recommends.

Thanks for any advice.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wrapping-onclick-in-AjaxLink-with-1-5-4-tp4430306p4430306.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket-Source: Click-through from browser back to Java source

2012-02-08 Thread armhold
Thanks Minas, I'll take a look. 

I do have a bug in my plugin in that the configuration panel seems to always
appear twice in the "IDE Settings" popup, so your existing code might be
helpful in figuring that out.

The Intellij documentation on plugin API documentation isn't the best,
unfortunately.

Thanks again,
George


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Source-Click-through-from-browser-back-to-Java-source-tp4346532p4369389.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket-Source: Click-through from browser back to Java source

2012-02-03 Thread armhold
Wow this is really handy, thanks Jenny. Looking forward to the Chrome port!

I just whipped up a plugin for Intellij.  It might not be publicly available
until they have a chance to review it, but here's the link:
http://plugins.intellij.net/plugin/?idea&id=6846
You can 
https://github.com/armhold/wicket-source-intellij/tree/master/artifacts
install the jar  manually if you don't feel like waiting for it to show up
in the public repo.

In the mean time source is on github:
https://github.com/armhold/wicket-source-intellij. 

Minas: I've never done an Intellij plugin before so this is probably not the
most idiomatic code, but feel free to copy the relevant bits into
wicketforge if you find it useful. 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Source-Click-through-from-browser-back-to-Java-source-tp4346532p4356257.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AJAX Rating extension, multiple on a page

2012-01-22 Thread armhold
Just to be clear in case it wasn't obvious- thingBeingRated will be
serialized with the rest of your page if you take this approach. If it's not
serializable, use a reference (like a database ID) to look it up when
needed, instead of marking the object itself as final.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AJAX-Rating-extension-multiple-on-a-page-tp4317346p4318956.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AJAX Rating extension, multiple on a page

2012-01-22 Thread armhold
I've not used this component before, so take this with a grain of salt. 

But if you're overriding the RatingPanel.onRating(), you implicitly have
access to the RatingPanel via "this". You can access it in the onRating()
method, as well as any other accessible member/final field. So you could do
something like:

final Object thingBeingRated = ...;

  @Override 
  public void onRated(int rating, AjaxRequestTarget target) { 
  HomePage.rating.addRating(rating); 
  log.debug("thing being rated: " + thingBeingRated);
  } 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AJAX-Rating-extension-multiple-on-a-page-tp4317346p4318860.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to get https port number in Wicket 1.5

2012-01-16 Thread armhold
Thanks Martin!

https://issues.apache.org/jira/browse/WICKET-4338


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-https-port-number-in-Wicket-1-5-tp4295139p4301617.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to get https port number in Wicket 1.5

2012-01-16 Thread armhold
Hmm, I spoke too soon. 

It seems that the reason I was running into the *method* mismatch (not
*protocol* mismatch) with the StatelessForm is due to having installed an
HttpsMapper in my WicketApplication. If you try to post a form over https
from an http page, the HttpsMapper apparently discards the https POST, and
instead directs the browser to reload the page over http (expected behavior
I guess, since it's not @RequireHttps). This ends up defeating the form
submission.

The page Martin pointed me to does indeed work around this issue, but with
one small problem- the LoginHandlerPage needs to process the POST params
manually from the HttpServletRequest, as they are not present in the
PageParameters (at least not with 1.5). It's simple enough to pull them out
of the request though.

Let me know if you think this is correct behavior, or if it sounds like a
bug. If the latter, I'm happy to create a JIRA+Quickstart for it.

Thanks everyone.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-https-port-number-in-Wicket-1-5-tp4295139p4301011.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to get https port number in Wicket 1.5

2012-01-15 Thread armhold
Hi Martin, thanks.

I've already got a solution (from Igor's book mostly, but updated for 1.5)
on how to submit a form over https when the page hosting the form is http. I
was just looking for a way to determine the https port without hard-coding a
reference to WicketApplication. I guess it's not that bad, but was hoping to
get it from the RequestCycle or something. Since we can set the value via
setRootRequestMapper(), it seems like there ought to be a way to read it
back. Not a big deal really.

BTW the approach mentioned on the page you linked (extending a
StatelessForm, which I tried independently) didn't work for me. It's because
StatelessForm aborts if the protocol does not match, so your form just fails
to submit (Perhaps this is new behavior for 1.5?) If you extend a regular
Form but then override getStatelessHint() to return true, it works fine. 

Here's the Form code in case anyone else finds it useful.

public class HttpsForm extends Form
{
public HttpsForm(String id)
{
super(id);
}

public HttpsForm(String id, IModel tiModel)
{
super(id, tiModel);
}

@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
String action = tag.getAttribute("action");
String absolute =
getRequestCycle().getUrlRenderer().renderFullUrl(Url.parse(action));
absolute = absolute.replaceFirst("http://";, "https://";);
absolute = absolute.replace(":" + getHttpPort(), ":" +
getHttpsPort());
tag.put("action", absolute);
}

protected int getHttpPort()
{
//provide this method in your WicketApplication
return ((WicketApplication) getApplication()).getHttpPort();
}

protected int getHttpsPort()
{
//provide this method in your WicketApplication
return ((WicketApplication) getApplication()).getHttpsPort();
}

}




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-https-port-number-in-Wicket-1-5-tp4295139p4296821.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to get https port number in Wicket 1.5

2012-01-14 Thread armhold
Hi Per,

The documentation for @RequireHttps implies that it only works for pages,
not components, and my (limited) testing shows that to be the case. Is there
a way to use it with components on otherwise insecure pages?

My use case is to secure a form on non-https pages, specifically to secure
that very nice username/password field at the top of Twitter Bootstrap
pages.

Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-https-port-number-in-Wicket-1-5-tp4295139p4296003.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



how to get https port number in Wicket 1.5

2012-01-14 Thread armhold
Assuming that the http/https port number have been set in WicketApplication
with the following:

setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
HttpsConfig(8080, 8443)));

... is there any way to get access to the port numbers from components?  One
obvious solution is something like:

public class WicketApplication {
 public int getHttpPort() { return 8080; }
 public int getHttpsPort() { return 8443; }

 public void init () {
  // ...
  setRootRequestMapper(new
HttpsMapper(getRootRequestMapper(), new HttpsConfig(getHttpPort(),
getHttpsPort(;
 }
}

And then in my components:

  ((WicketApplication) getApplication()).getHttpsPort();

But I am wondering if there is a cleaner way to get this information,
perhaps from the RequestCycle.

Why am I asking? I'd like to create a Form subclass that always uses https.

Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-https-port-number-in-Wicket-1-5-tp4295139p4295139.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: hebrew text looks like ×׳—׳‘׳¨׳•

2012-01-06 Thread armhold
I went though this pain a few months ago too. Here are all the places I had
to hit:

1. In your HTML files:

 

And also in your :



2. For property files, if you use i18n you will need to use the foo.xml
format rather than foo.properties, and also include the above  in each of them.

3. In your WicketApplication.java:

// wicket 1.4; perhaps different in 1.5
getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
getMarkupSettings().setDefaultMarkupEncoding("UTF-8");

4. In your pom.xml (to cover any copied resources):


UTF-8


5. Finally, in Intellij: 

File -> Preferences -> File Encodings -> IDE Encoding: UTF-8.


What made this frustrating is that it always seemed to render fine with the
embedded Jetty, but not with Tomcat (so things would always look great
locally, but fall apart in production). 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/hebrew-text-looks-like-tp4260875p4271694.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Hide page version query parameters

2012-01-04 Thread armhold
You can also add a http://example.com/your-canonical-url"/> to the head to instruct the
search engines to find the proper page.

(warning- video auto-plays on this google link:)

http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Hide-page-version-query-parameters-tp4163099p4260728.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



404 page gets constructed for @RequiresHttps pages

2011-12-28 Thread armhold
I just spent an hour debugging what would normally be a simple problem- the
markup for a page that extends a base class failed to define a component
which was added by the base class. But the problem wasn't immediately
obvious because it was actually occurring in my 404 page, and NOT the page I
was testing. I had no expectation that the 404 was even involved.

So I set some breakpoints, and it seems that the 404 page is constructed
whenever the user visits a page annotated with @RequiresHttps. Is this
really by design? Might cause problems for folks who are doing logging or
similar activity based on the 404 loading.

Also, if the Page class could output its classname as part of the "The
component(s) below failed to render" message, that would help debugging
immensely.

PS: I set up my 404 as per
https://cwiki.apache.org/WICKET/error-pages-and-feedback-messages.html

Thanks




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/404-page-gets-constructed-for-RequiresHttps-pages-tp4241025p4241025.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Using JNDI from Jetty/Start.java

2011-12-28 Thread armhold
I moved the config file to src/test/jetty/jetty-env.xml because I didn't want
it deployed with my production war file. It was really the two property
settings I was missing. You might not even need the properties if you are
using the jetty-maven-plugin; I did because I'm running Start#main()
directly from my IDE.

PS: also using Solr.  Small world. :-)


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-JNDI-from-Jetty-Start-java-tp4237903p4240237.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Using JNDI from Jetty/Start.java

2011-12-27 Thread armhold
Thanks to a hint from Christian Huber I got it working.

System.setProperty("java.naming.factory.url.pkgs",
"org.eclipse.jetty.jndi");
System.setProperty("java.naming.factory.initial",
"org.eclipse.jetty.jndi.InitialContextFactory");

EnvConfiguration envConfiguration = new EnvConfiguration();
URL url = new File("src/test/jetty/jetty-env.xml").toURI().toURL();
envConfiguration.setJettyEnvXml(url);

bb.setConfigurations(new Configuration[]{ new WebInfConfiguration(),
envConfiguration, new WebXmlConfiguration() });



Full details here: 
http://blog.armhold.com/2011/12/28/how-to-get-jndi-working-with-wicket-1-5-and-jetty-7-5/


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-JNDI-from-Jetty-Start-java-tp4237903p4238955.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Using JNDI from Jetty/Start.java

2011-12-27 Thread armhold
Has anyone got a JNDI config that works with Start.java under Wicket 1.5 (and
therefore Jetty 7.5)?

I've got JNDI working fine for my production Tomcat deployment, but can't
seem to figure out which incantations are needed to get it working with
Jetty for development/testing (I use Start.java to launch directly inside my
IDE, rather than mvn jetty-run).

I've created a datasource in WEB-INF/jetty-env.xml, but I suspect the file
is not being read at all. I get:

INFO  - NamingHelper   - JNDI InitialContext properties:{}
ERROR - tasourceConnectionProvider - Could not find datasource:
java:/comp/env/jdbc/mydatasource
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial

Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-JNDI-from-Jetty-Start-java-tp4237903p4237903.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 - setResponsePage() - page still tries to render HTML before redirect

2011-11-05 Thread armhold
Beautiful, thank you.

George

On Nov 5, 2011, at 12:46 AM, bht [via Apache Wicket] wrote:

> Hi, 
> 
> To abort the construction of the page, you throw 
> ResetResponseException or subclasses. 
> 
> Regards, 
> 
> Bernard 
> 
> 
> On Fri, 4 Nov 2011 19:12:34 -0700 (PDT), you wrote: 
> 
> >Hi, 
> > 
> >Geoff Hayman raised this issue previously here: 
> >http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-setResponsePage-page-still-tries-to-render-HTML-before-redirect-td3819145.html
> > 
> >but apparently got no response (and Nabble won't let me reply to that for 
> >some reason... conspiracy?) 
> > 
> >I've run into the same issue- with 1.5, you can no longer short-circuit the 
> >constructor of a page, as Wicket complains if all the components haven't 
> >been added so as to match the HTML. I often use this for things like access 
> >control- if some condition isn't met, set the response to another page 
> >without rendering any components. If this is an improper use of the 
> >framework, what is the correct pattern for dealing with this? 
> > 
> >I can work around this by rendering dummy data to my components, but that's 
> >rather ugly. 
> > 
> >Thanks
> 
> 
> - 
> To unsubscribe, e-mail: [hidden email] 
> For additional commands, e-mail: [hidden email] 
> 
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-setResponsePage-page-still-tries-to-render-HTML-before-redirect-tp3992321p3992468.html
> To unsubscribe from Wicket 1.5 - setResponsePage() - page still tries to 
> render HTML before redirect, click here.

--
George Armhold
armh...@gmail.com





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-setResponsePage-page-still-tries-to-render-HTML-before-redirect-tp3992321p3993146.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket 1.5 - setResponsePage() - page still tries to render HTML before redirect

2011-11-04 Thread armhold
Hi,

Geoff Hayman raised this issue previously here:
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-setResponsePage-page-still-tries-to-render-HTML-before-redirect-td3819145.html

but apparently got no response (and Nabble won't let me reply to that for
some reason... conspiracy?)

I've run into the same issue- with 1.5, you can no longer short-circuit the
constructor of a page, as Wicket complains if all the components haven't
been added so as to match the HTML. I often use this for things like access
control- if some condition isn't met, set the response to another page
without rendering any components. If this is an improper use of the
framework, what is the correct pattern for dealing with this?

I can work around this by rendering dummy data to my components, but that's
rather ugly. 

Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-setResponsePage-page-still-tries-to-render-HTML-before-redirect-tp3992321p3992321.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org