根据交银施罗德真实环境已测试通过,此过程可以作为非J2EE部署的典型案例,主要是针对某些对安全性要求较高的解决方案:

基本的实现原理和部分代码如下:

1.客户端访问交银.net系统,由该系统发送请求,访问方式为:http://润乾报表服务器ip:9090/appsOnlineUms/index.jsp?token=b96335b0db0347bf9b98c4fb2a3fdb38


2.由index.jsp接收到传过来的token值(系统唯一值),

3.根据传过来的token值调用.net系统的定义的WebServices的http://portal.jysld.com/jyportalinterface/

reportrights.asmx方法,此方法里相关有用的信息

index.jsp部分代码:

<%

String token = request.getParameter(“token”);

System.out.println(“传过来的token:” + token);

ReportRightsClient client = new ReportRightsClient();

ReportRightsSoap service = client.getReportRightsSoap();

ReportRightResult reportResult=service.getRight(token);

String displayName= reportResult.getDisplayName();

String Account=reportResult.getAccount();

String raq= reportResult.getReportName();

boolean flag=reportResult.isRight();

session.setAttribute(“flag”, flag);

System.out.println(“别名:”+displayName);

System.out.println(“ACount:”+Account);

System.out.println(“报表名:”+raq);

System.out.println(“是否有权限:”+flag);

%>

4.对WebServices方法的处理两个基本java类:ReportRightsClient.java代码如下:

package com;

import java.net.MalformedURLException;

import java.util.Collection;

import java.util.HashMap;

import javax.xml.namespace.QName;

import org.codehaus.xfire.XFireRuntimeException;

import org.codehaus.xfire.aegis.AegisBindingProvider;

import org.codehaus.xfire.annotations.AnnotationServiceFactory;

import org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations;

import org.codehaus.xfire.client.XFireProxyFactory;

import org.codehaus.xfire.jaxb2.JaxbTypeRegistry;

import org.codehaus.xfire.service.Endpoint;

import org.codehaus.xfire.service.Service;

import org.codehaus.xfire.soap.AbstractSoapBinding;

import org.codehaus.xfire.transport.TransportManager;

import org.tempuri.ReportRightResult;

