wordpress-java-integration  자바와 워드프레스 통합

 

wordpress-java

  • Last Published: 2016-12-25 |
  •  
  • Version: 0.6.5

Introduction

This is a Java client library to interact with the xmlrpc interface of wordpress. It currently supports all functionality exposed by the XML-RPC Wordpress API. You can use it to manipulate contents, comments, media and users of a Wordpress blog.

A command line interface is also provided, making it possible to access the XML-RPC API in scripts.

Usage

There are two interfaces for wordpress-java:

Java API

Include wordpress-java dependency in your project as explained in here.

Have a look at this short example, for starters:

Wordpress wp = new Wordpress(username, password, xmlRpcUrl);
FilterPost filter = new FilterPost();
filter.setNumber(10);
List<Post> recentPosts = wp.getPosts(filter);
System.out.println("Here are the ten recent posts:");
for (Post page : recentPosts) {
  System.out.println(page.getPost_id() + ":" + page.getPost_title());
}
FilterPost filter2 = new FilterPost();
filter2.setPost_type("page");
wp.getPosts(filter2);
List<Post> pages = wp.getPosts(filter2);
System.out.println("Here are the pages:");
for (Post pageDefinition : pages) {
  System.out.println(pageDefinition.getPost_title());
}
System.out.println("Posting a test (draft) page...");
Post recentPost = new Post();
recentPost.setPost_title("Test Page");
recentPost.setPost_content("Test description");
recentPost.setPost_status("draft");
Integer result = wp.newPost(recentPost);
System.out.println("new post page id: " + result);

For all available functionality, check out the javadocsJunit tests can also help as a reference.

Command Line Interface

Command line interface can be installed as explained in the Installation section, or you can directly execute the jar:

java -jar target/jwordpress-<version>-cli.jar --user <user> --pass <pass> --url <xmlrpcurl> COMMAND

For example, here is how to get a list of users in the Wordpress installation:

$ java -jar target/jwordpress-0.6-cli.jar --user admin --pass admin --url http://wordpressjava-test.local/xmlrpc.php -a
User_id:User_login:display_name
admin:1:admin
testuser:2:testuser

You can get a list of all options using -? option:

$ java -jar target/jwordpress-0.6-cli.jar --user admin --pass admin --url http://wordpressjava-test.local/xmlrpc.php -?
usage:
 -?,--help                    Print usage information
 -a,--authors                 Get author list
 -c,--categories              Get category list
 -ca,--newcomment <arg>       New comment from file
 -cc,--commentcount <arg>     Get comment count for a post (-1 for all
                              posts)
 -cd,--deletecomment <arg>    Delete comment
 -ce,--editcomment <arg>      Edit comment from file
 -cg,--getcomment <arg>       Get comment
 -cm,--commentnumber <arg>    Comment # (for --getcomments)
 -cn,--newcategory <arg>      New category (uses --slug and --parentid)
 -co,--commentoffset <arg>    Comment offset # (for --getcomments)
 -cr,--deletecategory <arg>   Delete category <category_id>
 -cs,--commentstatus <arg>    Comment status (for --getcomments)
 -ct,--getcomments <arg>      Get comments for the post
 -h,--url <arg>               Specify the url to xmlrpc.php
 -mn,--newmedia <arg>         New media file (uses --overwrite)
 -od,--deletepost <arg>       Delete post
 -oe,--editpost <arg>         Edit post (needs --postid)
 -oi,--postid <arg>           Post id for posts
 -on,--newpost <arg>          New post from file <arg>
 -or,--recentposts <arg>      Get recent posts
 -os,--getpost <arg>          Get post
 -ov,--overwrite              Allow overwrite in uploading new media
 -p,--pass <arg>              Password
 -pi,--parentid <arg>         Parent id for categories
 -s,--slug <arg>              Slug for categories
 -so,--supportedstatus        Print supported post status values
 -u,--user <arg>              User name
 -us,--userinfo               Get user information

If you don't prefer entering --user--pass and --url options for every command, have a look at How to Save Options in Preferences wiki entry.

Contributing

All your contributions are welcome. Please create pull requests for code and documentation changes at Github. You can also report issues and concerns at the Issues section of Github.

If you are using wordpress-java in your product or project, please let me know. I would love to list it here.

Help

