android-openrat

Unnamed repository; edit this file 'description' to name the repository.
git clone http://git.code.weiherhei.de/android-openrat.git
Log | Files | Refs

CMSRequest.java (2680B)


      1 /*
      2 OpenRat Java-Client
      3 Copyright (C) 2009 Jan Dankert
      4  
      5 This library is free software; you can redistribute it and/or
      6 modify it under the terms of the GNU Library General Public
      7 License as published by the Free Software Foundation; either
      8 version 2 of the License, or (at your option) any later version.
      9 
     10 This library is distributed in the hope that it will be useful,
     11 but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13 Library General Public License for more details.
     14 
     15 You should have received a copy of the GNU Library General Public
     16 License along with this library; if not, write to the
     17 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
     18 Boston, MA  02110-1301, USA.
     19 
     20  */
     21 package de.openrat.client;
     22 
     23 import java.io.Serializable;
     24 
     25 /**
     26  * API-Request to the OpenRat Content Management System. <br>
     27  * <br>
     28  * The call to the CMS server is done via a (non-SSL) HTTP connection.<br>
     29  * <br>
     30  * Before a call you are able to set some key/value-pairs as parameters. After
     31  * calling the CMS a DOM-document is returned, which contains the server
     32  * response.<br>
     33  * Example <br>
     34  * 
     35  * <pre>
     36  * CMSRequest request = new CMSRequest(&quot;your.openrat.example.com&quot;);
     37  * //prints tracing information to stdout.
     38  * request.trace = true;
     39  * try
     40  * {
     41  * 	request.parameter.put(&quot;action&quot;, &quot;index&quot;);
     42  * 	request.parameter.put(&quot;subaction&quot;, &quot;showlogin&quot;); // login page
     43  * 	request.parameter.put(&quot;...&quot;, &quot;...&quot;);
     44  * 	Document response = request.call();
     45  * 	// now traverse through the dom tree and get your information.
     46  * } catch (IOException e)
     47  * {
     48  * 	// your error handling.
     49  * }
     50  * </pre>
     51  * 
     52  * @author Jan Dankert
     53  */
     54 public class CMSRequest extends HTTPRequest implements Serializable
     55 {
     56 
     57 	/**
     58 	 * 
     59 	 */
     60 	public CMSRequest()
     61 	{
     62 		super();
     63 	}
     64 
     65 	/**
     66 	 * @param host
     67 	 * @param path
     68 	 * @param port
     69 	 */
     70 	public CMSRequest(String host, String path, int port)
     71 	{
     72 		super(host, path, port);
     73 	}
     74 
     75 	/**
     76 	 * @param host
     77 	 * @param path
     78 	 */
     79 	public CMSRequest(String host, String path)
     80 	{
     81 		super(host, path);
     82 	}
     83 
     84 	/**
     85 	 * @param host
     86 	 */
     87 	public CMSRequest(String host)
     88 	{
     89 		super(host);
     90 	}
     91 
     92 	/**
     93 	 * Setzt die Action.
     94 	 * 
     95 	 * @param actionName
     96 	 */
     97 	public void setAction(String actionName)
     98 	{
     99 		super.setParameter("action", actionName);
    100 	}
    101 
    102 	/**
    103 	 * Setzt die Action-Methode.
    104 	 * 
    105 	 * @param methodName
    106 	 */
    107 	public void setActionMethod(String methodName)
    108 	{
    109 		super.setParameter("subaction", methodName);
    110 	}
    111 	
    112 	/**
    113 	 * Setzt die Action-Methode.
    114 	 * 
    115 	 * @param id
    116 	 */
    117 	public void setId(String id)
    118 	{
    119 		super.setParameter("id", id);
    120 	}
    121 
    122 }