Passing query string with PrettyFaces - prettyfaces

I'm working with JSF2 and PrettyFaces for creating a 'SEO-friendly URLs'.
Now I'm facing a problem when I want to pass parameters after the PrettyFaces is creating a new url those parameters will been delete and i want to avoid that.
I will explain it with an example:
Currently when hitting this url:
http://www.mysite.com/index.jsf?param1=value1&param2=value2
After the PrettyFaces I'm getting this url:
http://www.mysite.com/
But I want it to be like that, so when hitting this url:
http://www.mysite.com/index.jsf?param1=value1&param2=value2
After the PrettyFaces i'll get this url:
http://www.mysite.com/?param1=value1
Please note: That I only want to pass specific parameters. from the example above, only param1 should be passed.
My configuration on the 'pretty-config.xml':
<url-mapping>
<pattern>/</pattern>
<view-id>/jsp/index.jsf</view-id>
</url-mapping>

I'm actually surprised that the query string is not being preserved. I would guess that something is else is going on, other than prettyfaces. What version of PRettyFaces are you using? I'm also guessing that this is a problem with PrettyFaces, that this was a bug in the version you're using, but I think that's unlikely.
The only thing the url-mapping you've pasted should do is perform an internal forward from "/" to "/jsp/index.jsf". It will not do any client redirection from "/index.jsf" to "/"; this is why I think there is something else at play here. (See the code for reference: https://github.com/ocpsoft/rewrite/blob/master/config-prettyfaces/src/main/java/org/ocpsoft/rewrite/prettyfaces/UrlMappingRuleAdaptor.java#L213)
With regard to stripping out certain query parameters and leaving others, then I highly suggest looking at the Rewrite framework (which is the new core of PrettyFaces), you can use it to build very custom rewriting rules: http://ocpsoft.org/prettyfaces/ and http://ocpsoft.org/rewrite/
I hope this helps.

Related

CFWheels: Redirect to URL with Params Hidden

I am using redirectTo() function with params to redirect to another pages with a query string in the url. For security purpose this does not look appealing because the user can change the parameters in the url, thus altering what is inserted into the database.
My code is:
redirectTo(action="checklist", params="r=#r#&i=#insp#&d=#d#");
Is there anyway around this? I am not using a forms, I just wish to redirect and I want the destination action/Controller to know what I am passing but not display it in the url.
You can obfuscate the variables in the URL. CfWheels makes this really easy.
All you have to do is call set(obfuscateURLs=true) in the config/settings.cfm file to turn on URL obfuscation.
I am sure this works with linkTo() function. I hope it works with RedirectTo() funcation as well. I do not have a set up to check it now. But if doesn't work for RedirectTo(), you can obfuscateParam() and deObfuscateParam() functions to do job for you.
Caution: This will only make harder for user to guess the value. It doesn't encrypt value.
To know more about this, Please read the document configuration and defaults and obfuscating url
A much better approach to this particular situation is to write params to the [flash].1 The flash is exactly the same thing as it is in Ruby on Rails or the ViewBag in ASP.Net. It stores the data in a session or cookie variable and is deleted at the end of the next page's load. This prevents you from posting back long query strings like someone that has been coding for less than a year. ObfuscateParam only works with numbers and is incredibly insecure. Any power user can easily deobfuscate, even more so with someone that actually makes a living stealing data.

How to change Magento's Soap Address Location to HTTPS

I am trying to change our wsdl to use a secure URL as the end point. We are using the V2, WSI Compliant API and this is the line I am trying to change:
<soap:address location="http://mydomain.com/index.php/api/v2_soap/index/"/>
I want to change it to:
<soap:address location="https://mydomain.com/index.php/api/v2_soap/index/"/>
I really need to find out where the {{var wsdl}} is being passed in. I have tried hard coding it in one place, but the way the wsdl is being compiled (much like the config is generated), it appends the soap address (and has both the secure and unsecure in the final product). That's not really the way I wanted to do it, anyway. I'm wondering if there's a design template that's driving all of this where I could declare a new variable or reset the wsdl.url bit. I've tried changing some code (just to see if this was the origin of the url) in Mage_Api_Model_Server_V2_Adapter_Soap and Mage_Api_Model_Server_Adapter_Soap to no avail. Does anybody have any advice?
I actually figured this out and it was much easier than I expected. This is accomplished by going to System->Configuration->Web->Secure->Use Secure URLs in Admin = Yes.

Correct yummly API call for a recipe

I'm trying to use the Yummly API. I've noticed that some of their developers have answered other questions here, so I'm hoping to catch their eye. I used the documentation at the yummly developer site https://developer.yummly.com/documentation#IDs.
Specifically here is my get request:
<http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039>
Which returns this:
Please include X-Yummly-App-ID and X-Yummly-App-Key
Seems like this is a sensible thing, except that I don't see anywhere in the documentation for the single recipe call where I'm supposed to insert that info. Any one out there know how to properly format this?
or include them as URL parameters:
_app_id=app-id&_app_key=app-key
https://developer.yummly.com/documentation#IDs
Try this:
http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039?_app_id=ID&_app_key=KEY
You need to take the URL you mentioned in the question and add your authentication parameters to it. So it becomes:
http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039?_app_id=ID&_app_key=KEY
Instead of ID and KEY insert the application id and key from your account on developer.yummly.com

Django URL Aliases

I'm new to Django and I have a BIG problem. I don't like the "url pattern" philosophy of Django.
I don't want my pages to look like
http://domain.com/object/title-of-object
I want
http://domain.com/title-of-object
and of course I will have more than one type of object.
Is there an elegant way to achieve this with Django (not using hard-coded urls)?
Thanks!
Ever wondered that, if what you want to do seems so hard to acheive, you're doing it wrong? What is so wrong with /foo/name-of-foo/ ?
I'm trying to imagine your use-case and wondering if you need 'human' URLs for only a handful of pages. If so, it would work to go with the /foo/slug-for-foo/ approach but then use the django.contrib.redirects app to support hand-written URLs that redirect to the saner, more RESTful ones?
It is possible. You'll have to create one catch-all URL pattern, for which you'll create a view that will search all possible object types, find the matching one, and process and return that. Usually, this is a bad idea.

Ember.js routing with parameters

I just played with ember routing example. It looks quite interesting. Especially if you are going to build all your application on Ember framework.
But parameters in url follows after '#'. That means you can't copy and send a link to someone if client has to login with postback (if only to set a cookie with login parameters). Is there a better option - maybe use '?' instead of '#'?
You may also have a look at Ember.Router.
There are two good start points # https://gist.github.com/2679013 and https://gist.github.com/2728699
A lot of fixes have been made the last couple of days.
EDIT
A brand new guide is now available # https://emberjs-staging-new.herokuapp.com/guides/outlets#toc_the-router
Here is a full example courtesy of https://github.com/jbrown
http://jsfiddle.net/justinbrown/C7LrM/10/