You can ask your questions by creating an issue at the Issues section of Github. Remember to tag it as question, just for tidiness.

Please also have a look at the Wiki pages for a few tricks on using wordpress-java.

Installation

Requirements

If you download the distribution package, available at here, you need a working java runtime environment for the command line interface.

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

You can use Maven or a similar tool to get all dependencies of the library for developing applications using the API.

Installation

In order to use the API in your project, include wordpress-java dependency in your project as explained in here.

Command line interface can be installed using the files in the jwordpress-version-cliapi.zip archive. Copy jwordpress and jwordpress*jar files to a directory on your path and execute jwordpress.

Configuration

There is no mandatory configuration for things to run, just the username, password and the xmlrpc url of the Wordpress installation. Latest versions of Wordpress enables xmlrpc by default, but if there are problems connecting to the site, check your Wordpress settings.

Credits

I (Can Bican) designed and coded most of the API.

  • Fred Potter contributed to functionality related to comments.
  • Alok Saldanha provided patches for custom fields.
  • Jorge Valdivia added the missing featured image support.
  • Commandoser (github username) provided patches for enabling correct mime types.
  • Aliaksei Zhuk fixed the problem of passing incorrect data to editPost().
  • Bruno Candido Volpato da Cunha changed uploadFile() to pass the file name to the server.

Please let me know if I am missing any code contributions.

Contact

For project related issues and questions, please use Github project facilities. If you wish to contact me for other purposes, please contact me at my-name at my-surname.net.

License

Wordpress-Java is licensed under the terms of either the MIT license or the GNU General Public License (GPL) Version 3.

You don’t have to do anything special to choose one license or the other and you don’t have to notify anyone which license you are using. You are free to use a wordpress-java in commercial projects as long as the copyright header is left intact.

See the file COPYING-GPL for the GNU General Public License and COPYING-MIT for the MIT license.


Copyright © 2012–2016 Can Bican. All rights reserved.

 

[출처] http://bican.net/wordpress-java/

[코드레파지토리] https://github.com/canbican/wordpress-java

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
204 스프링(Spring) 프레임워크 기본 개념 강좌 (6) - Dynamic Proxy 졸리운_곰 2017.10.02 71
203 스프링(Spring) 프레임워크 기본 개념 강좌 (5) - AOP Proxy file 졸리운_곰 2017.10.02 158
202 스프링(Spring) 프레임워크 기본 개념 강좌 (4) - AOP file 졸리운_곰 2017.10.02 109
201 스프링(Spring) 프레임워크 기본 개념 강좌 (3) - IoC file 졸리운_곰 2017.10.02 114
200 스프링(Spring) 프레임워크 기본 개념 강좌 (2) - 주요 구성 요소 & DI file 졸리운_곰 2017.10.02 107
199 스프링(Spring) 프레임워크 기본 개념 강좌 (1) - 스프링 이해하기 file 졸리운_곰 2017.10.02 290
198 Spring - IoC & DI file 졸리운_곰 2017.10.02 64
197 WebDAV 구현을 위한 환경 설정 file 졸리운_곰 2017.09.24 74
196 [subclipse] svn에서 무시할 파일 설정하기 svn:ignore property 설정 file 졸리운_곰 2017.09.24 145
195 다섯개의 탑 자바로 머신러닝 라이브러리 Top 5 machine learning libraries for Java file 졸리운_곰 2017.08.22 161
194 이진 파일, 이진 모드로 열어서 읽기 예제 소스 졸리운_곰 2017.05.20 135
193 Converting C# code in JAVA / datatype problem 졸리운_곰 2017.05.20 219
192 DwgFile.java - Joinup 졸리운_곰 2017.04.27 729
191 자바에서 C# 호출하기 file 졸리운_곰 2017.04.26 236
190 java4autocad Java for Autocad file 졸리운_곰 2017.04.26 257
189 Comparison between C# and Java - DiVA.pdf file 졸리운_곰 2017.04.25 682
188 [Java] Apache Commons HttpClient로 SSL 통신하기 졸리운_곰 2017.03.27 545
187 jsoup 사용하기 졸리운_곰 2017.03.27 116
186 Java Annotation: 인터페이스 강요로부터 자유를… file 졸리운_곰 2017.03.20 77
185 JSoup를 이용한 HTML 파싱 졸리운_곰 2017.03.04 100
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED