uploadserive法西斯是什么意思思

评论-1138&
trackbacks-0
WebService处理传递普通的信息,还可以传输文件,下面介绍WebService是怎么完成文件传输的。
1、 首先编写服务器端上传文件的WebService方法
package com.hoo.import java.io.Fimport java.io.FileNotFoundEimport java.io.FileOutputSimport java.io.InputSimport javax.activation.DataH/** * &b&function:&/b&Axis WebService完成文件上传服务器端 * @author hoojo * @createDate Dec 18, :16 PM * @file UploadFileService.java * @package com.hoo.service * @project AxisWebService * @blog http://blog.csdn.net/IBM_hoojo * @email hoojo_@ * @version 1.0 */public class UploadFileService {
* &b&function:&/b&传递文件
* @author hoojo
* @createDate Dec 18, :58 PM
* @param handler DataHandler这个参数必须
* @param fileName 文件名称
* @return upload Info
public String upload(DataHandler handler, String fileName) {
if (fileName != null && !"".equals(fileName)) {
File file = new File(fileName);
if (handler != null) {
InputStream is = null;
FileOutputStream fos = null;
is = handler.getInputStream();
fos = new FileOutputStream(file);
byte[] buff = new byte[1024 * 8];
int len = 0;
while ((len = is.read(buff)) & 0) {
fos.write(buff, 0, len);
} catch(FileNotFoundException e) {
return "fileNotFound";
} catch (Exception e) {
return "upload File failure";
} finally {
if (fos != null) {
fos.flush();
fos.close();
if (is != null) {
is.close();
} catch (Exception e) {
e.printStackTrace();
return "file absolute path:" + file.getAbsolutePath();
return "handler is null";
return "fileName is null";
上传方法和我们以前在Web中上传唯一不同的就是参数一DataHandler,可以将这类看成文件传输器,他可以把文件序列化。然后通过DataHandler可以得到一个输入流InputStream,通过这个流可以读到文件的内容。其他的操作和普通上传类似。
2、 定制wsdd发布文件上传的WebService服务
&?xml version="1.0" encoding="UTF-8"?&&deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"&
&service name="UploadFile" provider="java:RPC"&
&parameter name="className" value="com.hoo.service.UploadFileService" /&
&parameter name="allowedMethods" value="*" /&
&parameter name="scope" value="Session" /&
&!-- 和服务器端上传文件的方法签名对应,参数也对应 --&
&operation name="upload" qname="operNS:upload" xmlns:operNS="upload" returnType="rns:string"
xmlns:rns="http://www.w3.org/2001/XMLSchema"&
&parameter name="handler" type="ns:DataHandler" xmlns:ns="http://www.w3.org/2001/XMLSchema"/&
&parameter name="fileName" type="ns:string" xmlns:ns="http://www.w3.org/2001/XMLSchema"/&
&/operation&
&typeMapping qname="hns:DataHandler" xmlns:hns="ns:FileUploadHandler"
languageSpecificType="java:javax.activation.DataHandler"
serializer="org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory" deserializer="org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&
&/service&&/deployment&
上面才xml节点元素在前面都见过了,说明下operation中的参数,注意要指定参数类型,特别是DataHandler的类型,然后就是typeMapping的serializer、deserializer的序列化和反序列化工厂类的配置。
3、 用dos命令发布当前WebService
C:\SoftWare\tomcat-5.0.28\tomcat-5.0.28\webapps\AxisWebService\WEB-INF&java -Djava.ext.dirs=lib org.apache.axis.client.AdminClient -lhttp://localhost:8080/AxisWebService/services/AdminService deployUpload.wsdd
发布完成后,可以通过这个地址查看uploadFile这个service了
4、 编写客户端代码
package com.hoo.import java.rmi.RemoteEimport javax.activation.DataHimport javax.activation.FileDataSimport javax.xml.namespace.QNimport javax.xml.rpc.ParameterMimport javax.xml.rpc.ServiceEimport org.apache.axis.client.Cimport org.apache.axis.client.Simport org.apache.axis.encoding.XMLTimport org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFimport org.apache.axis.encoding.ser.JAFDataHandlerSerializerF/** * &b&function:&/b&上传文件WebService客户端 *
* @author hoojo * @createDate Dec 18, :14 PM * @file UploadFileClient.java * @package com.hoo.client * @project AxisWebService * @blog http://blog.csdn.net/IBM_hoojo * @email hoojo_@ * @version 1.0 */public class UploadFileClient {
public static void main(String[] args) throws ServiceException, RemoteException {
String url = "http://localhost:8080/AxisWebService/services/UploadFile";
String fileName = "readMe.txt";
String path = System.getProperty("user.dir") + "\\WebRoot\\" + fileN
System.out.println(path);
//这样就相当于构造了一个带文件路径的File了
DataHandler handler = new DataHandler(new FileDataSource(path));
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
* 注册异常类信息和序列化类 ns:FileUploadHandler 和 wsdd 配置文件中的typeMapping中的xmlns:hns="ns:FileUploadHandler" 的对应 DataHandler
* 和 wsdd 配置文件中的typeMapping中的qname="hns:DataHandler"的DataHandler对应
QName qn = new QName("ns:FileUploadHandler", "DataHandler");
call.registerTypeMapping(DataHandler.class, qn,
JAFDataHandlerSerializerFactory.class,
JAFDataHandlerDeserializerFactory.class);
call.setOperationName(new QName(url, "upload"));
//设置方法形参,注意的是参数1的type的DataHandler类型的,和上面的qn的类型是一样的
call.addParameter("handler", qn, ParameterMode.IN);
call.addParameter("fileName", XMLType.XSD_STRING, ParameterMode.IN);
//设置返回值类型,下面2种方法都可以
call.setReturnClass(String.class);
//call.setReturnType(XMLType.XSD_STRING);
String result = (String) call.invoke(new Object[] { handler, "remote_server_readMe.txt" });
System.out.println(result);
至此,文件传输就完成了。怎么样,还不错吧!
如果你用myEclipse进行开发的话,运行时可能会出现以下的错误:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream
原因是jar包版本不统一,解决方法如下:
删除Java EE 5 Libraries/javaee.jar/mail里的包有东西.
具体方法如下:
用rar打开X:/Program Files/MyEclipse 6.0/myeclipse/eclipse/plugins/com.genuitec.eclipse.j2eedt.core_6.0.1.zmyeclipse/data/libraryset/EE_5/javaee.jar,然后删除mail,一切就ok了.
阅读(...) 评论()1530人阅读
* Copyright (C) 2006 The Android Open Source Project
* Licensed under the Apache License, Version 2.0 (the &License&);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an &AS IS& BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
package com.android.
import com.android.camera.ImageManager.II
import com.android.internal.http.multipart.P
import com.android.internal.http.multipart.MultipartE
import com.android.internal.http.multipart.PartB
import android.app.N
import android.app.NotificationM
import android.app.S
import ponentN
import android.content.I
import android.content.IntentF
import android.net.U
import android.os.B
import android.os.IB
import android.os.P
import android.preference.PreferenceM
import android.sax.E
import android.sax.ElementL
import android.sax.EndTextElementL
import android.sax.RootE
import android.util.C
import android.util.L
import android.util.X
import com.google.android.googleapps.GoogleLoginCredentialsR
import com.google.android.googlelogin.GoogleLoginServiceBlockingH
import com.google.android.googlelogin.GoogleLoginServiceC
import com.google.android.googlelogin.GoogleLoginServiceNotFoundE
import org.xml.sax.A
import org.xml.sax.ContentH
import org.xml.sax.SAXE
import android.net.http.AndroidHttpC
import org.apache.http.client.methods.HttpP
import org.apache.http.client.methods.HttpG
import com.android.internal.http.multipart.StringP
import org.apache.http.H
import org.apache.http.HttpE
import org.apache.http.HttpR
import org.apache.http.HttpS
import org.apache.http.entity.StringE
import org.apache.http.message.BasicH
import org.apache.http.params.HttpP
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EncodingU
import java.io.BufferedR
import java.io.FileInputS
import java.io.IOE
import java.io.InputS
import java.io.InputStreamR
import java.io.OutputS
import java.io.StringW
import java.util.ArrayL
import java.util.HashM
UploadService
implements
&UploadService&
LOCAL_LOGV
GoogleLoginServiceBlockingHelper
MSG_STATUS
EVENT_UPLOAD_ERROR
sPicasaService
sYouTubeService
sYouTubeUserService
&YouTubeUser&
sUploadAlbumName
&android_upload&
mAndroidUploadAlbumPhotos
mGDataAuthTokenMap
mStatusListeners
mUploadList
ImageManager
.IImageList
mImageList
mPicasaUsername
mPicasaAuthToken
mYouTubeUsername
mYouTubeAuthToken
AndroidHttpClient
AndroidHttpClient
.newInstance
&Android-Camera/0.1&
ComponentName
ComponentName
&com.google.android.googleapps&
&com.google.android.googleapps.GoogleLoginService&
UploadService
LOCAL_LOGV
, &UploadService Constructor !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&
computeAuthToken
LOCAL_LOGV
, &computeAuthToken()&
mPicasaAuthToken
.getAccount
GoogleLoginServiceConstants
.REQUIRE_GOOGLE
GoogleLoginCredentialsResult
.getCredentials
, sPicasaService
mPicasaAuthToken
.getCredentialsString
mPicasaUsername
.getAccount
, &mPicasaUsername is &
mPicasaUsername
GoogleLoginServiceNotFoundException
, &Could not get auth token&
computeYouTubeAuthToken
LOCAL_LOGV
, &computeYouTubeAuthToken()&
mYouTubeAuthToken
.getAccount
GoogleLoginServiceConstants
.REQUIRE_GOOGLE
GoogleLoginCredentialsResult
.getCredentials
, sYouTubeService
mYouTubeAuthToken
.getCredentialsString
mYouTubeUsername
.getAccount
mYouTubeAuthToken
&NoLinkedYouTubeAccount&
// we successfully logged in to the google account, but it
// is not linked to a YouTube username.
, &account &
mYouTubeUsername
& is not linked to a youtube account&
mYouTubeAuthToken
mYouTubeUsername
.peekCredentials
mYouTubeUsername
, sYouTubeUserService
// now mYouTubeUsername is the YouTube username linked to the
// google account, which is probably what we want to display.
, &3 mYouTubeUsername: &
mYouTubeUsername
GoogleLoginServiceNotFoundException
, &Could not get auth token&
NotificationManager
mNotificationManager
GoogleLoginServiceBlockingHelper
GoogleLoginServiceNotFoundException
, &Could not find google login service, stopping service&
mNotificationManager
NotificationManager
getSystemService
NOTIFICATION_SERVICE
IntentFilter
intentFilter
IntentFilter
&com.android.camera.NEW_PICTURE&
.BroadcastReceiver
.SharedPreferences
PreferenceManager
.getDefaultSharedPreferences
.getBoolean
&pref_camera_autoupload_key&
, &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& auto upload &
registerReceiver
, intentFilter
.BroadcastReceiver
unregisterReceiver
LOCAL_LOGV
, &UploadService.onS this is &
mImageList
mImageList
ImageManager
.allImages
getContentResolver
ImageManager
.DataLocation
ImageManager
.INCLUDE_IMAGES
ImageManager
.INCLUDE_VIDEOS
ImageManager
.SORT_ASCENDING
mImageList
.setOnChangeListener
ImageManager
.IImageList
ImageManager
.IImageList
Log.v(TAG, &onChange &&&&&&&&&&&&&&&&&&&&&&&&&&);
for (int i = 0; i & list.getCount(); i++) {
ImageManager.IImage img = list.getImageAt(i);
Log.v(TAG, &pos & + i + & & + img.fullSizeImageUri());
String picasaId = img.getPicasaId();
if (picasaId == null || picasaId.length() == 0) {
synchronized (mUploadList) {
Uri uri = img.fullSizeImageUri();
if (mUploadList.contains(uri)) {
mUploadList.add(img.fullSizeImageUri());
mUploadList.notify();
, mHandler
LOCAL_LOGV
, &got image list with count &
mImageList
synchronized
mUploadList
.getStringExtra
&imageuri&
LOCAL_LOGV
, &starting UploadS startId = &
& start uri: &
mImageList
.getImageForUri
mUploadList
LOCAL_LOGV
, &queing upload of &
.fullSizeImageUri
mUploadList
// for now upload all applies to images only, not videos
mImageList
mImageList
.getImageAt
instanceof
ImageManager
.fullSizeImageUri
mUploadList
LOCAL_LOGV
, &queing upload of &
.fullSizeImageUri
mUploadList
updateNotification
synchronized
mUploadList
mUploadList
updateNotification
videosCount
, imagesCount
mUploadList
// TODO yes this is a hack
mUploadList
videosCount
imagesCount
updateNotification
imagesCount
, videosCount
// This is the object that recieves interactions from clients.
onTransact
updateNotification
pendingImagesCount
pendingVideosCount
mVideoUploadId
mImageUploadId
pendingImagesCount
mNotificationManager
mNotificationManager
mImageUploadId
detailedMsg
getResources
.getString
.uploadingNPhotos
, pendingImagesCount
Notification
Notification
.stat_sys_upload
getResources
.getString
.uploading_photos
.currentTimeMillis
getResources
.getString
.uploading_photos_2
detailedMsg
mNotificationManager
mImageUploadId
pendingVideosCount
mNotificationManager
mNotificationManager
mVideoUploadId
detailedMsg
getResources
.getString
.uploadingNVideos
, pendingImagesCount
Notification
Notification
.stat_sys_upload
getResources
.getString
.uploading_videos
.currentTimeMillis
getResources
.getString
.uploading_videos_2
detailedMsg
mNotificationManager
mVideoUploadId
, &running upload thread...&
synchronized
mUploadList
LOCAL_LOGV
, &mUploadList.size() is &
mUploadList
mUploadList
updateNotification
, &waiting...&
mUploadList
, &done waiting...&
InterruptedException
mUploadList
if (LOCAL_LOGV) Log.v(TAG, &exiting run, stoping service&);
stopSelf(mStartId);
mUploadList
mImageList
.getImageForUri
, &got uri &
updateNotification
.currentTimeMillis
uploadItem
.currentTimeMillis
LOCAL_LOGV
, &upload took &
&; success = &
synchronized
mUploadList
mUploadList
mUploadList
.fullSizeImageUri
retryDelay
LOCAL_LOGV
, &failed to upload &
.fullSizeImageUri
& trying again in &
retryDelay
synchronized
mUploadList
.currentTimeMillis
mUploadList
retryDelay
.currentTimeMillis
, &retry waited &
InterruptedException
, &ping, was waiting but now retry again&
, &got exception in upload thread&
LOCAL_LOGV
, &finished task&
getLatLongString
.hasLatLong
&&georss:where&&gml:Point&&gml:pos&&
.getLatitude
.getLongitude
&&/gml:pos&&/gml:Point&&/georss:where&&
uploadAlbumName
.SharedPreferences
PreferenceManager
.getDefaultSharedPreferences
.getString
&pref_camera_upload_albumname_key&
, sUploadAlbumName
uploadItem
LOCAL_LOGV
, &starting work on &
instanceof
ImageManager
.VideoObject
LOCAL_LOGV
, &Uploading video&
computeYouTubeAuthToken
VideoUploadTask
LOCAL_LOGV
, &Uploading photo&
computeAuthToken
// handle photos
uploadAlbumName
.containsKey
createAlbum
, uploadAlbumName
LOCAL_LOGV
, &made new album: &
.getAlbumName
.getAlbumId
.getAlbumName
mAndroidUploadAlbumPhotos
mAndroidUploadAlbumPhotos
getAlbumContents
mAndroidUploadAlbumPhotos
previousUploadId
.getPicasaId
previousUploadId
mAndroidUploadAlbumPhotos
previousUploadId
, &already have id &
previousUploadId
ImageUploadTask
void broadcastError(int error) {
HashMap map = new HashMap();
map.put(&error&, new Integer(error));
Message send = Message.obtain();
send.what = EVENT_UPLOAD_ERROR;
send.setData(map);
if (mBroadcaster == null) {
mBroadcaster = new Broadcaster();
mBroadcaster.broadcast(send);
mAlbumName
setAlbumName
mAlbumName
setAlbumId
getAlbumName
mAlbumName
getAlbumId
stringFromResponse
HttpResponse
HttpEntity
.getEntity
InputStream
inputStream
.getContent
StringWriter
StringWriter
inputStream
inputStream
, &got resposne &
UploadTask
UploadTask
UploadResponse
HttpResponse
UploadResponse
HttpResponse
stringFromResponse
.getStatusLine
.getStatusCode
getResponse
StreamPart
InputStream
mInputStream
StreamPart
, InputStream
inputStream
contentType
contentType
? &application/octet-stream&
contentType
&ISO-8859-1&
mInputStream
inputStream
inputStream
.available
IOException
lengthOfData
IOException
OutputStream
IOException
mInputStream
mInputStream
sendDispositionHeader
OutputStream
IOException
sendContentTypeHeader
OutputStream
IOException
contentType
getContentType
contentType
CONTENT_TYPE_BYTES
EncodingUtils
.getAsciiBytes
contentType
getCharSet
CHARSET_BYTES
EncodingUtils
.getAsciiBytes
StringPartX
StringPart
StringPartX
setContentType
&application/atom+xml&
sendDispositionHeader
OutputStream
IOException
sendContentTypeHeader
OutputStream
IOException
contentType
getContentType
contentType
CONTENT_TYPE_BYTES
EncodingUtils
.getAsciiBytes
contentType
getCharSet
CHARSET_BYTES
EncodingUtils
.getAsciiBytes
MultipartEntityX
MultipartEntity
MultipartEntityX
, HttpParams
getContentType
StringBuilder
StringBuilder
&multipart/ boundary=&
EncodingUtils
.getAsciiString
getMultipartBoundary
BasicHeader
.CONTENT_TYPE
UploadResponse
youTubeAuthenticate
FileInputStream
inputStream
FileInputStream
.fullSizeImageData
.addHeader
BasicHeader
&Authorization&
, &GoogleLogin auth=&
youTubeAuthenticate
// TODO: remove hardwired key? - This is our official YouTube issued developer key to Android.
youTubeDeveloperKey
&key=AI39si5Cr35CiD1IgDqD9Ua6N4dSbY-oibnLUPITmBN_rFW6qRz-hd8sTqNzRf1gzNwSYZbDuS31Txa4iKyjAVJA&
.addHeader
&X-GData-Key&
, youTubeDeveloperKey
.addHeader
, filename
StringPartX
&param_name&
StreamPart
&field_uploadfile&
, inputStream
, mimeType
MultipartEntity
MultipartEntityX
.getParams
.setEntity
HttpResponse
LOCAL_LOGV
, &doUpload response is &
.getStatusLine
UploadResponse
.IOException
LOCAL_LOGV
, &IOException in doUpload&
ResponseHandler
implements
ElementListener
ATOM_NAMESPACE
&http://www.w3.org/2005/Atom&
PICASSA_NAMESPACE
&/photos/2007&
ContentHandler
ResponseHandler
RootElement
RootElement
ATOM_NAMESPACE
.setElementListener
PICASSA_NAMESPACE
.setEndTextElementListener
EndTextElementListener
.getContentHandler
Attributes
attributes
ContentHandler
getContentHandler
VideoUploadTask
UploadTask
VideoUploadTask
getYouTubeBaseUrl
&http://uploads.&
&/feeds/users/&
mYouTubeUsername
&/uploads?client=ytapi-google-android&
instanceof
ImageManager
.VideoObject
ImageManager
.VideoObject
ImageManager
.VideoObject
.getIsPrivate
&&yt:private/&&
// there must be a keyword or YouTube will reject the video
getResources
.getString
.upload_default_tags_text
// TODO: use the real category when we have the category spinner in details
category = video.getCategory();
// there must be a description or YouTube will get an internal error and return 500
getResources
.getString
.upload_default_category_text
description
.getDescription
description
description
// there must be a description or YouTube will get an internal error and return 500
description
getResources
.getString
.upload_default_description_text
&&?xml version='1.0'?&/n
&&entry xmlns='http://www.w3.org/2005/Atom'/n
xmlns:media='/mrss/'/n
xmlns:yt='/schemas/2007'&/n
&media:group&/n
&media:title type='plain'&&
&&/media:title&/n
// TODO: need user entered title
&media:description type='plain'&&
description
&&/media:description&/n
&media:category scheme='/schemas/2007/categories.cat'&/n
&/media:category&/n
&media:keywords&&
&&/media:keywords&/n
&/media:group&/n
&&/entry&&
LOCAL_LOGV
, &uploadUrl: &
LOCAL_LOGV
, &GData: &
UploadResponse
&video/3gpp2&
mYouTubeAuthToken
.fullSizeImageUri
.getLastPathSegment
.getStatus
.getResponse
&Token expired&
// When we tried to upload a video to YouTube, the youtube server told us
// our auth token was expired. Get a new one and try again.
.invalidateAuthToken
mYouTubeAuthToken
GoogleLoginServiceNotFoundException
, &Could not invalidate youtube auth token&
mYouTubeAuthToken
// Forces computeYouTubeAuthToken to get a new token.
computeYouTubeAuthToken
ImageUploadTask
UploadTask
ImageUploadTask
getServiceBaseUrl
mPicasaUsername
.getAlbumId
description
.getDescription
&&entry xmlns='http://www.w3.org/2005/Atom' xmlns:georss='http://www.georss.org/georss' xmlns:gml='http://www.opengis.net/gml'&&title&&
&&/title&&
&&summary&&
description
? description
&&/summary&&
getLatLongString
&&category scheme='/g/2005#kind' term='/photos/2007#photo'/&&/entry&/n
LOCAL_LOGV
, &xml for image is &
UploadResponse
&image/jpeg&
mPicasaAuthToken
.getStatus
HttpStatus
.SC_UNAUTHORIZED
HttpStatus
.SC_FORBIDDEN
HttpStatus
.SC_INTERNAL_SERVER_ERROR
.invalidateAuthToken
mPicasaAuthToken
GoogleLoginServiceNotFoundException
, &Could not invalidate picasa auth token&
mPicasaAuthToken
ResponseHandler
ResponseHandler
.getResponse
.getContentHandler
.setPicasaId
mAndroidUploadAlbumPhotos
.SAXException
, &SAXException in doUpload &
createAlbum
mPicasaAuthToken
getServiceBaseUrl
mPicasaUsername
entryString
&&entry xmlns='http://www.w3.org/2005/Atom' xmlns:media='/mrss/' xmlns:gphoto='/photos/2007'&&
&&title type='text'&&
&&/title&&
&&summary&&
&&/summary&&
&&gphoto:access&private&/gphoto:access&&
&&gphoto:commentingEnabled&true&/gphoto:commentingEnabled&&
&&gphoto:timestamp&&
.currentTimeMillis
&&/gphoto:timestamp&&
&&category scheme=/&
/g/2005#kind/&
/photos/2007#album/&
&&/entry&/n
StringEntity
StringEntity
entryString
.setContentType
BasicHeader
&Content-Type&
, &application/atom+xml&
.setEntity
.addHeader
BasicHeader
&Authorization&
, &GoogleLogin auth=&
HttpResponse
LOCAL_LOGV
, &status is &
.getStatusLine
.getStatusLine
.getStatusCode
.getStatusLine
.getStatusCode
stringFromResponse
PicasaAlbumHandler
.getContentHandler
.UnsupportedEncodingException
, &gak, UnsupportedEncodingException &
.IOException
, &IOException &
.SAXException
, &XmlPullParserException &
streamToString
InputStream
IOException
BufferedReader
BufferedReader
InputStreamReader
StringBuilder
StringBuilder
InputStream
LOCAL_LOGV
.setHeader
BasicHeader
&Authorization&
&GoogleLogin auth=&
mPicasaAuthToken
HttpResponse
LOCAL_LOGV
, &response is &
.getStatusLine
.getStatusLine
.getStatusCode
HttpStatus
.SC_UNAUTHORIZED
HttpStatus
.SC_FORBIDDEN
HttpStatus
.SC_INTERNAL_SERVER_ERROR
// http://b/1151576
.invalidateAuthToken
mPicasaAuthToken
GoogleLoginServiceNotFoundException
, &Could not invalidate picasa auth token&
mPicasaAuthToken
computeAuthToken
mPicasaAuthToken
// retry fetch after getting new token
InputStream
inputStream
.getEntity
.getContent
inputStream
.IOException
, &IOException&
LOCAL_LOGV
, &getAlbums&
PicasaAlbumHandler
PicasaAlbumHandler
getServiceBaseUrl
mPicasaUsername
&?kind=album&
InputStream
inputStream
inputStream
, &can't get &
&; bail from getAlbums()&
mPicasaAuthToken
inputStream
.findEncodingByName
.getContentHandler
LOCAL_LOGV
, &done getting albums&
inputStream
IOException
, &got exception &
.printStackTrace
SAXException
, &got exception &
.printStackTrace
LOCAL_LOGV
.getAlbums
, &album: &
.getAlbums
getAlbumContents
getServiceBaseUrl
mPicasaUsername
&?kind=photo&max-results=10000&
InputStream
inputStream
inputStream
AlbumContentsHandler
AlbumContentsHandler
inputStream
.findEncodingByName
.getContentHandler
.getPhotos
inputStream
IOException
, &got IOException &
.printStackTrace
SAXException
, &got SAXException &
.printStackTrace
AlbumContentsHandler
implements
ElementListener
ATOM_NAMESPACE
&http://www.w3.org/2005/Atom&
PICASA_NAMESPACE
&/photos/2007&
ContentHandler
AlbumContentsHandler
RootElement
RootElement
ATOM_NAMESPACE
ATOM_NAMESPACE
.setElementListener
PICASA_NAMESPACE
.setEndTextElementListener
EndTextElementListener
.getContentHandler
Attributes
attributes
ContentHandler
getContentHandler
getServiceBaseUrl
&/data/feed/api/user/&
PicasaAlbumHandler
implements
ElementListener
ATOM_NAMESPACE
&http://www.w3.org/2005/Atom&
PICASSA_NAMESPACE
&/photos/2007&
ContentHandler
PicasaAlbumHandler
PicasaAlbumHandler
RootElement
RootElement
ATOM_NAMESPACE
RootElement
ATOM_NAMESPACE
ATOM_NAMESPACE
.setElementListener
ATOM_NAMESPACE
.setEndTextElementListener
EndTextElementListener
.setAlbumName
PICASSA_NAMESPACE
.setEndTextElementListener
EndTextElementListener
.setAlbumId
.getContentHandler
Attributes
attributes
.getAlbumName
ContentHandler
getContentHandler
syntax highlighted by
, v. 0.9.1
版权声明:本文为博主原创文章,未经博主允许不得转载。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:485957次
积分:7398
积分:7398
排名:第1344名
原创:253篇
转载:114篇
评论:160条
(1)(6)(1)(1)(1)(1)(1)(3)(4)(14)(1)(5)(7)(3)(8)(5)(1)(1)(5)(3)(4)(7)(25)(9)(3)(11)(8)(1)(1)(3)(5)(1)(2)(1)(4)(2)(7)(17)(3)(1)(8)(9)(1)(3)(24)(9)(5)(18)(11)(10)(83)

我要回帖

更多关于 p2p是什么意思 的文章

 

随机推荐