commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tatiana Lloret Iglesias" <tllor...@gmail.com>
Subject HttpClient + Session
Date Fri, 30 Mar 2007 16:38:47 GMT
Hi all,

I'm using jakarta httpclient classes to generate a Request from a stand
alone application:

HttpClient client = new HttpClient();
URL filesURL = new URL(myURL");

PostMethod postMethod = new PostMethod(filesURL.toString());

File targetFile = new File(path);
Part[] parts = {new StringPart("serverFileName",serverFileName),
new FilePart(targetFile.getName(), targetFile)
};

postMethod.setRequestEntity(new MultipartRequestEntity(parts,
postMethod.getParams())
);


int statusCode1 = client.executeMethod(postMethod);

My problem is that in the Server side I check Session object:

private boolean isUserAuthenticated(HttpServletRequest request) {
boolean isAuthenticated = false;
HttpSession session = request.getSession(false);
if(session == null) return false;
if (session.getAttribute(Constants.USER_LOGGED) != null) {
isAuthenticated = true;
}
return isAuthenticated;
}

How can I put this Constants.USER_LOGGED variable in httpclient request
object?

Thanks!
T

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message