You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Hale <mi...@halefamilysite.com> on 2004/10/02 22:43:39 UTC

Re: null null null HttpException(414,Request URI Too Large,null)

I considered doing this, but then I would have to have all my actions 
understand how to get things from the database/provider.

My solution was to create ListingSqueezeAdapter class that implements 
ISqueezeAdaptor.  Now I can continue to pass objects around in my code, 
and ognl without having to worry about ids because the engine does the 
right thing for a Listing.  Here is the adaptor code:

public class ListingSqueezeAdaptor implements ISqueezeAdaptor {

     private static final String PREFIX = "L";

     public String squeeze(DataSqueezer squeezer, Object data) throws 
IOException {
         Listing listing = (Listing) data;
         return PREFIX + listing.getAddressId();
     }

     public Object unsqueeze(DataSqueezer squeezer, String string) 
throws IOException {
         ListingProvider provider = (ListingProvider) 
ItemProvider.getProvider(Listing.class);
         return provider.getUnique("addressId", string.substring(1));
     }

     public void register(DataSqueezer squeezer) {
         squeezer.register(PREFIX, Listing.class, this);
     }

}

BTW the process of choosing a prefix seems somewhat akin to black 
magic.  My guess is that not a lot of thought has been put into users 
implementing their own squeezers.

On Sep 30, 2004, at 1:01 AM, Danny Mandel wrote:

> I've seen this when I was directly encoding one of my persistent 
> objects as a direct link service parameter.  It was working fine, but 
> at some point I added too much information to the class and the 
> request became too long.  In order to fix the problem, I changed my 
> code so it passed the object's primary key and did a database lookup 
> to restore it in my listener code.
>
> i.e. what used to be:
>
>        public void performAction(IRequestCycle cycle) {
>                Object[] parameters = cycle.getServiceParameters();
>                NodeImage img = (NodeImage) parameters[0];
>       }
>
> became:
>        public void performAction(IRequestCycle cycle) {
>                Object[] parameters = cycle.getServiceParameters();
>                Integer imgId = (Integer) parameters[0];
>                NodeImage img = 
> imageDao.getImageWithId(imgId.intValue());
>       }
>
> and that fixed the problem.
>
> Hope that helps,
> Danny
>
> Michael Hale wrote:
>
>> After getting upgrading to the latest version of java for os x (Java  
>> 1.4.2 Update 2) I get this error from jetty:
>>
>> null null null HttpException(414,Request URI Too Large,null)
>>


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