org.apache.wicket.protocol.http
Class WicketURLEncoder

java.lang.Object
  extended by org.apache.wicket.protocol.http.WicketURLEncoder

public class WicketURLEncoder
extends java.lang.Object

Adapted from java.net.URLEncoder, but defines instances for query string encoding versus URL path component encoding.

The difference is important because a space is encoded as a + in a query string, but this is a valid value in a path component (and is therefore not decode back to a space).

Author:
Doug Donohoe
See Also:
URLEncoder, http://www.ietf.org/rfc/rfc2396.txt}

Field Summary
protected static int caseDiff
           
protected  java.util.BitSet dontNeedEncoding
           
static WicketURLEncoder PATH_INSTANCE
          Encoder used to encode components of a path.

For example: http://org.acme/foo/thispart/orthispart?butnot=thispart
static WicketURLEncoder QUERY_INSTANCE
          Encoder used to encode name or value components of a query string.

For example: http://org.acme/notthis/northis/oreventhis?buthis=isokay&asis=thispart
 
Constructor Summary
protected WicketURLEncoder(int type)
          Allow subclass to call constructor.
 
Method Summary
 java.lang.String encode(java.lang.String s)
          Calls encode with the application response request encoding as returned by Application.get().getRequestCycleSettings().getResponseRequestEncoding()
 java.lang.String encode(java.lang.String s, java.lang.String enc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dontNeedEncoding

protected java.util.BitSet dontNeedEncoding

caseDiff

protected static final int caseDiff
See Also:
Constant Field Values

QUERY_INSTANCE

public static final WicketURLEncoder QUERY_INSTANCE
Encoder used to encode name or value components of a query string.

For example: http://org.acme/notthis/northis/oreventhis?buthis=isokay&asis=thispart


PATH_INSTANCE

public static final WicketURLEncoder PATH_INSTANCE
Encoder used to encode components of a path.

For example: http://org.acme/foo/thispart/orthispart?butnot=thispart

Constructor Detail

WicketURLEncoder

protected WicketURLEncoder(int type)
Allow subclass to call constructor.

Method Detail

encode

public java.lang.String encode(java.lang.String s)
Calls encode with the application response request encoding as returned by Application.get().getRequestCycleSettings().getResponseRequestEncoding()

Parameters:
s - Value to encode
Returns:
String encoded using default Application request/respose encoding

encode

public java.lang.String encode(java.lang.String s,
                               java.lang.String enc)
See Also:
URLEncoder.encode(String, String)


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.