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/1111 > > 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 = > Logger.getLogger(org.aip.pubtech.testRestlet.client.RLclient.class.getName()); > > public static void main(String[] args) throws IOException > { > > Client client1 = new Client(Protocol.HTTP); > Reference itemURI1 =null; > > itemURI1 = new > Reference("http://test.int.aip.org/testRestlet/articles/1111"); > > PUTtpForm(client1, itemURI1); > get(client1, itemURI1); > } > > public static void PUTtpForm(Client client, Reference RLUri) > { > if(log.isLoggable(Level.WARNING)) > { > > log.log(Level.INFO,"===================PUTtpForm============================"); > } > > Form form = new Form(); > form.add("name", "test"); > > Representation rep = form.getWebRepresentation(); > > Response response = client.put(RLUri, rep); > > System.out.println("PUT output: " + response.getStatus()); > > } > } > > > > > > Thanks, helen > > >