Changeset 9fc4d8797d8b9f3e36c7d5871eda34d7fa44f1f4
- Timestamp:
- 05/12/08 16:18:28
(2 months ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1210601908 +0200
- git-parent:
[5dc487d6f8fa08760e5156f406bf9475a1f8ce56]
- git-author:
- Christopher Jung <bktheg@web.de> 1210601908 +0200
- Message:
[feature] Es wird nun eine Java-Session aufgebaut und ueber Requests hinweg erhalten
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2b804ab |
r9fc4d87 |
|
| 54 | 54 | public HttpRequest(HttpServletRequest request) { |
|---|
| 55 | 55 | this.request = request; |
|---|
| | 56 | |
|---|
| | 57 | if( request.getSession(false) == null ) { |
|---|
| | 58 | request.getSession(true); |
|---|
| | 59 | } |
|---|
| 56 | 60 | |
|---|
| 57 | 61 | // Standard-Encoding ist UTF-8 |
|---|
| rf0273db |
r9fc4d87 |
|
| 22 | 22 | import java.io.OutputStream; |
|---|
| 23 | 23 | import java.io.OutputStreamWriter; |
|---|
| | 24 | import java.util.regex.Matcher; |
|---|
| | 25 | import java.util.regex.Pattern; |
|---|
| 24 | 26 | |
|---|
| 25 | 27 | import javax.servlet.http.HttpServletResponse; |
|---|
| … | … | |
| 118 | 120 | OutputStreamWriter writer = new OutputStreamWriter(response.getOutputStream(), charSet); |
|---|
| 119 | 121 | if( content.length() > 0 ) { |
|---|
| 120 | | writer.append(content.toString()); |
|---|
| | 122 | writer.append(prepareContentForSend()); |
|---|
| 121 | 123 | } |
|---|
| 122 | 124 | writer.flush(); |
|---|
| … | … | |
| 136 | 138 | } |
|---|
| 137 | 139 | } |
|---|
| | 140 | |
|---|
| | 141 | private static final Pattern[] URL_PATTERNS = new Pattern[] { |
|---|
| | 142 | Pattern.compile("href\\=\"([^\"]*)\""), |
|---|
| | 143 | Pattern.compile("src\\=\"([^\"]*)\""), |
|---|
| | 144 | Pattern.compile("action\\=\"([^\"]*)\"") |
|---|
| | 145 | }; |
|---|
| | 146 | |
|---|
| | 147 | private String prepareContentForSend() { |
|---|
| | 148 | String str = this.content.toString(); |
|---|
| | 149 | |
|---|
| | 150 | for( int i=0; i < URL_PATTERNS.length; i++ ) { |
|---|
| | 151 | str = encodeUrlsWithPattern(str, URL_PATTERNS[i]); |
|---|
| | 152 | } |
|---|
| | 153 | |
|---|
| | 154 | return str; |
|---|
| | 155 | } |
|---|
| | 156 | |
|---|
| | 157 | private String encodeUrlsWithPattern(String str, Pattern pattern) { |
|---|
| | 158 | Matcher matcher = pattern.matcher(str); |
|---|
| | 159 | |
|---|
| | 160 | int offset = 0; |
|---|
| | 161 | while( matcher.find() ) { |
|---|
| | 162 | String group = matcher.group(1); |
|---|
| | 163 | |
|---|
| | 164 | if( !group.equals("#") && !group.startsWith("http://") && |
|---|
| | 165 | !group.startsWith("javascript") && !group.contains("(") && |
|---|
| | 166 | !group.contains(")") ) { |
|---|
| | 167 | int oldlength = str.length(); |
|---|
| | 168 | str = str.substring(0,matcher.start(1)+offset)+ |
|---|
| | 169 | this.response.encodeURL(group)+ |
|---|
| | 170 | str.substring(matcher.end(1)+offset); |
|---|
| | 171 | |
|---|
| | 172 | offset += str.length() - oldlength; |
|---|
| | 173 | } |
|---|
| | 174 | } |
|---|
| | 175 | return str; |
|---|
| | 176 | } |
|---|
| 138 | 177 | |
|---|
| 139 | 178 | public void setContent(String content) { |
|---|
| r4f9d99f |
r9fc4d87 |
|
| 208 | 208 | $("inbox_waiter").style.display = "block"; |
|---|
| 209 | 209 | |
|---|
| 210 | | var url = './ajax'; |
|---|
| | 210 | var url = location.href; |
|---|
| 211 | 211 | // Oh ich liebe das toooolle caching vom *piep* ie |
|---|
| 212 | 212 | var params = 'module={global.module}&sess={global.sess}&action=move&ordner={ordner.parent}&moveto='+ordnerid+"&pm_"+pmid+"="+pmid+"&antiiecachingtimestamp="+(new Date().getTime()); |
|---|
| r0a26521 |
r9fc4d87 |
|
| 75 | 75 | |
|---|
| 76 | 76 | function checkPMStatus() { |
|---|
| 77 | | var url = './ajax'; |
|---|
| | 77 | var url = location.href; |
|---|
| 78 | 78 | var params = 'module={global.module}&sess={global.sess}&action=hasNewPm'; |
|---|
| 79 | 79 | |
|---|
| r07ac587 |
r9fc4d87 |
|
| 21 | 21 | |
|---|
| 22 | 22 | function checkPMStatus() { |
|---|
| 23 | | var url = './ajax'; |
|---|
| | 23 | var url = location.href; |
|---|
| 24 | 24 | var params = 'module={global.module}&sess={global.sess}&action=hasNewPm'; |
|---|
| 25 | | |
|---|
| | 25 | |
|---|
| 26 | 26 | var myAjax = new Ajax.Request( url, { |
|---|
| 27 | 27 | method: 'get', |
|---|
| … | … | |
| 75 | 75 | $('helpboxtext').innerHTML = ''; |
|---|
| 76 | 76 | |
|---|
| 77 | | var myAjax = new Ajax.Request( "./ajax", { |
|---|
| | 77 | var myAjax = new Ajax.Request( location.href, { |
|---|
| 78 | 78 | method: 'get', |
|---|
| 79 | 79 | parameters: 'module={global.module}&sess={global.sess}&action=getHelpText&page='+currentModule, |
|---|
| … | … | |
| 96 | 96 | var cmd = $('adminConsoleCommand').value; |
|---|
| 97 | 97 | $('adminConsoleResponse').innerHTML = ''; |
|---|
| 98 | | var myAjax = new Ajax.Request( "./ajax", { |
|---|
| | 98 | var myAjax = new Ajax.Request( location.href, { |
|---|
| 99 | 99 | method: 'get', |
|---|
| 100 | 100 | parameters: 'module=admin&sess={global.sess}&action=ajax&namedplugin=net.driftingsouls.ds2.server.modules.admin.AdminConsole&responseOnly=1&cmd='+encodeURIComponent(cmd), |
|---|