Re: help on PUT

2009-04-23 Thread helen chen
I worked with weblogic support and we proved that weblogic support the PUT
request. 

 helen chen hc...@aip.org 04/06/09 8:37 AM 
Hi Thierry,

I tested the POST method and it works. So I think you are right, there maybe
some configuration in weblogic that stoped PUT request. I'm going to contact
weblogic support and see what I can get and I'll post back.  Thanks a lot for
your help.

Helen

 Thierry Boileau thierry.boil...@noelios.com 04/06/09 5:55 AM 
Hello Helen,

I have no knowledge of weblogic, but it seems that the access to PUT 
requests is securized.
Is it possible that by default Weblogic forbids that kind of request? Is 
there any configuration that allows you to specific the authorized 
methods for a deployed application?

Best regards,
Thierry Boileau

 Hi there,

 I'm using restlet 1.1.3.

 I created a simple restlet with get and put. then I use client try to test
it.
 I have a local machine using tomcat and it works fine. But when I move to QA
 server which use weblogic 10, even for the  same command, only GET works,
PUT
 somehow  complains:
 Apr 3, 2009 3:05:41 PM org.apache.commons.httpclient.HttpMethodDirector
 isAuthenticationNeeded
 INFO: Authentication requested but doAuthentication is disabled
 PUT output: Unauthorized (401) - Unauthorized

 It looks like the apache httpclient is asking something. Has anyone had this
 problem? 



 the whole output after running the client is as following:

 Apr 3, 2009 3:05:41 PM org.aip.pubtech.testRestlet.client.RLclient PUTtpForm
 INFO: ===PUTtpForm
 Apr 3, 2009 3:05:41 PM com.noelios.restlet.ext.httpclient.HttpClientHelper
 start
 INFO: Starting the HTTP client
 Apr 3, 2009 3:05:41 PM org.apache.commons.httpclient.HttpMethodDirector
 isAuthenticationNeeded
 INFO: Authentication requested but doAuthentication is disabled
 PUT output: Unauthorized (401) - Unauthorized
 Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
 INFO: 
 Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
 INFO: response for the uri :
