struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Erickson" <halc...@ratemod.com>
Subject RE: How to encode byte array as url parameter
Date Thu, 23 Jun 2005 04:05:50 GMT
Thanks Laurie that is useful information.
-David

> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Laurie Harper
> Sent: Wednesday, June 22, 2005 8:39 PM
> To: user@struts.apache.org
> Subject: Re: How to encode byte array as url parameter
> 
> Just to add to your options ;-), here's another suggestion: convert the
> byte[] to an integer (store it in a BigInteger). BigInteger can give you a
> string representation in whatever base you want. Base 10 would give you a
> purely numeric but rather long string; base 16 (hex) would be more
> compact. But you can go all the way up to base 62 (same principle as hex
> notation, but using [a-cA-Z0-9]).
> 
> I think that probably gives you the most compact URL-safe representation,
> though I'm not sure. Compare URL-encoded Base64 vs. this technique and see
> which works best for you.
> 
> L.
> 
> David Erickson wrote:
> 
> > Thanks the base64 combined with URLEncoder should work great.
> > -David
> >
> >
> >>-----Original Message-----
> >>From: Michael Jouravlev [mailto:jmikus@gmail.com]
> >>Sent: Wednesday, June 22, 2005 1:36 PM
> >>To: Struts Users Mailing List
> >>Subject: Re: How to encode byte array as url parameter
> >>
> >>Base64 will not work, because its charset includes + and / ASCII
> >>characters. So you might write something like strToHex() (or whatever
> >>its name is), for example see Cryptix library, Hex utility class. Or
> >>you can just use that class directly.
> >>
> >>On the other hand, you may use Base64, and then URLEncoder.encode().
> >>
> >>Michael.
> >>
> >>On 6/22/05, David Erickson <halcyon@ratemod.com> wrote:
> >>
> >>>Hi I am wondering how I can take a byte[] and use it as a URL
> parameter?
> >>
> >>I
> >>
> >>>have tried converting it to a string using varying character sets, but
> >>
> >>when
> >>
> >>>I call string.getbytes I never get back my original array.  Any help
> >>
> >>would
> >>
> >>>be greatly appreciated.
> >>>
> >>>Thanks
> >>>David
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message