Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
java-nginx-upload-processor
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
022ab2fc
authored
2014-01-13 17:26:40 -0600
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
stubbed in servlet
0 parents
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
0 deletions
build.xml
ofbiz-component.xml
src/com/brainfood/servlet/NGINXUploadProcessor.java
build.xml
0 → 100644
View file @
022ab2f
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
<project
name=
"nginx-uploader"
default=
"jar"
basedir=
"."
>
<property
name=
"ofbiz.home.dir"
value=
"../ofbiz"
/>
<import
file=
"${ofbiz.home.dir}/common.xml"
/>
<!-- ================================================================== -->
<!-- Initialization of all property settings -->
<!-- ================================================================== -->
<property
name=
"desc"
value=
"NGINX Upload emulator"
/>
<property
name=
"name"
value=
"nginx-uploader"
/>
<path
id=
"local.class.path"
>
<!--<fileset dir="${lib.dir}" includes="*.jar"/>-->
<fileset
dir=
"${ofbiz.home.dir}/framework/webapp/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/webapp/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/base/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/base/lib/commons"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/base/lib/scripting"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/base/lib/j2eespecs"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/base/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/entity/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/entity/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/security/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/service/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/service/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/minilang/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/common/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/webapp/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/applications/party/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/applications/product/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/applications/marketing/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/applications/order/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/applications/accounting/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/applications/securityext/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/start/build/lib"
includes=
"*.jar"
/>
<fileset
dir=
"${ofbiz.home.dir}/framework/catalina/lib"
includes=
"*.jar"
/>
</path>
</project>
ofbiz-component.xml
0 → 100644
View file @
022ab2f
<?xml version="1.0" encoding="UTF-8"?>
<ofbiz-component
name=
"nginxuploader"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.ofbiz.org/dtds/ofbiz-component.xsd"
>
<resource-loader
name=
"main"
type=
"component"
/>
<classpath
type=
"dir"
location=
"config"
/>
<classpath
type=
"jar"
location=
"lib/*"
/>
<classpath
type=
"jar"
location=
"build/lib/*"
/>
<webapp
name=
"nginx-uploader"
title=
"Big Fun Print Client Files"
server=
"default-server"
location=
"www"
mount-point=
"/upload"
app-bar-display=
"false"
/>
</ofbiz-component>
src/com/brainfood/servlet/NGINXUploadProcessor.java
0 → 100644
View file @
022ab2f
package
com
.
brainfood
.
servlet
;
import
java.io.IOException
;
import
java.io.File
;
import
java.io.PrintWriter
;
import
java.util.List
;
import
javax.servlet.*
;
import
javax.servlet.http.*
;
import
org.apache.commons.fileupload.*
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.apache.commons.fileupload.servlet.ServletFileUpload
;
public
class
NGINXUploadProcessor
extends
HttpServlet
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
void
destroy
()
{
// TODO Auto-generated method stub
}
@Override
public
ServletConfig
getServletConfig
()
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
String
getServletInfo
()
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
void
init
(
ServletConfig
config
)
throws
ServletException
{
// TODO Auto-generated method stub
}
@Override
public
void
service
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
if
(
ServletFileUpload
.
isMultipartContent
(
request
))
{
// Create a factory for disk-based file items
DiskFileItemFactory
factory
=
new
DiskFileItemFactory
();
// Configure a repository (to ensure a secure temp location is used)
ServletContext
servletContext
=
this
.
getServletConfig
()
.
getServletContext
();
File
repository
=
(
File
)
servletContext
.
getAttribute
(
"javax.servlet.context.tempdir"
);
factory
.
setRepository
(
repository
);
// Create a new file upload handler
ServletFileUpload
upload
=
new
ServletFileUpload
(
factory
);
// Parse the request
PrintWriter
out
=
new
PrintWriter
(
response
.
getWriter
());
try
{
List
<?>
items
=
upload
.
parseRequest
(
request
);
out
.
println
(
items
);
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
out
.
close
();
}
else
{
PrintWriter
out
=
new
PrintWriter
(
response
.
getWriter
());
out
.
println
(
"Must be a multipart upload"
);
out
.
close
();
}
}
}
Please
register
or
sign in
to post a comment