I am trying implement query strings to work with pyjamas so that users can
jump directly to sections of a program using hyperlinking and so I can
create a sitemap. For example when a user
types http://localhost:8000/#page_get?name=technology;level=0 in the
browser, it will take them to a specific page. The program already uses
history tokens (support for backwards and forwards). My assumption was to
use History.getToken() and History.newItem() for reading/creating query
strings. Is this what GWT people use for hyperlinking their programs?
The problem is the error pyjs creates from calling history.html (code
listed below). There is nothing in my program that calls history.html, so
it must be a behind the scenes, pyjs black magic, required to get History
working. Since there is no history.html handling on the server side I get
an error. I posted my errors below. Can someone with a some knowledge with
history/querystrings give me a rough explanation on what is happening and
guidance on how I should be creating query strings?
I am a hobbiest programmer, so please excuses any wrong nomenclature above.
~Grant
Unexpected query string parameters: level, page_get?name
Traceback (most recent call last):
File
"C:\Python27\lib\site-packages\cherrypy-3.2.1-py2.7.egg\cherrypy\_cprequest.py",
line 656, in respond
response.body = self.handler()
File
"C:\Python27\lib\site-packages\cherrypy-3.2.1-py2.7.egg\cherrypy\lib\encoding.py",
line 188, in __call__
self.body = self.oldhandler(*args, **kwargs)
File
"C:\Python27\lib\site-packages\cherrypy-3.2.1-py2.7.egg\cherrypy\_cpdispatch.py",
line 40, in __call__
raise sys.exc_info()[1]
HTTPError: (404, 'Unexpected query string parameters: level, page_get?name')
GET /history.html?page_get?name=technology;level=0 HTTP/1.1 Host:
localhost:8000 Connection: keep-alive Cache-Control: no-cache Pragma:
no-cache User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11
(KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11 Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer:
http://localhost:8000/ Accept-Encoding: gzip,deflate,sdch Accept-Language:
en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie:
session_id=1c6dabcd5d6ea4ed22482c0055c64ad9a92a534e
HTTP/1.1 404 Not Found Date: Mon, 26 Nov 2012 12:54:55 GMT Content-Length:
1298 Content-Type: text/html;charset=utf-8 Server: CherryPy/3.2.1
Set-Cookie: session_id=0c7458d8db408c79d7ede66cd5ba4b9f18a79ab5;
expires=Mon, 26 Nov 2012 13:54:55 GMT; Path=/
<html> <head> <script> function hst() { var search = location.search; var
historyToken = ''; if (location.search.length > 0) historyToken =
decodeURIComponent(location.search.substring(1));
document.getElementById('__historyToken').value = historyToken; if
(parent.__onHistoryChanged) parent.__onHistoryChanged(historyToken); }
</script></head> <body onload='hst()'> <input type='text'
id='__historyToken'> </body>
--