Hi,
ich habe folgenden String gegeben:
und will jetzt die Session Id auslesen, also: "blubbblub".
Ich komme da nicht weiter, kann mir jemand wie ich das löse?
Mein bisheriger Ansatz:
In Csharp konnte man so etwas machen: "PHPSESSID=(?<sessid>(.*)); path";
und dann mit found["sessid"] auslesen, gibt es eine solche Möglichkeit auch in Java?
Danke, Yanick
ich habe folgenden String gegeben:
Code:
etc.....
Server: Apache
X-Powered-By: PHP/5.0.4
Set-Cookie: PHPSESSID=blubbblubb; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: index.php
etc....
und will jetzt die Session Id auslesen, also: "blubbblub".
Ich komme da nicht weiter, kann mir jemand wie ich das löse?
Mein bisheriger Ansatz:
Java:
private String findPhpSessid(String resp){
String pattern = "PHPSESSID=(.*); path";
Pattern p = Pattern.compile(pattern);
Matcher matcher = p.matcher(resp);
if ( matcher.groupCount() <= 0)
throw new Error("Sessid not sent");
matcher.find();
return matcher.group();
}
In Csharp konnte man so etwas machen: "PHPSESSID=(?<sessid>(.*)); path";
und dann mit found["sessid"] auslesen, gibt es eine solche Möglichkeit auch in Java?
Danke, Yanick