public class ReportRightsClient {

private static XFireProxyFactory proxyFactory = new XFireProxyFactory();

private HashMap endpoints = new HashMap();

private Service service0;

public ReportRightsClient() {

create0();

Endpoint ReportRightsSoapLocalEndpointEP = service0 .addEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoapLocalEndpoint”), new QName(“http://tempuri.org/”, “ReportRightsSoapLocalBinding”), “xfire.local://ReportRights”);


endpoints.put(new QName(“http://tempuri.org/”, “ReportRightsSoapLocalEndpoint”), ReportRightsSoapLocalEndpointEP);


Endpoint ReportRightsSoapEP = service0 .addEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoap”), new QName(“http://tempuri.org/”, “ReportRightsSoap”), “http://portal.jysld.com/jyportalinterface/reportrights.asmx”);


endpoints.put(new QName(“http://tempuri.org/”, “ReportRightsSoap”), ReportRightsSoapEP);


public Object getEndpoint(Endpoint endpoint) {

try {

return proxyFactory.create((endpoint).getBinding(), (endpoint).getUrl());

} catch (MalformedURLException e) {

throw new XFireRuntimeException(“Invalid URL”, e);

public Object getEndpoint(QName name) {

Endpoint endpoint = ((Endpoint) endpoints.get((name)));

if ((endpoint) == null) {

throw new IllegalStateException(“No such endpoint!”);

return getEndpoint((endpoint));

public Collection getEndpoints() {

return endpoints.values();

private void create0() {

TransportManager tm = (org.codehaus.xfire.XFireFactory.newInstance().getXFire().getTransportManager());


HashMap props = new HashMap();

props.put(“annotations.allow.interface”, true);

AnnotationServiceFactory asf = new AnnotationServiceFactory(new Jsr181WebAnnotations(), tm, new AegisBindingProvider(new JaxbTypeRegistry()));


asf.setBindingCreationEnabled(false);

service0 = asf.create((com.ReportRightsSoap.class), props);

AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0, new QName(“http://tempuri.org/”, “ReportRightsSoapLocalBinding”), “urn:xfire:transport:local”);


AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0, new QName(“http://tempuri.org/”, “ReportRightsSoap”), “http://schemas.xmlsoap.org/soap/http”);


public ReportRightsSoap getReportRightsSoapLocalEndpoint() {

return ((ReportRightsSoap)(this).getEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoapLocalEndpoint”)));


public ReportRightsSoap getReportRightsSoapLocalEndpoint(String url) {

ReportRightsSoap var = getReportRightsSoapLocalEndpoint();

org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);

return var;

public ReportRightsSoap getReportRightsSoap() {

return ((ReportRightsSoap)(this).getEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoap”)));


public ReportRightsSoap getReportRightsSoap(String url) {

ReportRightsSoap var = getReportRightsSoap();

org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);

return var;

public static void main(String[] args) {

ReportRightsClient client = new ReportRightsClient();

//create a default service endpoint

ReportRightsSoap service = client.getReportRightsSoap();

//TODO: Add custom client code here

//

//service.yourServiceOperationHere();

ReportRightResult reportResult=service.getRight(“b96335b0db0347bf9b98c4fb2a3fdb38″);


String displayName= reportResult.getDisplayName();

String Account=reportResult.getAccount();

String reportName= reportResult.getReportName();

boolean flag=reportResult.isRight();

System.out.println(“别名:”+displayName);

System.out.println(“ACount:”+Account);

System.out.println(“报表名:”+reportName);

System.out.println(“是否有权限:”+flag);

//测试:

//http://localhost:9090/appsOnlineUms/index.jsp?token=b96335b0db0347bf9b98c4fb2a3fdb38


//http://localhost:9090/appsOnlineUms/index.jsp?token=b96335b0db0347bf9b98c4fb2a3fdb36


System.exit(0);

ReportRightsSoap.java代码如下:

package com;

import javax.jws.WebMethod;

import javax.jws.WebParam;

import javax.jws.WebResult;

import javax.jws.WebService;

import javax.jws.soap.SOAPBinding;

import org.tempuri.ReportRightResult;

@WebService(name = “ReportRightsSoap”, targetNamespace = “http://tempuri.org/”)

@SOAPBinding(use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)


public interface ReportRightsSoap {

@WebMethod(operationName = “GetRight”, action = “http://tempuri.org/GetRight”)

@WebResult(name = “GetRightResult”, targetNamespace = “http://tempuri.org/”)

public ReportRightResult getRight(

@WebParam(name = “token”, targetNamespace = “http://tempuri.org/”)

String token);

5.根据调用的WebServices对其返回的ReportRightResult结果集得到相关的信息

ReportRightResult reportResult=service.getRight(token);

String displayName= reportResult.getDisplayName();//别名

String Account=reportResult.getAccount();//ACount

String raq= reportResult.getReportName();//报表名

boolean flag=reportResult.isRight();//是否有权限

session.setAttribute(“flag”, flag);

6.由返回的权限判断通过Filter进行页面和数据的过滤

OnlineFilter.java的代码:

package filter;

import java.io.IOException;

import javax.servlet.Filter;

import javax.servlet.FilterChain;

import javax.servlet.FilterConfig;

import javax.servlet.RequestDispatcher;

import javax.servlet.ServletException;

import javax.servlet.ServletRequest;

import javax.servlet.ServletResponse;

import javax.servlet.http.*;

public class OnlineFilter extends HttpServlet implements Filter {

private static final long serialVersionUID = 1L;

// private String loginUrl = “”;

public void init(FilterConfig filterConfig) throws ServletException {

// loginUrl = filterConfig.getInitParameter(“exceptUrl”);

public void doFilter(ServletRequest request, ServletResponse response,

FilterChain chain) throws IOException, ServletException,

NullPointerException {

RequestDispatcher dispatcher = request

.getRequestDispatcher(“myErrorPage.jsp”);

HttpServletRequest req = (HttpServletRequest) request;

HttpServletResponse res = (HttpServletResponse) response;

HttpSession session = req.getSession(true);

// 从session里取的权限判断信息

boolean flag = (Boolean) session.getAttribute(“flag”);

System.out.println(“flag:” + flag);

if (!flag) {

// 跳转到登陆页面

dispatcher.forward(request, response);

res.setHeader(“Cache-Control”, “no-store”);

res.setDateHeader(“Expires”, 0);

res.setHeader(“Pragma”, “no-cache”);

System.out.println(“用户没有登陆,不允许操作”);

return;

} else {

chain.doFilter(request, response);

System.out.println(“用户已经登陆,允许操作”);

public void destroy() {

過濾器在web.xml配置如下:

<filter>

<filter-name>onlineFilter</filter-name>

<filter-class>filter.OnlineFilter</filter-class>

<!–

<init-param>

<param-name>exceptUrl</param-name>

<param-value>index.jsp</param-value>

</init-param>

–>

</filter>

<filter-mapping>

<filter-name>onlineFilter</filter-name>

<url-pattern>/reportJsp/*</url-pattern>

</filter-mapping>

<filter-mapping>

<filter-name>onlineFilter</filter-name>

<url-pattern>/jsp/*</url-pattern>

</filter-mapping>

<filter-mapping>

<filter-name>onlineFilter</filter-name>

<url-pattern>/reportServlet</url-pattern>

</filter-mapping>

7.通过获取的权限最终达到数据的完整交互 index.jsp部分代码:

<%

String realPath = “http://”

+ request.getServerName()

+ “:”

+ request.getServerPort()

+ request.getContextPath()

+ request.getServletPath().substring(0,

request.getServletPath().lastIndexOf(“/”) + 1);

String fullfilePath = realPath + “reportJsp/showReport.jsp?raq=”

+ raq;

System.out.println(“fullfilePath:” + fullfilePath);

response.sendRedirect(fullfilePath);

%>

优点:1.权限安全系数更高,只保证当前用户有权限操作,防止了部分通过新开IE记住URL的方式访问,包括

想通过查看源文件里对servlet的处理等,

2.权限的配置,操作完全交给.net系统处理,对报表的应用只要告诉我有没有权限执行当前的操作,要用的报

表,当前的用户信息即可,通用性好,耦合度低,易于集成

缺点:由于是跨语言,跨服务器集成操作,多多少少网络可能会阻止一些访问效率和响应时间等

难点:对WebServices代码的操作过程…

非J2EE部署解决方案的更多相关文章

  1. Eclipse(非J2EE版本)配置Extjs环境以及安装部署Tomcat

    Eclipse(非J2EE版本)配置Extjs环境(Spket) 1. 安装spket插件,帮助->安装新软件->http://www.agpad.com/update. 2. 设置Spk ...

  2. 部署解决方案包 (SharePoint Server 2010)

    转:http://technet.microsoft.com/zh-cn/library/cc262995(v=office.14).aspx 本文介绍各个解决方案包,及其在 Microsoft Sh ...

  3. 【G】开源的分布式部署解决方案(一) - 开篇

    做这个开源项目的意义是什么?(口水自问自答,不喜可略过) 从功能上来说,请参考 预告篇,因自知当时预告片没有任何含金量,所以并没有主动推送到首页,而是私下的给一些人发的. 从个人角度上来说,我希望.n ...

  4. 【G】开源的分布式部署解决方案 - 预告篇

    为什么想到要做分布式部署解决方案? 当项目越做越大以后,你会发现部署变成一件极其头疼的事情.当然头疼的绝不仅仅在部署一个环节,比如新服务器环境搭建当中就许多坑要踩.各种重复性的工作,包括但不仅限于增加 ...

  5. 【G】开源的分布式部署解决方案(三) - 一期规划定稿与初步剖析

    G.系列导航 [G]开源的分布式部署解决方案 - 预告篇 [G]开源的分布式部署解决方案(一) - 开篇 [G]开源的分布式部署解决方案(二) - 好项目是从烂项目基础上重构出来的 [G]开源的分布式 ...

  6. 【G】开源的分布式部署解决方案文档 - 手动安装

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 序言 因各种原因,决定先写使用文档.也证明下项目没有太监.至于安装过程复杂,是因为还没有做一键安装,这个现阶段确实没精力. 项目进度 (点击图片 ...

  7. 【G】开源的分布式部署解决方案文档 - 使用手册

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 已知问题 导航没有联动 因为权限只是做了基础的登录校验,考虑到后面导航要跟权限关联上暂时是写死的. 只有部分界面使用了Vue.js 因为刚开始没 ...

  8. 【G】开源的分布式部署解决方案文档 - Web Deploy

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 微软官方部署方式 右键项目->发布 这个大家应该再熟悉不过,在部署前有个预览界面可以看本次更新到底更新哪些文件. 既然它可以预览部署结果, ...

  9. 【G】开源的分布式部署解决方案文档 - 部署Console & 控制负载均衡 & 跳转持续集成控制台

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 设置项目部署流程 项目类型:选择Console,这个跟功能无关,只是做项目分类,后面会有后续功能 宿主:选择Console 部署方式:选择原始, ...

随机推荐

  1. oracle 转 mysql 最新有效法

    关键字:Oracle 转 MySQL . Oracle TO MySQL 没事试用了一下Navicat家族的新产品Navicat Premium,他集 Oracle.MySQL和PostgreSQL管 ...

  2. (转)Python 3 collections.defaultdict() 与 dict的使用和区别

    原文:https://www.cnblogs.com/herbert/archive/2013/01/09/2852843.html 在Python里面有一个模块collections,解释是数据类型 ...

  3. 使用Intent在活动之间穿梭

    使用Intent在活动之间穿梭 1.在com.example.activitytest中创建第二个活动SecondActivity: /** * 第二个活动 */ public class Secon ...

  4. JVM-调优命令

    jps JVM Process Status Tool,显示指定系统内所有的HotSpot虚拟机进程. 命令格式:   jps [options] [hostid] option参数: -l : 输出 ...

  5. asp.net MVC 多系统目录结构

    学习了几天的mvc5,发现vs把所有的控制器都放在同一个目录Controllers目录下,细想一下,假如一个项目包含几个系统: 行政办公系统.培训管理系统.督办管理系统.会议管理系统…… 如果还把控制 ...

  6. Android 开发工具类 06_NetUtils

    跟网络相关的工具类: 1.判断网络是否连接: 2.判断是否是 wifi 连接: 3.打开网络设置界面: import android.app.Activity; import android.cont ...

  7. Android 开发工具类 05_Logcat 统一管理类

    Logcat 统一管理类: 1.默 认tag 的函数: 2.自定义 tag 的函数. import android.util.Log; // Logcat 统一管理类 public class L { ...

  8. 仿制淘宝sku点击效果

    1.依赖jquery,主要利用二维数组. 2.原生手写. 代码如下: <!DOCTYPE html> <html> <head> <meta charset= ...

  9. golang channel的使用

    channel常常结合go程使用,作为通信消息队列 var testChan chan int fmt.Println(testChan) // nil 未初始化,没地址 testChan ) fmt ...

  10. 数据库学习---SQL基础(二)

    数据库学习---SQL基础(一) 数据库学习---SQL基础(二) 数据库学习---SQL基础(三) 上篇复习的sql的增删改查,and ,or ,>=, <=,!=等逻辑运算符,还有in ...