• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
anchor from a button in a SSL (https) - looping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

anchor from a button in a SSL (https) - looping


  • Subject: anchor from a button in a SSL (https) - looping
  • From: "Jonathan Fleming" <email@hidden>
  • Date: Mon, 23 Aug 2004 18:40:30 +0100

Hi Guys,

What's the best way to append an anchor to a url that is already redirecting to a ssl https:// protocol?
At the moment I have a SslComponent that is a subclass of a subclass component and when I try to use appendToResponse in the top level class where all the work is really being done it gets changed down the line in the bottom most subclass (the SslComponent).
Here is what I'm finding that I can't do:
Example of Java classes tree
Object
WOComponent
MyComponent.java - top level
SubOfMyComponent.java - sub of top level
SslComponent.java - sub of SubOfMyComponent


In MyComponent.java I have the code:

protected String anchor;

   public void appendToResponse(WOResponse response, WOContext context) {
       if (anchor != null) {
           response.setHeader(context.componentActionURL() +
                              "#" + anchor, "location");
           response.setHeader("text/html", "content-type");
           response.setHeader("0", "content-length");
           response.setStatus(302);
           anchor = null;
           return;
       }
       super.appendToResponse(response, context);
   }

   public String getAnchor() { return anchor; }
   public void setAnchor(String s) { anchor = s; }

==========================================================

But also in SslComponent.java I have this code within an appendToResponse method:

...
if (sslRequired) {
secureUrl = protocol+secureHostName+req.uri();
NSLog.out.appendln( "===\r secureUrl from sslComponent: " + secureUrl);
res.setHeader(secureUrl, "location");
res.setHeader("text/html", "content-type");
res.setHeader("0", "content-length");
res.setStatus(302);
}
...


==========================================================

Now as the SslComponent is setting the location header url with the secure url you'd think you could place your anchor code on the end of this such as:

...
if (sslRequired) {
secureUrl = protocol+secureHostName+req.uri();
NSLog.out.appendln( "===\r secureUrl from sslComponent: " + secureUrl);
res.setHeader(secureUrl + "#" + anchor, "location");
res.setHeader("text/html", "content-type");
res.setHeader("0", "content-length");
res.setStatus(302);
anchor = null;
}
...


having moved all the accessor code for anchor into this class and deleting it in the MyComponent.java class, but this causes a loop.
So what's the solution?


I've managed to do this using a String method in the href binding of a form but since I have to save objects to the db it doesn't seem to work. On the otherhand the same code as a WOComponent method works fine but I can not then get the anchor to work:


public WOComponent createWebsiteInBTT_true() { setAnchor("CREATEORLINK"); bShowNavCreationButtons=true; session.getUser().setUseUrl(new Integer(0)); // get editing context & save changes EOEditingContext ec = session().defaultEditingContext(); ec.saveChanges(); anchorToCreateOrLinkWebsite(); return context().page(); }

// bound to href in a form
// the urlQueryString in this method is instantiated in the constructor with
// urlQueryString = context().request().uri();
// when used it does not update the db, however the anchor works fine
public String anchorToCreateWebsite(){
bShowNavCreationButtons=true;
session.getUser().setUseUrl(new Integer(0));
// get editing context & save changes
EOEditingContext ec = session().defaultEditingContext();
ec.saveChanges();
return urlQueryString+"#CREATEORLINK";
}


   // tried to use this from with createWebsiteInBTT_true method but no go
   public String anchorToMyObject(){
       return urlQueryString+"#CREATEORLINK";
   }

Any pointers as to the best way to get over this would be very appeciated
Jonathan :^)

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.



  • Prev by Date: Signature framework
  • Next by Date: Re: WODisplayGroup sort question
  • Previous by thread: Signature framework
  • Next by thread: Re: WODisplayGroup sort question
  • Index(es):
    • Date
    • Thread