http://test.int.aip.org/testRestlet/articles/ 

 Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
 INFO: request success
 Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
 INFO: entity available
 now in represent, this is get

 —-- the following is my class for resource —
 package org.aip.pubtech.testRestlet.aps;

 import java.io.IOException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import org.restlet.Context;
 import org.restlet.data.Form;
 import org.restlet.data.MediaType;
 import org.restlet.data.Request;
 import org.restlet.data.Response;
 import org.restlet.data.Status;
 import org.restlet.resource.DomRepresentation;
 import org.restlet.resource.Representation;
 import org.restlet.resource.Resource;
 import org.restlet.resource.ResourceException;
 //import org.restlet.resource.ResourceException;
 import org.restlet.resource.StringRepresentation;
 import org.restlet.resource.Variant;

 public class RLResource extends Resource{
 protected static Logger log = Logger.getLogger(getName());
 public RLResource(Context context, Request request, Response response)
 {
 super(context, request, response);
 this.articleExists = false;

 this.aipkey = (String)
 this.getRequest().getAttributes().get(aipkey);
 if(this.aipkey != null  this.aipkey.trim().length()0)
 {
 this.articleExists = true;
 this.getVariants().add(new
 Variant(MediaType.TEXT_PLAIN));
 this.setModifiable(true);
 }else{
 // this resource is not available
 this.setAvailable(false);
 }

 }

 /**
  * this is GET, return the string to client
  */

 @Override
 public Representation represent(Variant variant) throws
ResourceException
 {
 if(MediaType.TEXT_PLAIN.equals(variant.getMediaType()))
 {
 //   try{
  StringRepresentation sr = new
 StringRepresentation(test,MediaType.TEXT_PLAIN);
  sr.setText(now in represent, this is get);
  return sr;
 //   }catch(IOException e) {
 // e.printStackTrace();
 //   }
 }

 return null;
 }


 @Override
 public void storeRepresentation(Representation entity) throws
 ResourceException
 {
 if(this.aipkey ==null || this.aipkey.trim().length()==0)
 {

 this.getResponse().setStatus(Status.CLIENT_ERROR_UNAUTHORIZED);
 return;
 }

 if( !this.articleExists)
 {

 this.getResponse().setStatus(Status.CLIENT_ERROR_UNAUTHORIZED

Re: how to get config info from web.xml

2009-04-06 Thread helen chen
Hi Alexander,

I'm able to get the config info out from web.xml  using your code sample.  

inside web.xml, somehow I have to use context-param instead of init-param
to get data like:

 context-param
   param-nameinternal-config/param-name
   param-value../param-value
 /context-param

and I get the data. 

Thanks a lot for your help.

Helen



 Alexander J. Perez Tchernov xas...@gmail.com 04/03/09 9:51 AM 
You may try smth like this

ServletContextAdapter adapter = (ServletContextAdapter) getContext();
ServletContext servletContext = adapter.getServletContext();
String filePrefix = servletContext.getInitParameter(internal-configuration)

web.xml
!-- Restlet adaptor --
servlet
servlet-nameRestletServletAdaptor/servlet-name

servlet-classorg.restlet.ext.servlet.ServerServlet/servlet-class
init-param
param-nameinternal-configuration/param-name

param-valueconf/internal-configuration.properties/param-value
/init-param
/servlet


On Thu, Apr 2, 2009 at 10:52 PM, helen chen hc...@aip.org wrote:
 Hi,

 I'm kind of new to Restlet. I'm using 1.1.3 now.

 I want to put some configuration information in the web.xml file,  in common
 jsp, I can use getServletConfig().getServletContext().getInitParameter() to
get
 the information.  Is there any similar way for me to get the information in
 Restlet?

 Thanks, Helen





-- 
Best regards,
 ~ Xasima Xirohata ~

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1532470



Re: help on PUT

2009-04-06 Thread helen chen
Hi Thierry,

I tested the POST method and it works. So I think you are right, there maybe
some configuration in weblogic that stoped PUT request. I'm going to contact
weblogic support and see what I can get and I'll post back.  Thanks a lot for
your help.

Helen

 Thierry Boileau thierry.boil...@noelios.com 04/06/09 5:55 AM 
Hello Helen,

I have no knowledge of weblogic, but it seems that the access to PUT 
requests is securized.
Is it possible that by default Weblogic forbids that kind of request? Is 
there any configuration that allows you to specific the authorized 
methods for a deployed application?

Best regards,
Thierry Boileau

 Hi there,

 I'm using restlet 1.1.3.

 I created a simple restlet with get and put. then I use client try to test
it.
 I have a local machine using tomcat and it works fine. But when I move to QA
 server which use weblogic 10, even for the  same command, only GET works,
PUT
 somehow  complains:
 Apr 3, 2009 3:05:41 PM org.apache.commons.httpclient.HttpMethodDirector
 isAuthenticationNeeded
 INFO: Authentication requested but doAuthentication is disabled
 PUT output: Unauthorized (401) - Unauthorized

 It looks like the apache httpclient is asking something. Has anyone had this
 problem? 



 the whole output after running the client is as following:

 Apr 3, 2009 3:05:41 PM org.aip.pubtech.testRestlet.client.RLclient PUTtpForm
 INFO: ===PUTtpForm
 Apr 3, 2009 3:05:41 PM com.noelios.restlet.ext.httpclient.HttpClientHelper
 start
 INFO: Starting the HTTP client
 Apr 3, 2009 3:05:41 PM org.apache.commons.httpclient.HttpMethodDirector
 isAuthenticationNeeded
 INFO: Authentication requested but doAuthentication is disabled
 PUT output: Unauthorized (401) - Unauthorized
 Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
 INFO: 
 Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
 INFO: response for the uri :
http://test.int.aip.org/testRestlet/articles/ 

 Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
 INFO: request success
 Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
 INFO: entity available
 now in represent, this is get

 —-- the following is my class for resource —
 package org.aip.pubtech.testRestlet.aps;

 import java.io.IOException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import org.restlet.Context;
 import org.restlet.data.Form;
 import org.restlet.data.MediaType;
 import org.restlet.data.Request;
 import org.restlet.data.Response;
 import org.restlet.data.Status;
 import org.restlet.resource.DomRepresentation;
 import org.restlet.resource.Representation;
 import org.restlet.resource.Resource;
 import org.restlet.resource.ResourceException;
 //import org.restlet.resource.ResourceException;
 import org.restlet.resource.StringRepresentation;
 import org.restlet.resource.Variant;

 public class RLResource extends Resource{
 protected static Logger log = Logger.getLogger(getName());
 public RLResource(Context context, Request request, Response response)
 {
 super(context, request, response);
 this.articleExists = false;

 this.aipkey = (String)
 this.getRequest().getAttributes().get(aipkey);
 if(this.aipkey != null  this.aipkey.trim().length()0)
 {
 this.articleExists = true;
 this.getVariants().add(new
 Variant(MediaType.TEXT_PLAIN));
 this.setModifiable(true);
 }else{
 // this resource is not available
 this.setAvailable(false);
 }

 }

 /**
  * this is GET, return the string to client
  */

 @Override
 public Representation represent(Variant variant) throws
ResourceException
 {
 if(MediaType.TEXT_PLAIN.equals(variant.getMediaType()))
 {
 //   try{
  StringRepresentation sr = new
 StringRepresentation(test,MediaType.TEXT_PLAIN);
  sr.setText(now in represent, this is get);
  return sr;
 //   }catch(IOException e) {
 // e.printStackTrace();
 //   }
 }

 return null;
 }


 @Override
 public void storeRepresentation(Representation entity) throws
 ResourceException
 {
 if(this.aipkey ==null || this.aipkey.trim().length()==0)
 {

 this.getResponse().setStatus(Status.CLIENT_ERROR_UNAUTHORIZED);
 return;
 }

 if( !this.articleExists)
 {

 this.getResponse().setStatus(Status.CLIENT_ERROR_UNAUTHORIZED);
 return;
 }

 this.getResponse().setStatus(Status.SUCCESS_OK);
 }catch(Exception e)

help on PUT

2009-04-04 Thread helen chen
Hi there,

I'm using restlet 1.1.3.

I created a simple restlet with get and put. then I use client try to test it.
I have a local machine using tomcat and it works fine. But when I move to QA
server which use weblogic 10, even for the  same command, only GET works, PUT
somehow  complains:
Apr 3, 2009 3:05:41 PM org.apache.commons.httpclient.HttpMethodDirector
isAuthenticationNeeded
INFO: Authentication requested but doAuthentication is disabled
PUT output: Unauthorized (401) - Unauthorized

It looks like the apache httpclient is asking something. Has anyone had this
problem? 



the whole output after running the client is as following:

Apr 3, 2009 3:05:41 PM org.aip.pubtech.testRestlet.client.RLclient PUTtpForm
INFO: ===PUTtpForm
Apr 3, 2009 3:05:41 PM com.noelios.restlet.ext.httpclient.HttpClientHelper
start
INFO: Starting the HTTP client
Apr 3, 2009 3:05:41 PM org.apache.commons.httpclient.HttpMethodDirector
isAuthenticationNeeded
INFO: Authentication requested but doAuthentication is disabled
PUT output: Unauthorized (401) - Unauthorized
Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
INFO: 
Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
INFO: response for the uri : http://test.int.aip.org/testRestlet/articles/

Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
INFO: request success
Apr 3, 2009 3:05:42 PM org.aip.pubtech.testRestlet.client.RLclient get
INFO: entity available
now in represent, this is get

—-- the following is my class for resource —
package org.aip.pubtech.testRestlet.aps;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.restlet.Context;
import org.restlet.data.Form;
import org.restlet.data.MediaType;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.data.Status;
import org.restlet.resource.DomRepresentation;
import org.restlet.resource.Representation;
import org.restlet.resource.Resource;
import org.restlet.resource.ResourceException;
//import org.restlet.resource.ResourceException;
import org.restlet.resource.StringRepresentation;
import org.restlet.resource.Variant;

public class RLResource extends Resource{
protected static Logger log = Logger.getLogger(getName());
public RLResource(Context context, Request request, Response response)
{
super(context, request, response);
this.articleExists = false;

this.aipkey = (String)
this.getRequest().getAttributes().get(aipkey);
if(this.aipkey != null  this.aipkey.trim().length()0)
{
this.articleExists = true;
this.getVariants().add(new
Variant(MediaType.TEXT_PLAIN));
this.setModifiable(true);
}else{
// this resource is not available
this.setAvailable(false);
}

}

/**
 * this is GET, return the string to client
 */

@Override
public Representation represent(Variant variant) throws ResourceException
{
if(MediaType.TEXT_PLAIN.equals(variant.getMediaType()))
{
//   try{
 StringRepresentation sr = new
StringRepresentation(test,MediaType.TEXT_PLAIN);
 sr.setText(now in represent, this is get);
 return sr;
//   }catch(IOException e) {
// e.printStackTrace();
//   }
}

return null;
}


@Override
public void storeRepresentation(Representation entity) throws
ResourceException
{
if(this.aipkey ==null || this.aipkey.trim().length()==0)
{
   
this.getResponse().setStatus(Status.CLIENT_ERROR_UNAUTHORIZED);
return;
}

if( !this.articleExists)
{
   
this.getResponse().setStatus(Status.CLIENT_ERROR_UNAUTHORIZED);
return;
}

this.getResponse().setStatus(Status.SUCCESS_OK);
}catch(Exception e)
{
log.warning(record data exception);
   
this.getResponse().setStatus(Status.SERVER_ERROR_SERVICE_UNAVAILABLE);
}
}

—-- the following is client code —---

package org.aip.pubtech.testRestlet.client;

import java.io.IOException;
import org.restlet.Client;
import org.restlet.data.Form;
import org.restlet.data.MediaType;
import org.restlet.data.Method;
import org.restlet.data.Protocol;
import org.restlet.data.Reference;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.resource.Representation;
import org.restlet.resource.StringRepresentation;

import java.util.logging.Level;
import java.util.logging.Logger;

public class RLclient {
protected static Logger log 

Re: access control

2009-04-03 Thread helen chen
I'm reading the document about the Guard. It looks like when creating a Guard, I
can specify ChallengeScheme.CUSTOM which can be used for IP address check.

But if I do it, then when should I check the IP address? Does that mean I have
to create a sub class of Guard, override method authenticate() and authorize()? 
Does anyone have ever done this? Is there any sample code I can take a look?

since only server side it check IP address, at client side, I guess I don't need
to do request.setChallengeResponse() for the ChallengeSchema.CUSTOM right? 

I would appreciate if anyone has any ideasabout how to deal with it .

helen 



 Helen Chen 04/02/09 5:09 PM 
Hello there,

I'm having a situation like the following:  I need to restrict that only one ip
adddress is allowed to access to a specific uri that is developed by restlet.
And other pages are open to all.

 I know this usually should be done at the web server part. But if I need to do
it through Restlet, Can I use Guard to do it? If yes, does anyone have example?

Thanks, Helen




access control

2009-04-03 Thread helen chen
Hello there,

I'm having a situation like the following:  I need to restrict that only one ip
adddress is allowed to access to a specific uri that is developed by restlet.
And other pages are open to all.

 I know this usually should be done at the web server part. But if I need to do
it through Restlet, Can I use Guard to do it? If yes, does anyone have example?

Thanks, Helen



how to get config info from web.xml

2009-04-03 Thread helen chen
Hi,

I'm kind of new to Restlet. I'm using 1.1.3 now. 

I want to put some configuration information in the web.xml file,  in common
jsp, I can use getServletConfig().getServletContext().getInitParameter() to get
the information.  Is there any similar way for me to get the information in
Restlet?

Thanks, Helen



Re: questions about response.getEntity()

2008-07-18 Thread Helen Chen
I tried response.getEntity().getText()   then I get correct  data out.

maybe just response.getEntity() is not enough.

Helen

 Helen Chen 07/17/08 2:03 PM 
Hello there,

I have a issue when writing the client code. Basically I'm trying to get the
response from a url and then print out the response entity. But I found that if
I do 2 GET  requests one after another, the content of the response will be
stick together.  And I'm using JDK net connector.

The following are part of my client code:

this is a method to do the GET request:
  public static void get(Client client, Reference reference)throws
IOException 
  {
  if(log.isLoggable(Level.WARNING))
  {
  log.log(Level.INFO,);
  log.log(Level.INFO,response for the uri :  +
reference.toString() );
  }

  Response response = client.get(reference);
  if (response.getStatus().isSuccess()) {
 if(log.isLoggable(Level.WARNING))  
log.log(Level.INFO,request success);
 if (response.isEntityAvailable()) {
if(log.isLoggable(Level.WARNING))   
log.log(Level.INFO,entity available);
response.getEntity().write(System.out);
 }
  }
   }


then I have main method to call the get method:
public static void main(String[] args) throws IOException
{
Client client1 = new Client(Protocol.HTTP);
Client client2 = new Client(Protocol.HTTP);

Reference itemURI1 = new
Reference(http://myhost/articles/abc.json;);
Reference itemURI2 = new
Reference(http://myhost/articles/abc.xml;);

 //  I tried to use one client for testing, didn't work,
then I tried to separate each get call with different client, same result
get(client1, itemURI1);
get(client2, itemURI2);
}


the following are the output:
 [java] INFO: 
 [java] INFO: response for the uri : http://myhost/articles/abc.json 
 [java] INFO: request success
 [java] INFO: entity available
 [java] INFO: 
 [java] INFO: response for the uri : http://myhost/articles/abc.xml 
 [java] INFO: request success
 [java] INFO: entity available
 [java] {code:abc}?xml version=1.0
encoding=UTF-8?articlecodeabc/accode/article

the output {code:abc} should be for the first request, and the rest ?xml
version=1.0 encoding=UTF-8?articlecodeabc/accode/article should be
for the second request. You can see the data got sticked together. I actually
tried the apache http connector and I got the same result. Which kind of tells
me that just use response.getEntity() may not be enough to dump data out.

Can anyone tell me the trick how to make it work correctly?

Thanks, Helen


Re: questions about response.getEntity()

2008-07-18 Thread Helen Chen
Hi Stephan,

Thanks for pointing out. I changed the code to write to System.err and it works
as expected.  Thanks a lot.

Helen


 Stephan Koops [EMAIL PROTECTED] 07/18/08 4:08 PM 
Hi Helen,

the reason may be, that the INFOs are logged via System.err, but the 
entity via System.out.
In Java you could not be sure, that if you first write into System.out 
and then into System.err, that the data for System.out reaches your 
console before the data of System.err. So this is only a problem of the 
console
You could add a Thread.sleep(1000) between the calls of your get method 
(ignore the InterruptedException). Than you should see the data in right 
sequence

best regards
   Stephan

Helen Chen schrieb:
 I tried response.getEntity().getText()   then I get correct  data out.

 maybe just response.getEntity() is not enough.

 Helen

   
 Helen Chen 07/17/08 2:03 PM 
 
 Hello there,

 I have a issue when writing the client code. Basically I'm trying to get the
 response from a url and then print out the response entity. But I found that
if
 I do 2 GET  requests one after another, the content of the response will be
 stick together.  And I'm using JDK net connector.

 The following are part of my client code:

 this is a method to do the GET request:
   public static void get(Client client, Reference reference)   
throws
 IOException 
   {
   if(log.isLoggable(Level.WARNING))
   {
   log.log(Level.INFO,);
   log.log(Level.INFO,response for the uri :  +
 reference.toString() );
   }

   Response response = client.get(reference);
   if (response.getStatus().isSuccess()) {
  if(log.isLoggable(Level.WARNING))  
 log.log(Level.INFO,request success);
  if (response.isEntityAvailable()) {
 if(log.isLoggable(Level.WARNING))   
 log.log(Level.INFO,entity available);
 response.getEntity().write(System.out);
  }
   }
}


 then I have main method to call the get method:
 public static void main(String[] args) throws IOException
 {
 Client client1 = new Client(Protocol.HTTP);
 Client client2 = new Client(Protocol.HTTP);

 Reference itemURI1 = new
 Reference(http://myhost/articles/abc.json;);
 Reference itemURI2 = new
 Reference(http://myhost/articles/abc.xml;);

  //  I tried to use one client for testing, didn't work,
 then I tried to separate each get call with different client, same result
 get(client1, itemURI1);
 get(client2, itemURI2);
 }


 the following are the output:
  [java] INFO: 
  [java] INFO: response for the uri : http://myhost/articles/abc.json 
  [java] INFO: request success
  [java] INFO: entity available
  [java] INFO: 
  [java] INFO: response for the uri : http://myhost/articles/abc.xml 
  [java] INFO: request success
  [java] INFO: entity available
  [java] {code:abc}?xml version=1.0
 encoding=UTF-8?articlecodeabc/accode/article

 the output {code:abc} should be for the first request, and the rest
?xml
 version=1.0 encoding=UTF-8?articlecodeabc/accode/article should
be
 for the second request. You can see the data got sticked together. I
actually
 tried the apache http connector and I got the same result. Which kind of
tells
 me that just use response.getEntity() may not be enough to dump data out.

 Can anyone tell me the trick how to make it work correctly?

 Thanks, Helen
   


questions about response.getEntity()

2008-07-17 Thread Helen Chen
Hello there,

I have a issue when writing the client code. Basically I'm trying to get the
response from a url and then print out the response entity. But I found that if
I do 2 GET  requests one after another, the content of the response will be
stick together.  And I'm using JDK net connector.

The following are part of my client code:

this is a method to do the GET request:
  public static void get(Client client, Reference reference)throws
IOException 
  {
  if(log.isLoggable(Level.WARNING))
  {
  log.log(Level.INFO,);
  log.log(Level.INFO,response for the uri :  +
reference.toString() );
  }

  Response response = client.get(reference);
  if (response.getStatus().isSuccess()) {
 if(log.isLoggable(Level.WARNING))  
log.log(Level.INFO,request success);
 if (response.isEntityAvailable()) {
if(log.isLoggable(Level.WARNING))   
log.log(Level.INFO,entity available);
response.getEntity().write(System.out);
 }
  }
   }


then I have main method to call the get method:
public static void main(String[] args) throws IOException
{
Client client1 = new Client(Protocol.HTTP);
Client client2 = new Client(Protocol.HTTP);

Reference itemURI1 = new
Reference(http://myhost/articles/abc.json;);
Reference itemURI2 = new
Reference(http://myhost/articles/abc.xml;);

 //  I tried to use one client for testing, didn't work,
then I tried to separate each get call with different client, same result
get(client1, itemURI1);
get(client2, itemURI2);
}


the following are the output:
 [java] INFO: 
 [java] INFO: response for the uri : http://myhost/articles/abc.json 
 [java] INFO: request success
 [java] INFO: entity available
 [java] INFO: 
 [java] INFO: response for the uri : http://myhost/articles/abc.xml 
 [java] INFO: request success
 [java] INFO: entity available
 [java] {code:abc}?xml version=1.0
encoding=UTF-8?articlecodeabc/accode/article

the output {code:abc} should be for the first request, and the rest ?xml
version=1.0 encoding=UTF-8?articlecodeabc/accode/article should be
for the second request. You can see the data got sticked together. I actually
tried the apache http connector and I got the same result. Which kind of tells
me that just use response.getEntity() may not be enough to dump data out.

Can anyone tell me the trick how to make it work correctly?

Thanks, Helen


Re: how can client make request through proxyserver

2008-07-16 Thread Helen Chen
Hi Thierry,

Thanks a lot for your help.

Helen

 Thierry Boileau [EMAIL PROTECTED] 07/16/08 4:21 AM 
Hi Helen,

Do you know when the restlet framework is going to provide ways to handle the
proxyserver without affecting the whole jvm? 

There is an RFE that aims at defining several parameters about the 
configuration of intermediate proxy.
http://restlet.tigris.org/issues/show_bug.cgi?id=317 
I complete this issue with your request.

best regards,
Thierry Boileau

 Hello Thierry,

 Thanks a lot for your help . I made both of  the client request through
 proxyserver and PUT work now. 

 Originally I was thinking to make it available in the classpath so other
code
 can just call the method to get the response and handle the return  and then
 continue the process. But since the system property will affect the jvm and
will
 have side effect on other programs  I can only make it as a standalone
program
 now.  

 Do you know when the restlet framework is going to provide  ways to handle
the
 proxyserver without affecting the whole jvm? 

 In any case I think restlet is a very good framework because I just started
 learning and I can make the service up running and accepting GET/PUT in very
 short time, it is easy to use.

 Best regards, Helen

   
 Thierry Boileau [EMAIL PROTECTED] 07/15/08 3:51 AM 
 
 Hello Helen,

   
 From this logged issue, does this mean that unless using JDK net connector
 there is no way to make client request through proxyserver? 
 
 Actually, the Restlet framework provides 2 HTTP client connectors:
  - the one based on the Apache HTTP client project
  - the one based on the JDK (i.e. on the HttpURLConnection class)
 You are totally free to choose one instead of the other.
 In your case, you must use the client connector based on the JDK and set up
 some system properties: 
  System.setProperty(http.proxyHost,myhostname);
  System.setProperty(http.proxyPort,80);

 We encourage you to have a look at this page [1], which explains how to make
 your application use one connector instead of another one.
 In order to summaraize, you have to update your classpath as follow.
 include name=org.restlet.jar /
 include name=com.noelios.restlet.jar /
 include name=

http://maven.restlet.org/com/noelios/restlet/com.noelios.restlet.ext.net/1.0.10/com.noelios.restlet.ext.net-1.0.10.jarcom.noelios.restlet.ext.net_1.0.10.jar
 /
 include name=json-lib-2.2.2-jdk15.jar /



   
 And can anyone show me how to make a client PUT request using JDK net
 
 connector?
 I would like to point that the way to make a PUT request does not depend on
the
 type of client connector.
 It should be more or less :
 Client client = new Client(Protocol.HTTP);
 Representation rep = new StringRepresentation(This is a sample PUT
request,
 MediaType.TEXT_PLAIN);
 Response response = client.put(http://myserver/resource;, rep);

 or
 Client client = new Client(Protocol.HTTP);
 Request request = new Request(Method.PUT, http://myserver/resource;);
 Representation rep = new StringRepresentation(This is a sample PUT
request,
 MediaType.TEXT_PLAIN);
 request.setEntity(rep); 
 Response response = client.handle(request);

 Feel free to post any other remarks.

 best regards,
 Thierry Boileau


 [1] http://www.restlet.org/documentation/1.0/connectors 
 [2] http://www.restlet.org/documentation/1.0/connectors#client_connectors 
   
 Hello there,

 I'm new to restlet and I'm using version 1.0.  I'm trying to make a client
 request through the proxy server. And since this is  the first time for me
 
 to
   
 write code using restlet framework, I followed the the tutorial Restlet 1.0
 
 -
   
 First resource to do it.  But I tried some ways and I could not make the
 
 client
   
 request through our proxy server.

 I searched around and found that  there is an issue logged for restlet
 regarding the proxyserver:
 
 http://restlet.tigris.org/issues/show_bug.cgi?id=317 
   
 From this logged issue, does this mean that unless using JDK net connector
 there is no way to make client request through proxyserver?  And can anyone
 
 show
   
 me how to make a client PUT request using JDK net connector?

 Thanks, Helen


   
 
 Helen Chen [EMAIL PROTECTED] 07/11/08 11:21 AM 
 
   
 Hi Thierry,

 I followed the sample client code from document Restlet 1.0 - First
 
 resource,
   
 and the following are the jar files in my classpath when I run the client
 code,
 so I think I'm using apache commons http client connector.
 include name=org.restlet.jar /
 include name=com.noelios.restlet.jar /
 include
 name=com.noelios.restlet.ext.httpclient_3.1.jar /
 include name=json-lib-2.2.2-jdk15.jar /
 include name=org.apache.commons.lang-2.3.jar /
 include name=org.apache.commons.logging_1.1.jar
 
 /
   
 include
 
 name

Re: how can client make request through proxyserver

2008-07-14 Thread Helen Chen
Hello there,

I'm new to restlet and I'm using version 1.0.  I'm trying to make a client
request through the proxy server. And since this is  the first time for me to
write code using restlet framework, I followed the the tutorial Restlet 1.0 -
First resource to do it.  But I tried some ways and I could not make the client
request through our proxy server.

I searched around and found that  there is an issue logged for restlet
regarding the proxyserver: http://restlet.tigris.org/issues/show_bug.cgi?id=317

From this logged issue, does this mean that unless using JDK net connector
there is no way to make client request through proxyserver?  And can anyone show
me how to make a client PUT request using JDK net connector?

Thanks, Helen


 Helen Chen [EMAIL PROTECTED] 07/11/08 11:21 AM 
Hi Thierry,

I followed the sample client code from document Restlet 1.0 - First resource,
and the following are the jar files in my classpath when I run the client
code,
so I think I'm using apache commons http client connector.
include name=org.restlet.jar /
include name=com.noelios.restlet.jar /
include
name=com.noelios.restlet.ext.httpclient_3.1.jar /
include name=json-lib-2.2.2-jdk15.jar /
include name=org.apache.commons.lang-2.3.jar /
include name=org.apache.commons.logging_1.1.jar /
include name=org.apache.commons.httpclient_3.1.jar
/
include name=org.apache.commons.codec_1.3.jar /


Do you know how I can make it work to go through the proxyserver? Or do you
have any suggestions on it?

Thanks, Helen


 Thierry Boileau [EMAIL PROTECTED] 07/11/08 3:26 AM 
Hello Helen,

what kind of client connector are you using? These parameters apply only 
with the JDK client, that is to say the net connector.

best regards,
Thierry Boileau

 Hello there,

 I'm new to restlet and I'm using restlet 1.0 now.

 I'm trying to do a client request through the proxyserver, I tried the
 following ways but they don't work.

   this is one thing I tried  (this kind of followed the sample from the
 document restlet 1.0- First resource - the client application):
   Client client = new Client(Protocol.HTTP);
  System.setProperty(http.proxyHost,myhostname);
  System.setProperty(http.proxyPort,80);
   Reference itemsUri1 = new Reference( mytesturl);
   ...
   get(client, itemsUri1);
  

  and then I tried another way:
   Client client = new Client(Protocol.HTTP);
   client.getContext().getParameters().add(http.proxyHost
,myhostname);
   client.getContext().getParameters().add(http.proxyPort ,80);
   
   get(client, itemsUri1);


 They don't work.   There must be something I missed.  Can anyone help me
out?

 If I have to use the new release Version 1.1 M4, I can try it.

 Thanks, Helen 

   


Re: how can client make request through proxyserver

2008-07-11 Thread Helen Chen
Hi Thierry,

I followed the sample client code from document Restlet 1.0 - First resource,
and the following are the jar files in my classpath when I run the client code,
so I think I'm using apache commons http client connector.
include name=org.restlet.jar /
include name=com.noelios.restlet.jar /
include
name=com.noelios.restlet.ext.httpclient_3.1.jar /
include name=json-lib-2.2.2-jdk15.jar /
include name=org.apache.commons.lang-2.3.jar /
include name=org.apache.commons.logging_1.1.jar /
include name=org.apache.commons.httpclient_3.1.jar
/
include name=org.apache.commons.codec_1.3.jar /


Do you know how I can make it work to go through the proxyserver? Or do you
have any suggestions on it?

Thanks, Helen


 Thierry Boileau [EMAIL PROTECTED] 07/11/08 3:26 AM 
Hello Helen,

what kind of client connector are you using? These parameters apply only 
with the JDK client, that is to say the net connector.

best regards,
Thierry Boileau

 Hello there,

 I'm new to restlet and I'm using restlet 1.0 now.

 I'm trying to do a client request through the proxyserver, I tried the
 following ways but they don't work.

   this is one thing I tried  (this kind of followed the sample from the
 document restlet 1.0- First resource - the client application):
   Client client = new Client(Protocol.HTTP);
  System.setProperty(http.proxyHost,myhostname);
  System.setProperty(http.proxyPort,80);
   Reference itemsUri1 = new Reference( mytesturl);
   ...
   get(client, itemsUri1);
  

  and then I tried another way:
   Client client = new Client(Protocol.HTTP);
   client.getContext().getParameters().add(http.proxyHost
,myhostname);
   client.getContext().getParameters().add(http.proxyPort ,80);
   
   get(client, itemsUri1);


 They don't work.   There must be something I missed.  Can anyone help me out?

 If I have to use the new release Version 1.1 M4, I can try it.

 Thanks, Helen 

   


how can client make request through proxyserver

2008-07-10 Thread Helen Chen
Hello there,

I'm new to restlet and I'm using restlet 1.0 now.

I'm trying to do a client request through the proxyserver, I tried the
following ways but they don't work.

  this is one thing I tried  (this kind of followed the sample from the
document restlet 1.0- First resource - the client application):
  Client client = new Client(Protocol.HTTP);
 System.setProperty(http.proxyHost,myhostname);
 System.setProperty(http.proxyPort,80);
  Reference itemsUri1 = new Reference( mytesturl);
  ...
  get(client, itemsUri1);
 

 and then I tried another way:
  Client client = new Client(Protocol.HTTP);
  client.getContext().getParameters().add(http.proxyHost ,myhostname);
  client.getContext().getParameters().add(http.proxyPort ,80);
  
  get(client, itemsUri1);


They don't work.   There must be something I missed.  Can anyone help me out? 
If I have to use the new release Version 1.1 M4, I can try it.

Thanks, Helen